// JavaScript Document
  function ZobrazDetaily(str)
  {
   var xHttp = false;
  
   if (window.XMLHttpRequest) 
      {xHttp = new XMLHttpRequest();}
   else if (window.ActiveXObject) 
      {xHttp = new ActiveXObject("Microsoft.XMLHTTP");}

     var url="funkce/DejGaranta.php?id="+str+"-"+new Date().getTime();

     xHttp.onreadystatechange = function (){
        ZmenaStavu(xHttp); 
     }
     
     xHttp.open("GET",url,true);
     xHttp.send(null);
     document.getElementById("napovedaDiv").style.visibility="visible"; 
//x = (window.Event) ? e.pageX : event.clientX; 
//y = (window.Event) ? e.pageY : event.clientY; 
     
     
//     document.getElementById("napovedaDiv").style.left=((window.Event) ? event.clientX : e.pageX)+0; 
//     document.getElementById("napovedaDiv").style.top=((window.Event) ? event.clientY : e.pageY)+10; 
     document.getElementById("napovedaDiv").style.left=document.body.scrollLeft+event.clientX+0; 
     document.getElementById("napovedaDiv").style.top=document.body.scrollTop+event.clientY+10;
//     alert(event.clientX+' / '+event.clientY); 
     alert(e.pageX+' / '+e.pageY); 
  }
  
/*
//div ID
var myDivId = 'ZHintDiv';
//posun v ose X
var movingX = 20; //px
//posun v ose Y
var movingY = 10; //px


//vychozi pozice
var positionX = 0;
var positionY = 0;

//vytvorime novy element typu DIV
var divElement;
divElement = document.createElement('div');
//nastavime ID 
divElement.setAttribute('id', myDivId);
//visibility:hidden
divElement.style.visibility = 'hidden';
//positin: absolute
divElement.style.position = 'absolute';
//vychozi pozice
divElement.style.left = '0px';
divElement.style.top = '0px';

//zjisteni souradnic mysi
function getMouseXY(e) {
    var browserIE = document.all?true:false
    if (!browserIE) document.captureEvents(Event.MOUSEMOVE)
    //zjisteni souradnic
    positionX = browserIE?event.clientX + document.body.scrollLeft:e.pageX;
    positionY = browserIE?event.clientY + document.body.scrollTop:e.pageY;
    //posun elementu 
    setPosition();
    return true;
}

//nastaveni pozice okna
function setPosition(){
    var windowWidth = 0;
    //zjisteni sirky okna
    if( typeof( window.innerWidth ) == 'number' ) {
        windowWidth = window.innerWidth;
    } else if( document.documentElement && document.documentElement.clientWidth ) {
        windowWidth = document.documentElement.clientWidth;
    } else if( document.body && document.body.clientWidth  ) {
        windowWidth = document.body.clientWidth;
    }
    //pokud je pozice za okrajem okna, nastavi se pred kurzor
    if( ( positionX +  parseInt(divElement.style.width ) + movingX + 50 ) > windowWidth ){
        positionX -= ( movingX + parseInt(divElement.style.width ) );
    }
    divElement.style.left =  ( movingX + positionX ) + 'px';
    divElement.style.top = ( movingY + positionY ) + 'px';
}


//funkce pro nastavei opacity
function setOpacity( element, alpha ){
    var el = document.getElementById(element);
    
    if( el.style.opacity != undefined ){
        el.style.opacity = alpha;
    }
    else if( el.style.MozOpacity != undefined ){ 
        el.style.MozOpacity = alpha;
    }
    else if( el.style.filter != undefined ){
        el.style.filter = "alpha(opacity=0)";
        el.filters.alpha.opacity = ( alpha * 100 );
    }
    
    return true;
}

function pulseOn(){
    for( i = 0; i <= 9; i++ ){
        setTimeout("setOpacity('" + myDivId + "'," + i/10 + ");", 25*i);
    }   
}

//TOOLTIP FUNCTION
function tooltip( str, el, width ){
    //pokud neni vytvoreny div pridany v HTML
    if( !document.getElementById(myDivId) )
        //pridame div do stranky
        document.body.appendChild(divElement);
    //nastavime pozadovanou sirku pro div
    divElement.style.width = width + 'px';
    //nastavime visibility:visible
    setOpacity(myDivId, 0 );
    divElement.style.visibility = 'visible';
    pulseOn();
    //vlozime do divu nas text
    divElement.innerHTML = str;
    //pri posunu po elementu menime pozici divu
    el.onmousemove=getMouseXY;
    //pri opusteni elementu okno schovame
    el.onmouseout = hidetip;
}

//schovani okna
function hidetip(){
    divElement.style.visibility = 'hidden';
}
*/  
  
  function SkryjDetaily()
  {
    document.getElementById("napovedaDiv").innerHTML='';
    document.getElementById("napovedaDiv").style.visibility="hidden"; 
  }

  function ZmenaStavu(aHttp) {
    var xxx = '';
      if(aHttp.readyState==4) {
        if(aHttp.status==200)
          {document.getElementById("napovedaDiv").innerHTML=aHttp.responseText;}
      } else 
         {document.getElementById("napovedaDiv").innerHTML='&nbsp;načítám&nbsp;';}
    
  }
  function ZobrazPopisObrazku(str)
  {
   var xHttp = false;
  
   if (window.XMLHttpRequest) 
      {xHttp = new XMLHttpRequest();}
   else if (window.ActiveXObject) 
      {xHttp = new ActiveXObject("Microsoft.XMLHTTP");}

     var url="funkce/DejPopObrazku.php?id="+str+"-"+new Date().getTime();

     xHttp.onreadystatechange = function (){
        ZmenaStavu(xHttp); 
     }
     
     xHttp.open("GET",url,true);
     xHttp.send(null);
     document.getElementById("napovedaDiv").style.visibility="visible"; 
     document.getElementById("napovedaDiv").style.left=document.body.scrollLeft+event.clientX+0; 
     document.getElementById("napovedaDiv").style.top=document.body.scrollTop+event.clientY+10; 
  }
  
  function OpravObrazek(str,formular,text)
  {
   var xHttp = false;
  
   if (window.XMLHttpRequest) 
      {xHttp = new XMLHttpRequest();}
   else if (window.ActiveXObject) 
      {xHttp = new ActiveXObject("Microsoft.XMLHTTP");}

     var url="ulozudaje.php";
    
     xHttp.onreadystatechange = function (){
        ZmenaStavu(xHttp); 
     }
     
     xHttp.open("POST",url,true);
     xHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
     xHttp.send("formular="+formular,"f_galo_id="+str,"f_galo_popis="+text);
     document.getElementById("napovedaDiv").style.visibility="visible"; 
     document.getElementById("napovedaDiv").style.left=document.body.scrollLeft+event.clientX+0; 
     document.getElementById("napovedaDiv").style.top=document.body.scrollTop+event.clientY+10; 
  }
