var delej;
var delej2;
var makej;
var makej2;

var totalframes;
var frame;
var step;
var alphac;

var totalframes2;
var frame2;
var step2;
var alphac2;
var ktery;

var pocetbaneru;

function zobraz($a,$b)
{    var a
     //var url = document.getElementById("vyber").value;
      var url=$a;
      var element=$b;
     if (url != 0)
     {
        if (window.ActiveXObject)
        {
          httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
        }
        else
        {
          httpRequest = new XMLHttpRequest();
        }
        httpRequest.open("GET", url, true);
        httpRequest.onreadystatechange= function () {processRequest(element); } ;
        httpRequest.send(null);
      }
      else
      {

        document.getElementById(element).innerHTML = "";
        
      }
}




function processRequest($b)
{var element=$b;
  if (httpRequest.readyState == 4)
  {
    if(httpRequest.status == 200)
    {
     var mistoZobrazeni = document.getElementById(element);
       
       //alpha_show(element,100,100,1,true)
       //alpha_show2(element,100,100,1,true)
       
       
       delej=false;
       delej2=false;
        clearTimeout(makej);
        clearTimeout(makej2);
        
       document.getElementById(element).innerHTML = '';
       
      mistoZobrazeni.innerHTML = httpRequest.responseText;
      mistoZobrazeni.style.visibility='visible';
        delej=true;
        alphap(element,delej)
    }
    else
    {
        alert("Chyba pri nacitani stanky"+ httpRequest.status +":"+ httpRequest.statusText);
    }
  }
}



function fsh($b) {
var element=$b;
delej=false;
delej2=true;
clearTimeout(makej);
alpham(element,delej2)
}




function pryc($b) {
var element=$b;
var thfsc = document.getElementById(element);
var object = document.getElementById(element).style;
//thfsc.innerHTML = "";
//thfsc.style.visibility='hidden';
document.getElementById(element).style.display='none';
object.opacity = 0;
object.MozOpacity = 0;
object.KhtmlOpacity = 0;
object.filter = "alpha(opacity=" + 0 + ")";
}















function alphap(element,delej){
    duration = 2000;
    from = 10;
    to = 100;
    totalframes = to-from;
    step = (duration/totalframes);
    frame = 0;
    alphac=from;
    document.getElementById(element).style.display='inline';
if(delej==true){


alphaplus(element)
}

}



function alphaplus(element){
var direction=2;



      frame++;
      alphac=alphac+(1*direction);
            
      
      var object = document.getElementById(element).style;
      object.opacity = (alphac / 100);
      object.MozOpacity = (alphac / 100);
      object.KhtmlOpacity = (alphac / 100);
      object.filter = "alpha(opacity=" + (alphac-10) + ")";
      
      if(alphac <= to) {makej=setTimeout("alphaplus('"+element+"')", step);
      
      }else
      {
      //alert (alphac);
      //alert (to);
      delej=false;
      fsh(ktery);
      
      return clearTimeout(makej);
      
      }
}















function alpham(element,delej2){
    duration2 = 2000;
    from2 = alphac;
    
    to2 = 1;
    totalframes2 = from2-to2;
    step2 = (duration2/totalframes2);
    frame2 = 0;
    alphac2=from2;
    
if(delej2==true){


alphaminus(element)
}

}



function alphaminus(element){
var direction=-5;    



      frame2++;
      alphac2=alphac2+(1*direction);
            
      
      var object = document.getElementById(element).style;
      object.opacity = (alphac2 / 100);
      object.MozOpacity = (alphac2 / 100);
      object.KhtmlOpacity = (alphac2 / 100);
      object.filter = "alpha(opacity=" + alphac2 + ")";
      
      if(alphac2 >= to2){ makej2=setTimeout("alphaminus('"+element+"')", step2);
      
      }else{
     
      
      delej2=false;
      pryc(element)
      prvni=setTimeout("zmena()",4600);
      return clearTimeout(makej2);
      
      }
}








var co
co="p2"


   var xi
   var oc
    xi=2;

function zmena(){
delej=true;
if(xi!=1){
ktery="p"+(xi-1);
alphap(co,delej)
if((xi+1)==pocetbaneru+1){
    co="p1";
    xi=1;
    }else{
    co="p"+(xi+1);
    xi++;
    }
}else{

ktery="p"+pocetbaneru;
alphap(co,delej)
co="p2";
xi++;
}

clearTimeout(prvni);
/*
if(co=="p2"){
delej=true;
ktery="p1"
alphap(co,delej)
co="p3"

}else if(co=="p3"){
delej=true;
ktery="p2"
alphap(co,delej)

co="p4"
}

else  if(co=="p4"){
delej=true;
ktery="p3"
alphap(co,delej)
co="p1"
}

else{
delej=true;
ktery="p4"
alphap(co,delej)
co="p2"
}
*/

return co
}












 
 
