var ie = navigator.appName.indexOf("Microsoft") != -1;

cArr = new Array();
for(n=0; n<10; n++)
 {
 cArr[n]=new Image();
 t=n%10;
 cArr[n].src="http://d"+t+".today.od.ua/images/time/"+String(n)+".gif";
 }

function showTime()
{
// if (nocal) return;
 var CurTime=new Date();
 var h=CurTime.getHours();
 var m=CurTime.getMinutes();

 document.images.timea.src=cArr[Math.floor(h/10)].src;
 document.images.timeb.src=cArr[h%10].src;

 document.images.timec.src=cArr[Math.floor(m/10)].src;
 document.images.timed.src=cArr[m%10].src;

 timerId=setTimeout("showTime()",1000);
}

function recWindow(id,rate) {
 var xMax = screen.width, yMax = screen.height;
 var xOffset = (xMax - 200)/2, yOffset = (yMax - 100)/2;
 window.open('/vote.php?action=vote&id='+id+'&vote='+rate,'','width=200,height=100,screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+',copyhistory=no,directories=no,menubar=no,location=no,scrollbars=no,resizable=no,status=no');
}

function rateWindow(params) {
 var xMax = screen.width, yMax = screen.height;
 var xOffset = (xMax - 200)/2, yOffset = (yMax - 100)/2;
 window.open('/vote_rating.php?'+params,'','width=200,height=100,screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+',copyhistory=no,directories=no,menubar=no,location=no,scrollbars=no,resizable=no,status=no');
}


var curdiv="";
var curx=0;
var dx=0;


function slomogo()
{
 if (curdiv=="") return;
 var x = document.getElementById("d"+curdiv);

 curx=curx+dx;
 if (curx<-160 && dx<16) dx=dx*1.2;
 if (curx>-33 && dx>3.3) dx=dx/2;
 if (curx>0) curx=0;
 x.style.top=curx+"px";

 if (curx<0)
  setTimeout( "slomogo()", 10 );
}



function slomo(divid,src,cx,ddx)
{
 curdiv=divid;
 var x = document.getElementById(curdiv);
 x.src=src;
 curx=cx;
 dx=ddx;
 slomogo();
}


var globalhref="";

function move(curr,dxx)
{
 var site = document.getElementById("site");
 site.style.left=-curr-dxx;
 if (curr<1500)
  {
   if (dxx>1250)
    setTimeout("move("+(curr+dxx)+","+(dxx)+");",10);
   else
    setTimeout("move("+(curr+dxx)+","+(dxx*3)+");",10);
  }
 else
  {
   window.location=globalhref;
  }
}

function movesite(href)
{
 globalhref=href;
 move(0,1);
 return false;
}

function autoexec()
{
 preloadpics();
 return;
 var as = document.getElementsByTagName("a");
 for (var i = 0; i < as.length; i++)
  {
   href = as[i].getAttribute("href");
   as[i].setAttribute("onclick","return movesite('"+href+"');");
   as[i].parentNode.innerHTML = as[i].parentNode.innerHTML;
  }
}


  function showprevdiv()
  {
    var x=document.getElementById("textcontent");
    x.style.display="block";
    var y=document.getElementById("popupdiv");
    y.style.display="none";
    y.innerHTML='';
    var y=document.getElementById("textsize");
    y.style.fontSize='11px';
   }


   function stretchtext()
   {
    var y=document.getElementById("textsize");
    y.style.fontSize='13px';

   
    var x=document.getElementById("textcontent");
    var txt=x.innerHTML;

    var y=document.getElementById("karkas");
    y.style.height=x.offsetHeight+"px";

    var curleft = curtop = 0;
    theObj = x;
    if (theObj.offsetParent)
    {
      curleft = theObj.offsetLeft;
      curtop = theObj.offsetTop;
      while (theObj = theObj.offsetParent)
      {
       curleft += theObj.offsetLeft;
       curtop += theObj.offsetTop;
      }
    }
    x.style.display="none";

    var y=document.getElementById("popupdiv");
    y.style.left=curleft+"px";
    y.style.top=curtop+"px";
    y.style.width=widesize+"px";
    y.innerHTML=txt;
    y.style.display="block";
    movingobject=y.style;
   }
   
   
var wide=0;

function togglewide()
{
 if (wide==0)
  stretchtext(); 
 else
  showprevdiv();
 wide=1-wide;  
}   


function g(id)
{
 return document.getElementById(id);
}

function showhide(id,show)
{
 var t=g(id);
 if (t!=null)
 {
  if (show)
   t.style.display='block';
  else 
   t.style.display='none';
  return true;   
 }  
 return false;
}


var ie6=0;
var nslides=0;
var slidesopen = new Array();

function slideticket(id,xx,dxx)
{
 if (slidesopen[id]==0) return;
 x=xx+dxx;
 slidesopen[id]=x; 
 dx=dxx;
 if (x>200 && dx>1) dx=Math.round(3*dx/2);
 if (x>225+ie6) x=225+ie6;
 g("a"+id).style.left="-"+x+"px";
 if (x<225+ie6)
  setTimeout("slideticket("+id+","+x+","+dx+")",10);

}

function slideticket2(id,xx,dxx)
{
 slidesopen[id]=0;
 x=xx-dxx;
 dx=dxx;
 if (x<50 && dx>1)
  {
   dx=Math.round(3*dx/2);
   showhide("i"+id,0);
   g('aa'+id).style.width="0px"; 
 }
 if (x<0) x=0;
 g("a"+id).style.left="-"+x+"px";
 if (x>0)
  setTimeout("slideticket2("+id+","+x+","+dx+")",10);
 else
  {
   showhide("i"+id,0); 
   g('aa'+id).style.width="0px"; 
   g("a"+id).style.left="0px";   
  } 
}




function startslideticket(id)
{
 if (!showhide("i"+id,1))
  ie6=11;
 if (g("a"+id).style.left=="-"+(225+ie6)+"px")
  slideticket2(id,225+ie6,15);
 else
  {
   for (n=1; n<=nslides; n++)
    if (slidesopen[n])
     slideticket2(n,slidesopen[n],15);
   slidesopen[id]=1;
   slideticket(id,0,15);
  }    
}



function thisMovie(movieName) {
 var isIE = navigator.appName.indexOf("Microsoft") != -1;                                                                    
 return (isIE) ? window[movieName] : document[movieName];                                                                    
}

function playmp3(url)
{
 thisMovie("soundplayer").playSound(url);
}