//******************************************************************************
//****************** Kontrola mailu ********************************************
//******************************************************************************
 function KontrolaMailu(str) { 
   var xHttp = false;
  
   if (window.XMLHttpRequest) 
      {xHttp = new XMLHttpRequest();}
   else if (window.ActiveXObject) 
      {xHttp = new ActiveXObject("Microsoft.XMLHTTP");}

     var url="funkce/KontrolaMailu.php?mail="+str+"-"+new Date().getTime();

     xHttp.onreadystatechange = function (){
        ZmenaStavuMail(xHttp); 
     }
     
     xHttp.open("GET",url,true);
     xHttp.send(null);
     document.getElementById("oznam").style.visibility="visible"; 
  }
  function SkryjDetailyMail()
  {
    document.getElementById("oznam").innerHTML='';
    document.getElementById("oznam").style.visibility="hidden"; 
  }

  function ZmenaStavuMail(aHttp) {
    var xxx = '';
      if(aHttp.readyState==4) {
        if(aHttp.status==200) {
          if(aHttp.responseText!="OK") {
            document.getElementById("oznam").style.display="block"; 
            document.getElementById("oznam").innerHTML=aHttp.responseText;
            document.getElementById("f_reg_email").style.backgroundColor = "#FF7575";
            document.getElementById("f_reg_email").focus();
          } else {
            document.getElementById("oznam").innerHTML='';
            document.getElementById("oznam").style.display="none"; 
            document.getElementById("f_reg_email").style.backgroundColor = "white";
            document.getElementById("f_reg_heslo").focus();
          }
          document.getElementById("f_reg_email").style.border = "1px solid #7F9DB9";
          document.getElementById("f_reg_email").style.fontSize = "12px";
        }  
      } else 
         {document.getElementById("oznam").innerHTML='&nbsp;načítám&nbsp;';}
    
  }
