var req,t1,t2,r1=199,g1=239,b1=254,r2=74,g2=114,b2=129,d1=1,d2=-1,h="0123456789abcdef";
var month=["январь","февраль","март","апрель","май","июнь","июль","август","сентябрь","октябрь","ноябрь","декабрь"];
var translator=["","via Google","via PROMT","via YAHOO"];
function hex(c) {return h.charAt(c>>4)+h.charAt(c&15);}
function ajax(m,y) {var obj; clearInterval(t1); clearInterval(t2); if (self.XMLHttpRequest) {try {obj = new XMLHttpRequest();} catch (e) {}} else if (self.ActiveXObject) try {obj = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) {try {obj = new ActiveXObject("Microsoft.XMLHTTP");} catch (e) {};} obj.open("get","/ajax.php?m="+m+"&y="+y,true); obj.onreadystatechange = function() {if (obj.readyState==4) {document.getElementById("calendar").innerHTML=obj.responseText; document.getElementById("dm").innerHTML=month[m-1]; document.getElementById("dy").innerHTML=2004+parseInt(y); if (document.getElementById("d17")!=null) t1=setInterval("day17()",15); if (document.getElementById("d26")!=null) t2=setInterval("day26()",15);}}; obj.send(null);}
function translate(n,p) {if (n=="0") document.getElementById("langs").innerHTML=document.getElementById("via").innerHTML=""; else {req.open("get","/ajax"+n+".php?link="+escape(p),true); req.onreadystatechange = function() {if (req.readyState==4) document.getElementById("langs").innerHTML=req.responseText; document.getElementById("via").innerHTML=translator[n];}; req.send(null);}}
function users() {req.open("get","/online.php",true); req.onreadystatechange = function() {if (req.readyState==4) document.getElementById("online").innerHTML=req.responseText; else document.getElementById("online").innerHTML="потеряна связь с вашим компьютером";}; req.send(null);}
function day17() {r1+=d1; g1+=d1; b1+=d1; document.getElementById("d17").style.color="#"+hex(r1)+hex(g1)+hex(b1); if (b1==128||b1==255) d1=-d1;}
function day26() {r2+=d2; g2+=d2; b2+=d2; document.getElementById("d26").style.color="#"+hex(r2)+hex(g2)+hex(b2); if (b2==128||b2==255) d2=-d2;}
function ends(n,s1,s2,s3) {n%=100; switch (n>5&&n<21?6:n%10) {case 4:case 3:case 2:return s2; case 1:return s1;default:return s3;}}
function tmleft() {var hrs=Math.floor(hourX/3600),mns=Math.floor(hourX/60-60*hrs); with (document) {getElementById("t0").innerHTML=hrs; getElementById("g0").innerHTML=ends(hrs,'','а','ов'); getElementById("t1").innerHTML=mns; getElementById("g1").innerHTML=ends(mns,'а','ы',''); getElementById("t2").innerHTML=hourX%60;} if (hourX>0) {hourX-=5; setTimeout("tmleft()",4995);}}
function init() {if (self.XMLHttpRequest) {try {req=new XMLHttpRequest();} catch (e) {}} else if (self.ActiveXObject) try {req=new ActiveXObject("Msxml2.XMLHTTP");} catch (e) {try {req=new ActiveXObject("Microsoft.XMLHTTP");} catch (e) {}}; setInterval("users()",600000); if (document.getElementById("d17")!=null) t1=setInterval("day17()",15); if (document.getElementById("d26")!=null) t2=setInterval("day26()",16); if (hourX>5) tmleft();}
