var week = Array("\â\î\ñ\ê\ð\å\ñ\å\í\ü\å", "\ï\î\í\å\ä\å\ë\ü\í\è\ê", "\â\ò\î\ð\í\è\ê", "\ñ\ð\å\ä\à", "÷\å\ò\â\å\ð\ã", "\ï\ÿ\ò\í\èö\à", "\ñ\ó\á\á\î\ò\à")
var mnth = Array("\ÿ\í\â\à\ð\ÿ", "\ô\å\â\ð\à\ë\ÿ", "\ì\à\ð\ò\à", "\à\ï\ð\å\ë\ÿ", "\ì\à\ÿ", "\è\þ\í\ÿ", "\è\þ\ë\ÿ", "\à\â\ã\ó\ñ\ò\à", "\ñ\å\í\ò\ÿ\á\ð\ÿ", "\î\ê\ò\ÿ\á\ð\ÿ", "\í\î\ÿ\á\ð\ÿ", "\ä\å\ê\à\á\ð\ÿ")

function Clock() {
  var time = new Date()
  var hour = time.getHours()
  var minute = time.getMinutes()
  var second = time.getSeconds()
  var now = new srvClock(time.getDate() + "." + time.getMonth() + "." + time.getFullYear() + "." + time.getDay())

////// äëÿ NN //////
//  srvClock.call(this,time.getDate() + "." + time.getMonth() + "." + time.getFullYear() + "." + time.getDay())

  for (var i in now) {this[i] = now[i]}
  
  if (hour < 10) hour = "0" + hour
  if (minute < 10) minute = "0" + minute
  if (second < 10) second = "0" + second
  
  this.hour = hour
  this.minute = minute
  this.second = second
  
  this.fullTime = hour + ":" + minute
}

function srvClock(fDate) {
  this.date = eval(fDate.split(".")[0])
  this.month = eval(fDate.split(".")[1]) + 1
  this.monthW = mnth[this.month-1]
  this.year = eval(fDate.split(".")[2])
  
  if (arguments.length>3) this.day = week[eval(fDate.split(".")[3])]
    else this.day = week[new Date(this.year,this.month-1,this.date).getDay()]

  this.fullDateW = (this.date[0]=="0" ? this.date.substring(1,this.date.length) : this.date) + " " + this.monthW + " " + this.year + " \ã\î\ä\à, " + this.day
  
  yestDate(this.date,this.month,this.year)
  this.dateYst = dYst
  this.monthYst = mYst
  this.yearYst = yYst
  
  yestDate(this.dateYst,this.monthYst,this.yearYst)
  this.yearBefYst = yYst
  this.monthBefYst = mYst
  this.dateBefYst = dYst
  
  this.fullDate = ((this.date < 10) ? "0" + this.date : this.date) + "." + ((this.month < 10) ? "0" + this.month : this.month) + "." + this.year
  this.fullYesterday = ((this.dateYst < 10) ? "0" + this.dateYst : this.dateYst) + "." + ((this.monthYst < 10) ? "0" + this.monthYst : this.monthYst) + "." + this.yearYst
  this.fullBefYesterday = ((this.dateBefYst < 10) ? "0" + this.dateBefYst : this.dateBefYst) + "." + ((this.monthBefYst < 10) ? "0" + this.monthBefYst : this.monthBefYst) + "." + this.yearBefYst
}

function srvClockNew(fDate) {
  this.date = eval(fDate.split(".")[0])
  this.month = parseInt(eval(fDate.split(".")[1]))
  this.monthW = mnth[this.month-2]
  this.year = eval(fDate.split(".")[2])
  
  if (arguments.length>3) this.day = week[eval(fDate.split(".")[3])]
    else this.day = week[new Date(this.year,this.month-1,this.date).getDay()]

  this.fullDateW = (this.date[0]=="0" ? this.date.substring(1,this.date.length) : this.date) + " " + this.monthW + " " + this.year + " \ã\î\ä\à, " + this.day
  
  yestDate(this.date,this.month,this.year)
  this.dateYst = dYst
  this.monthYst = mYst
  this.yearYst = yYst
  
  yestDate(this.dateYst,this.monthYst,this.yearYst)
  this.yearBefYst = yYst
  this.monthBefYst = mYst
  this.dateBefYst = dYst
  
  this.fullDate = ((this.date < 10) ? "0" + this.date : this.date) + "." + ((this.month < 10) ? "0" + this.month : this.month) + "." + this.year
  this.fullYesterday = ((this.dateYst < 10) ? "0" + this.dateYst : this.dateYst) + "." + ((this.monthYst < 10) ? "0" + this.monthYst : this.monthYst) + "." + this.yearYst
  this.fullBefYesterday = ((this.dateBefYst < 10) ? "0" + this.dateBefYst : this.dateBefYst) + "." + ((this.monthBefYst < 10) ? "0" + this.monthBefYst : this.monthBefYst) + "." + this.yearBefYst
}

function yestDate(d,m,y) {
  yYst = y
  mYst = m
  dYst = d - 1
  if (dYst == 0) {
    mYst = mYst - 1
    if (mYst == 0) {
      mYst = 12
      yYst = yYst - 1
    }
    dYst = lastDate(mYst, yYst)
  }
}

function lastDate(mnth,yr) {
  switch (mnth) {
    case 1:
      return 31
      break
    case 2:
      if (parseInt(yr/4) == yr/4) return 29
        else return 28
      break
    case 3:
      return 31
      break
    case 4:
      return 30
      break
    case 5:
      return 31
      break
    case 6:
      return 30
      break
    case 7:
      return 31
      break
    case 8:
      return 31
      break
    case 9:
      return 30
      break
    case 10:
      return 31
      break
    case 11:
      return 30
      break
    case 12:
      return 31
      break
  }
}

function inNdays(fDate,n) {
  var time = new Date(new Date(eval(fDate.split(".")[2]),eval(fDate.split(".")[1]),eval(fDate.split(".")[0])).getTime() + n*86400000)
  var now = new srvClock(time.getDate() + "." + time.getMonth() + "." + time.getFullYear() + "." + time.getDay())
  return now
}