//******************************************************************************
//****************** Kontrola roku (poplatky) **********************************
//******************************************************************************
 function KontrolaRoku(str) { 
   var xHttp = false;
  
   if (window.XMLHttpRequest) 
      {xHttp = new XMLHttpRequest();}
   else if (window.ActiveXObject) 
      {xHttp = new ActiveXObject("Microsoft.XMLHTTP");}

     var url="funkce/KontrolaRoku.php?rok="+str+"-"+new Date().getTime();

     xHttp.onreadystatechange = function (){
        ZmenaStavuRokKont(xHttp); 
     }
     
     xHttp.open("GET",url,true);
     xHttp.send(null);
     document.getElementById("oznam").style.visibility="visible"; 
  }
  function SkryjDetailyRok()
  {
    document.getElementById("oznam").innerHTML='';
    document.getElementById("oznam").style.visibility="hidden"; 
  }

  function ZmenaStavuRokKont(aHttp) {
    var xxx = '';
      if(aHttp.readyState==4) {
        if(aHttp.status==200) {
          if(aHttp.responseText!="OK") {
            document.getElementById("oznam").style.display="block"; 
            document.getElementById("oznam").innerHTML=aHttp.responseText;
            document.getElementById("f_cpo_rokplatby").style.backgroundColor = "#FF7575";
            document.getElementById("f_cpo_rokplatby").focus();
          } else {
            document.getElementById("oznam").innerHTML='';
            document.getElementById("oznam").style.display="none"; 
            document.getElementById("f_cpo_rokplatby").style.backgroundColor = "white";
            document.getElementById("selDay").focus();
          }
          document.getElementById("f_cpo_rokplatby").style.border = "1px solid #7F9DB9";
          document.getElementById("f_cpo_rokplatby").style.fontSize = "12px";
        }  
      } else 
         {document.getElementById("oznam").innerHTML='&nbsp;načítám&nbsp;';}
    
  }

  function OpravaRoku(str)
  {
   var xHttp = false;
  
   if (window.XMLHttpRequest) 
      {xHttp = new XMLHttpRequest();}
   else if (window.ActiveXObject) 
      {xHttp = new ActiveXObject("Microsoft.XMLHTTP");}

     var url="funkce/OpravRokPopl.php?id="+str+"-"+new Date().getTime();

     xHttp.onreadystatechange = function (){
        ZmenaStavuRok(xHttp,'DivOprava'); 
     }
     
     xHttp.open("GET",url,true);
     xHttp.send(null);
     document.getElementById("DivOprava").style.visibility="visible"; 
     document.getElementById("DivOprava").style.left=document.body.scrollLeft+event.clientX+0; 
     document.getElementById("DivOprava").style.top=document.body.scrollTop+event.clientY+10; 
  }

  function ZmenaStavuRok(aHttp,aDiv) {
    var xxx = '';
      if(aHttp.readyState==4) {
        if(aHttp.status==200)
          {document.getElementById(aDiv).innerHTML=aHttp.responseText;}
      } else 
         {document.getElementById(aDiv).innerHTML='&nbsp;načítám&nbsp;';}
    
  }
  function SkryjDetailyRok(aDiv)
  {
    document.getElementById(aDiv).innerHTML='';
    document.getElementById(aDiv).style.visibility="hidden"; 
  }

//******************************************************************************
  function OpravRokKarty(str)
  {
   var xHttp = false;
  
   if (window.XMLHttpRequest) 
      {xHttp = new XMLHttpRequest();}
   else if (window.ActiveXObject) 
      {xHttp = new ActiveXObject("Microsoft.XMLHTTP");}

     var url="funkce/OpravRokKarty.php?id="+str+"-"+new Date().getTime();

     xHttp.onreadystatechange = function (){
        ZmenaStavuRok(xHttp,'DivOprava'); 
     }
     
     xHttp.open("GET",url,true);
     xHttp.send(null);
     document.getElementById("DivOprava").style.visibility="visible"; 
     document.getElementById("DivOprava").style.left=document.body.scrollLeft+event.clientX+0; 
     document.getElementById("DivOprava").style.top=document.body.scrollTop+event.clientY+10; 
  }

//******************************************************************************


  function OpravaWork(str)
  {
   var xHttp = false;
  
   if (window.XMLHttpRequest) 
      {xHttp = new XMLHttpRequest();}
   else if (window.ActiveXObject) 
      {xHttp = new ActiveXObject("Microsoft.XMLHTTP");}

     var url="funkce/OpravWorkshop.php?id="+str+"-"+new Date().getTime();

     xHttp.onreadystatechange = function (){
        ZmenaStavuRok(xHttp,'DivOprava'); 
     }
     
     xHttp.open("GET",url,true);
     xHttp.send(null);
     document.getElementById("DivOprava").style.visibility="visible"; 
     document.getElementById("DivOprava").style.left=document.body.scrollLeft+event.clientX+0; 
     document.getElementById("DivOprava").style.top=document.body.scrollTop+event.clientY+10; 
  }

