//Copyright Netburn Web Solutions. You may "borrow" a line here and there, but not larger pieces of the code.
function l0(n){return n>9?n:'0'+n}
function rupl(n,p){
var pos=p.indexOf('[')
if(pos==-1)return p
n=n+''
var z=n.substr(-1),sf=p.substr(pos+2,p.indexOf(']')-pos-2).split('|'),s=p.substr(0,pos)
if(l=='cs'){if(n!=0&&n<5)return s+sf[0];return s+sf[1]}
if(l=='mk'){if(n%10==1&&n%100!=11)return s+sf[1];return s+sf[0]}
if((4<n&&n<21)||'056789'.indexOf(z)!=-1)return s+sf[0]
if(1==z)return s+sf[1]
return s+sf[2]
}
function nicetime(secD,dec){
var nicet=''
var d=Math.floor(secD/86400)
if(d==1)nicet+='1 '+p_d
else if(d!=0)nicet+=d+rupl(d,p_ds)
var remD=secD%86400
d=Math.floor(remD/3600)
if(d!=0){
if(nicet!='')nicet+=', '
if(d==1)nicet+='1'+p_h
else if(d!=0)nicet+=d+rupl(d,p_hs)
}
remD=remD%3600
d=Math.floor(remD/60)
if(d!=0){
if(nicet!='')nicet+=', '
if(d==1)nicet+='1'+p_m
else if(d!=0)nicet+=d+rupl(d,p_ms)
}
if(nicet!='')nicet+=p_and
d=(remD%60).toFixed(dec)
if(dec==0&&d==1)nicet+='1'+p_s;else nicet+=d.replace('.',p_dec_sym)+rupl(d,p_ss)
return nicet
}
function build_date(t){
var y=t.getUTCFullYear()+'',m=t.getUTCMonth()+1
var nY=new Date(Date.UTC(y,0,1))
var thoff=nY.getUTCDay()-1
if(thoff==-1)thoff=6
var wn=Math.floor((t-nY)/604800000+(thoff/7)),dn=p_d+' '+Math.floor((t-nY)/86400000+1)
if(thoff<4)wn++
if(wn==0){
wn=52
if(new Date(y-1,0,1).getDay()==4||new Date(y-1,11,31).getDay()==4)wn=53
}
if((wn==52||wn==53)&&t.getUTCDay()!=0&&27<t.getUTCDate()-t.getUTCDay())wn=1
if(p_wn=='hy'){if(wn==1)pwn='1-ին շաբաթ';else pwn=wn+'-րդ շաբաթ'}else pwn=p_wn.replace('%n',wn)
return conf['d'].replace('%j',t.getUTCDate()).replace('%d',l0(t.getUTCDate())).replace('%W',pwn).replace('%n',m).replace('%m',l0(m)).replace('%y',y.substr(2,2)).replace('%Y',y).replace('%F',months[m-1]).replace('%M',monthsh[m-1]).replace('%l',days[t.getUTCDay()]).replace('%D',daysh[t.getUTCDay()]).replace('%z',dn)
}
function TimeIs(t,dt,dy,pl,ld){
var tout='',prevTime=0,prevDate='',prevHm='',prevSync='',tickTime='',tickDate='',ticks=0,reloadCount=0,
timeDivO=gob(t),ddO=gob(dt),dayDivO=gob(dy),pLO=gob(pl),lCO=gob(ld),u="undefined"
this.susdivo=gob('susdiv')
this.susdivname='susdiv'
this.initClock=function(){
var t=new Date(),czo=-t.getTimezoneOffset()
if(conf['o']==='')conf['o']=czo
if(zone_offset==='')zone_offset=czo
t.setTime(t.getTime()-tD+(zone_offset)*60000)
lastsync=ticks
if(tout!='')clearTimeout(tout)
tout=setTimeout('T_I.tick("",1)',updint-t%updint)
this.tick('',0)
var secD=Math.abs(tD/1000).toFixed(1)
if(secD<.4)syncm=p_exactt
else{
var nicet=nicetime(secD,1)
if(tD<0)syncm=p_ur_late.replace('%t',nicet)+p_t_is
else syncm=p_ur_early.replace('%t',nicet)+p_t_is
}
if(secD<.4)syncdt='<p>'+p_time_diff+(tD/1000).toFixed(3).replace('.',p_dec_sym)+p_ss+' ('+p_plusminus+(latency/2000).toFixed(3).replace('.',p_dec_sym)+p_ss+').</p>'
else syncdt=''
}
this.tick=function(id,tack){
t=new Date()
var ct=new Date(),rw=gob('twd').offsetWidth
t.setTime(t.getTime()-tD)
var t2=new Date(t.getTime())
if((0<ztrans)&&(ztrans<t.getTime())){ticks=2
zone_offset=newzo;ztrans=0
sus=[]
chosen_sus=[]
prevsustime=[]
current_q=[]
}
t.setTime(t.getTime()+zone_offset*60000)
if((!/MSIE/.test(navigator.userAgent))&&(!/Firefox/.test(navigator.userAgent)||!/11/.test(ttm))&&(canvaswidth<rw||rez<3)){rez++;if(1<rez&&wfac>=1&&0<rw&&(canvaswidth<rw||(10<canvaswidth-rw))){rez++;wfac=wfac*canvaswidth/rw;setsizes(0)}}
if(ticks==1)httpSync()
ticks++
if(ct-prevTime<0){nosync=0;reloadCount=0}
if(nosync<2&&(4<ticks)&&(reloadCount<10)&&prevTime!=0
&&((ct-prevTime<0)||(Math.abs(ct-prevTime)>1500))
){
if(ticks-lastsync<5)lastsync=ticks
else{
httpSync()
reloadCount++
prevTime=0
}
}
prevTime=ct
hours=t.getUTCHours()
if(hours<12)apv='AM';else{apv='PM';hours-=12}
if(hours==0)hours=12
tickTime=conf['t'].replace('h',l0(hours)).replace('H',l0(t.getUTCHours())).replace('i',l0(t.getUTCMinutes())).replace('s',l0(t.getUTCSeconds()))
var ds=' style="font-size:'+timeFS+'px;line-height:'+timeLH+'px">'
ttm=tickTime;if(/Firefox/.test(navigator.userAgent))tickTime=tickTime.replace(/11/g,'</div><div'+ds+'1</div><div'+ds+'1')
tickTime=tickTime.replace('A','<span style="font-size:'+ampmFS+'px;line-height:'+ampmFS+'px">'+apv+'</span>')
timeDivO.innerHTML='<div id="twd"'+ds+tickTime+'</div>'
if(destT!=0){
diff=Math.floor(t.getTime()/1000-zone_offset*60)-destT
if(diff<0){var diffmsg=p_time_remaining;diff=Math.abs(diff)}
else var diffmsg=p_time_since
gob('desttdiff').innerHTML=diffmsg.replace('%t',nicetime(diff,0))
}
if(auSt==1&&(5<ticks)){
if(t.getUTCSeconds()===0){ao=t_au1m;t_au59s.volume=0;t_au1s.volume=0}
else if(t.getUTCSeconds()<58){ao=t_au1s;t_au59s.volume=0;t_au1m.volume=0}
else {ao=t_au59s;t_au1m.volume=0;t_au1s.volume=0}
if(!isNaN(ao.duration)&&(ao.duration!==0)){ao.currentTime=0;ao.volume=1}
ao.play()
}
if(typeof other_clock!=u)other_clock(t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.getUTCMilliseconds())
var Hm=conf['t'].replace('h',l0(hours)).replace('H',l0(t.getUTCHours())).replace('i',l0(t.getUTCMinutes())).replace(':s','').replace('s','').replace('A',apv)
if(prevHm!=Hm){
prevHm=Hm
if(typeof current_q[T_I.susdivname]=='string'&&current_q[T_I.susdivname]!='')T_I.populate_sus(T_I.susdivname,current_q[T_I.susdivname],0)
for(i=0;i<favzone.length;i++){
if(0<fztr[i]&&fztr[i]<t2.getTime()){fztr[i]=0;favzone[i]=fzn[i]}
var tF=new Date()
tF.setTime(t2.getTime()+favzone[i]*60000)
hours=tF.getUTCHours()
if(hours<12)apv='AM';else{apv='PM';hours-=12}
if(hours==0)hours=12
var Hm=conf['t'].replace('h',l0(hours)).replace('H',l0(tF.getUTCHours())).replace('i',l0(tF.getUTCMinutes())).replace(':s','').replace('s','').replace('A',apv)
gob('favt'+i).innerHTML=Hm
}
}
today=l0(t.getUTCMonth()+1)+''+l0(t.getUTCDate())
if(today!=prevDate){
tickDate=build_date(t)
if(prevDate!=""){i=gob('sun');if(typeof i!=u&&typeof ss[today]!=u)i.innerHTML=ss[today]
else gob('locw').innerHTML=""
}
ddO.innerHTML=tickDate
if((typeof spdays[today]!=u)&&(spdays[today]!='')){dayDivO.innerHTML=spdays[today];dayDivO.style.display='block'}
else dayDivO.style.display='none'
prevDate=today
}
if(!tack)return ''
tout=setTimeout('T_I.tick("",1)',updint-t%updint)
}
this.check_again=function(){
if(xR=='N/A')window.location.reload();else httpSync()}
this.recook=function(){var s='',X='';for(var i in conf){s+=X+i+conf[i];X='X'};confs=s.replace(/ /g,'_').replace(/,/g,'1').replace(/:/g,'2').replace(/%/g,'3');setcookie('c',confs)}
this.set_susdiv=function(sdn){if(sdn!=T_I.susdivname){T_I.take_chosen(T_I.susdivname,0);T_I.susdivname=sdn;T_I.susdivo=gob(sdn)}}
this.populate_sus=function(sdn,thisq,f){
if(f)chosen_sus[sdn]=sus[thisq].length
var ts=new Date(),su=sus[thisq],slist='<table cellpadding="0" cellspacing="0" border="0">',ch,ncn='',n=sdn.replace('susdiv','')
if(su.length!==0){
for(var i in su){
if((0<su[i][5])&&(su[i][5]<t.getTime())){
su[i][4]=su[i][6]
su[i][5]=0
}
ts.setTime(t.getTime()+(su[i][4]-zone_offset)*60000)
hours=ts.getUTCHours()
if(hours<12)apv='AM';else{apv='PM';hours-=12}
if(hours==0)hours=12
var Hm=conf['t'].replace('h',l0(hours)).replace('H',l0(ts.getUTCHours())).replace('i',l0(ts.getUTCMinutes())).replace(':s','').replace('s','').replace('A',apv)
for(j=0;j<4;j++){su[i][j]=su[i][j].replace(/\$6/g,su[i][9]).replace(/\$5/g,su[i][8]).replace(/\$4/g,su[i][7]).replace(/\$2/g,su[i][2]).replace(/\$1/g,su[i][1]).replace(/\$/g,su[i][0]);if(su[i][j]=='')su[i][j]=su[i][0]}
su[i][2]=su[i][2].replace(/ /g,'_')
ch='';if(i==chosen_sus[sdn])ch='" class="chosen'
slist+='<tr valign="top" id="'+sdn+'s'+i+ch+'"><td><a href="javascript:T_I.susgo(\''+jsesc(su[i][0])+'\',\''+jsesc(su[i][1])+'\',\''+jsesc(su[i][2])+'\',\''+jsesc(su[i][3])+'\')" onmouseover="T_I.choose_sus(\''+sdn+'\','+i+')"><span>'+su[i][1]+'</span></a></td><td class="t"><a href="javascript:T_I.susgo(\''+jsesc(su[i][0])+'\',\''+jsesc(su[i][1])+'\',\''+jsesc(su[i][2])+'\',\''+jsesc(su[i][3])+'\')" onmouseover="T_I.choose_sus(\''+sdn+'\','+i+')"><span>'+Hm+'</span></a></td></tr>'
}
}else{slist+='<tr><td><a href="./"><span>'+p_no_match+'</span></a></td><td class="t">&nbsp;</td></tr>'
ncn='error '}
gob(sdn).innerHTML=slist+'</table>'
gob('q'+n).className=gob('q'+n).className.replace('error','').replace('txtin ','txtin '+ncn)
current_q[sdn]=thisq
if(0<su.length&&sdn!='susdiv'&&T_I.susdivname!=sdn){
complocurls[n]=[su[0][3],su[0][2]]
gob('q'+n).value=su[0][3].replace('&nbsp;',' ')
gob(sdn).innerHTML=''
current_q[sdn]=''
if(n==0)update_starttimelabel(su[0][0])
return ''
}
}
this.cycle_sus=function(sdn,n){
if((current_q[sdn]!='')&&(typeof sus[current_q[sdn]]!=u)){
var new_chosen=chosen_sus[sdn]+n
if(new_chosen<0)new_chosen=sus[current_q[sdn]].length-1
if(new_chosen>=sus[current_q[sdn]].length)new_chosen=0
this.choose_sus(sdn,new_chosen)
}
}
this.choose_sus=function(sdn,i){
if(typeof sus[current_q[sdn]]!=u){
if(i!==chosen_sus[sdn]&&chosen_sus[sdn]<sus[current_q[sdn]].length)gob(sdn+'s'+chosen_sus[sdn]).className=''
var o=gob(sdn+'s'+i)
if(o!=null){o.className='chosen';chosen_sus[sdn]=i}
}
}
function jsesc(s){return s.replace("'","\\\'").replace('"','\\\'')}
sus=[]
chosen_sus=[]
prevsustime=[]
current_q=[]
prevq=[]
this.susgo=function(nm,p,u,d){
if(T_I.susdivname=='susdiv')window.location='/'+susdest+u
else{
losefocus(T_I.susdivname)
var n=T_I.susdivname.replace('susdiv','')
gob('q'+n).value=d.replace('&nbsp;',' ')
complocurls[n]=[d,u]
T_I.susdivo.innerHTML=''
if(n==0)update_starttimelabel(nm)
n++
if(gob('q'+n)!=null)setfocus('q'+n)
}
}
this.take_chosen=function(sd,key){
if(sd!='susdiv'){var sn=chosen_sus[sd],q=current_q[sd]
if(key==13&&q==''){submission=true;submit_compare();return false}
if(q!=gob('q'+sd.replace('susdiv','')).value)return false
if(typeof sus[q]!=u){
if(sus[q].length==0)return false
if(sus[q].length==sn)sn=0
T_I.susgo(sus[q][sn][0],sus[q][sn][1],sus[q][sn][2],sus[q][sn][3])
}
if(key==13){
submission=false
var n=sd.replace('susdiv','')
n++
if(gob('q'+n)!=null){gob('q'+n).focus()
}
}
else submission=true
}
return false
}
this.submit=function(q){
var u='',sdn=T_I.susdivname,i=chosen_sus[sdn]
if(q!=current_q[sdn])return true
if(current_q[sdn]!=''){
if(i>=sus[current_q[sdn]].length)i=0
if(sus[current_q[sdn]].length!==0)u=sus[current_q[sdn]][i][2]
else if(q.length!=0)return true
}
T_I.susgo('','',u,'')
return false
}
this.reconf=function(){this.recook();gob('confl').href=gob('confl').href.replace(/c=.+&/,'c='+confs+'&');prevDate='';this.tick('',0)}
}
var ampmFS=20
fontfactor={
a:[5.18,1.1,8,1,2,20],
a2:[4.52,1.1,8,1,2,20],
t:[4.18,1.2,8,1.1,2,22]
}
var wob=['canvas','timediv_ce','timediv','timeis_wrapper','daydiv','dd','pL','lC','locmenu','favs','syncmsgdiv','syncmsgdetaildiv','top','widget_canvas']
function setsizes(r){
if(r){rez=0;wfac=1}
var ww=1,wh=1,bgw,bgw,bgtop,bgleft
if(document.body.offsetWidth)ww=document.body.offsetWidth
else if(window.innerWidth)ww=window.innerWidth
wh=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight
pocketopera=0
if(ww==960&&wh==1400){wh=480;ww=800;pocketopera=1}
if(bgim!==''){
if(ww/wh>cbgimg.width/cbgimg.height){
bgw=ww
bgh=cbgimg.height*ww/cbgimg.width
bgtop=wh-cbgimg.height*ww/cbgimg.width
bgleft=0
}
else{bgw=cbgimg.width*wh/cbgimg.height
bgh=wh
bgtop=0
bgleft=ww-cbgimg.width*wh/cbgimg.height
}
var bgios=gob('bgimg').style
bgios.width=bgw.toFixed(0)+'px'
bgios.height=bgh.toFixed(0)+'px'
bgios.top=bgtop.toFixed(0)+'px'
bgios.left=bgleft.toFixed(0)+'px'
}
f=conf['f']
twf=(10+conf['t'].length)/15
if(0==twf)twf=1
timeFS=((ww/fontfactor[f][0])*wfac).toFixed(0)
ampmFS=((timeFS/3)*wfac).toFixed(0)
if(ampmFS<fontfactor[f][5])ampmFS=fontfactor[f][5]
dateFS=(timeFS/fontfactor[f][2]*twf).toFixed(0)
if(dateFS<fontfactor[f][5])dateFS=fontfactor[f][5]
if(conf['t'].length>5)timeFS=(timeFS*.85).toFixed(0)
timeLH=(timeFS/fontfactor[f][1]).toFixed(0)
dateLH=(dateFS/fontfactor[f][3]*1.2).toFixed(0)
var wdo=gob('widget_canvas'),fs=(timeFS/2.5).toFixed(0),lh=(timeLH/2.5).toFixed(0)
if(wdo!=null){
if(fs<36){fs=36;lh=48}
wdo.style.fontSize=fs+'px'
wdo.style.lineHeight=lh+'px'
}
canvaswidth=(ww-timeFS/fontfactor[f][4]).toFixed(0)
canvPT=((wh-timeFS-dateFS-fluffheight-70)/2).toFixed(0)
if(noctp==1||canvPT<0||pocketopera)canvPT=20
if((window.location.pathname=='/'&&ww<706)||(ww<600&&(window.location.pathname.substr(0,5)!='/just')))canvPT=0
gob('canvas').style.paddingTop=canvPT+'px'
for(i in wob){var o=gob(wob[i]);if(o!=null&&typeof o=='object')o.style.width=canvaswidth+'px'}
set_mw()
var mapo=gob('map_canvas')
if(mapo!=null){
mapo.style.width=ww+'px'
mapo.style.height=wh+'px'
if(typeof map=='object')google.maps.event.trigger(map,'resize')
}
timedivobj=gob('timediv')
timedivobj.style.fontSize=timeFS+'px'
ampmdivobj=gob('ampm')
if(typeof ampmdivobject=='object')ampmdivobj.style.fontSize=ampmFS+'px'
timedivobj.style.lineHeight=timeLH+'px'
ddobj=gob('dd')
ddobj.style.fontSize=dateFS+'px'
ddobj.style.lineHeight=dateLH+'px'
pLobj=gob('pL')
pLobj.style.fontSize=dateFS+'px'
pLobj.style.lineHeight=dateLH+'px'
if(typeof navbgdiv=='object'){window.scrollTo(0,navbgdiv.offsetHeight);navbgdiv=''}
}
function set_mw(){
var ww=1,bcl=bod.className.replace(' sscr',''),mw=canvaswidth-412,mo=gob('menu')
if(document.body.offsetWidth)ww=document.body.offsetWidth
else if(window.innerWidth)ww=window.innerWidth
if(ww<729){bcl+=' sscr';mw+=224}
else if(gob('top').className=='more')mw+=224
if(mw<230)mw=230
if(mo!=null)mo.style.width=mw+'px'
bod.className=bcl
}
function beginning_of_time(){
T_I=new TimeIs('timediv','dd','daydiv','pL','lC')
T_I.initClock()
if(window.XMLHttpRequest||window.ActiveXObject)gob('syncmsgdiv').innerHTML='<h2>'+p_syncing+'...</h2>'
}
function tl_a(){
if(auSt==0){
try{if((!!document.createElement('audio').canPlayType)&&(-1===navigator.userAgent.indexOf('MSIE'))){
if(t_au1m===0){
t_au1s=new Audio()
var audiotype='.mp3'
if(t_au1s.canPlayType('audio/ogg')!=='')audiotype='.ogg'
var lp=1;if(-1===navigator.userAgent.indexOf('WebKit')){audiotype='_'+audiotype;lp=0}
}
for(var i in af)eval('if(t_au1m===0){t_au'+af[i]+'=new Audio();t_au'+af[i]+'.src="/audio/'+af[i]+'"+audiotype;if(lp)t_au'+af[i]+'.loop=true}t_au'+af[i]+'.volume=0;t_au'+af[i]+'.play()')
auSt=1
}else alert(p_no_au)
}catch(err){alert(p_no_au)}
}else {for(var i in af){eval('t_au'+af[i]+'.pause()')};auSt=0}
var lp='p0 ';if(auSt)lp='';
gob('aub').className=lp+'status'+auSt
}
var af=['1s','59s','1m'],t_au1s=0,t_au59s=0,t_au1m=0,auSt=0,wfac=1,rez=0,nosync=0,lastsync=0,ttm='',confs=''