//******************************************************************************
//****************** Zobrazení informací o registrovaném uživateli *************
//******************************************************************************
  function ZobrazDetailyReg(str)
  {
   var xHttp = false;
  
   if (window.XMLHttpRequest) 
      {xHttp = new XMLHttpRequest();}
   else if (window.ActiveXObject) 
      {xHttp = new ActiveXObject("Microsoft.XMLHTTP");}

     var url="funkce/DejRegistr.php?id="+str+"-"+new Date().getTime();
     xHttp.onreadystatechange = function (){
        ZmenaStavuReg(xHttp); 
     }
     
     xHttp.open("GET",url,true);
     xHttp.send(null);
     document.getElementById("registrovany").style.visibility="visible"; 
     document.getElementById("registrovany").style.left=document.body.scrollLeft+event.clientX+0; 
     document.getElementById("registrovany").style.top=document.body.scrollTop+event.clientY+10; 
  }
  function SkryjDetailyReg()
  {
    document.getElementById("registrovany").innerHTML='';
    document.getElementById("registrovany").style.visibility="hidden"; 
  }

  function ZmenaStavuReg(aHttp) {
    var xxx = '';
      if(aHttp.readyState==4) {
        if(aHttp.status==200)
          {document.getElementById("registrovany").innerHTML=aHttp.responseText;}
      } else 
         {document.getElementById("registrovany").innerHTML='&nbsp;načítám&nbsp;';}
    
  }


//******************************************************************************
//****************** Zobrazení videa *******************************************
//******************************************************************************
 function ZobrazeniVidea(str) { 
   var xHttp = false;
  
   if (window.XMLHttpRequest) 
      {xHttp = new XMLHttpRequest();}
   else if (window.ActiveXObject) 
      {xHttp = new ActiveXObject("Microsoft.XMLHTTP");}

     var url="ZobrazVideo.php?vid="+str+"-"+new Date().getTime();

     xHttp.onreadystatechange = function (){
        ZmenaStavuVideo(xHttp); 
     }
     
     xHttp.open("GET",url,true);
     xHttp.send(null);
     document.getElementById("obraz").style.visibility="visible"; 
  }
  function SkryjDetailyVideo()
  {
    document.getElementById("obraz").innerHTML='';
    document.getElementById("obraz").style.visibility="hidden"; 
  }

  function ZmenaStavuVideo(aHttp) {
    var xxx = '';
      if(aHttp.readyState==4) {
        if(aHttp.status==200) {
          if(aHttp.responseText!="OK") {
            document.getElementById("obraz").style.display="block"; 
            document.getElementById("obraz").innerHTML=aHttp.responseText;
          } else {
            document.getElementById("obraz").innerHTML='';
            document.getElementById("obraz").style.display="none"; 
          }
        }  
      } else 
         {document.getElementById("obraz").innerHTML='&nbsp;načítám&nbsp;';}
    
  }


  function OdeslatMail(str)
  {
   var xHttp = false;
  
   if (window.XMLHttpRequest) 
      {xHttp = new XMLHttpRequest();}
   else if (window.ActiveXObject) 
      {xHttp = new ActiveXObject("Microsoft.XMLHTTP");}

     var url="funkce/OdeslatMail.php?id="+str+"-"+new Date().getTime();

     xHttp.onreadystatechange = function (){
        ZmenaStavu(xHttp); 
     }
     
     xHttp.open("GET",url,true);
     xHttp.send(null);
     document.getElementById("napovedaDiv").style.visibility="visible"; 
  }


/*  function DejMail(dataSource) 
  { 
alert('tady');   
     var xHttp;
alert('tady1');   
     xHttp = VytvorXMLHttp();
alert(dataSource);   

     xHttp.onreadystatechange = function()
     { 
       var xxx = '';
       if (xHttp.readyState == 4 && xHttp.status == 200) 
       { 
        if(aHttp.status==200) {
          if(xHttp.responseText == "obsazeny")
          {
             var oznam = document.getElementById("oznam");
             oznam.innerHTML = "<div>E-mail je již použit, není možné jej použít při další registraci.</div>";
          }
        }
       }
     } 
     var url="funkce/KontrolaMailu.php?mail=f-"+new Date().getTime();
     xHttp.open("GET", url,true); 
     xHttp.send(null); 
   }

   function KontrolaMailu(udalost) 
   {
        udalost = (udalost) ? udalost: window.event;
        txt = (udalost.target) ? udalost.target : udalost.srcElement;

        if (udalost.type == "keyup") 
        {
          var oznam = document.getElementById("oznam");
          oznam.innerHTML = "<div></div>";
          if (txt.value) {
            DejMail(txt.value);} 
        }
    }

  function VytvorXMLHttp() 
  {
    var xmlHttp= false;
  
    if (window.XMLHttpRequest) 
      {xHttp = new XMLHttpRequest();}
    else if (window.ActiveXObject) 
      {xHttp = new ActiveXObject("Microsoft.XMLHTTP");}
    return xmlHttp;
  }*/
//******************************************************************************
