function test_cookies() {
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
 xmlhttp.open("GET", "<?php echo $SERVER_WROOT; ?>/test_cookies.php",true);
 xmlhttp.onreadystatechange=function() {
  if (xmlhttp.readyState==4) {
    if (xmlhttp.responseText!="true") {
        document.getElementById('div_test_cookies').innerHTML="<?php echo $lang['textNoCookies']; ?>";
    }
  }
 }
 xmlhttp.send(null);

}

//testovani registracniho formulare
function test_regForm()
{
    login = document.getElementById("prihlaseni").value;
    heslo = document.getElementById("heslo").value;
    hesloz = document.getElementById("hesloz").value;
    
    
    
    
    //alert(login+heslo+hesloz);

}



//Funkce pro AJAX
  function createXmlHttpRequest() {                
      if(navigator.appName == "Microsoft Internet Explorer") {
         xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
      }
      else {
         xmlHttp = new XMLHttpRequest();
      }
  } 
  
  
  


//slouzi pro ajax v inc/detail.php
//dle vybrane zastavky zobrazi vyhovujici terminy
function ZobrazVyhovujiciTerminy()
{
    urlZajezd = document.getElementById("url_zajezd").value;
    idZajezd = document.getElementById("id_zajezd").value;

    mesto = document.getElementById("vybrane_mesto").value;
    getMesto = '';
    
    if(mesto != '') { getMesto = '&mesto='+mesto; }
    
    createXmlHttpRequest();
        xmlHttp.abort();
        //xmlHttp.open("GET", "ajax-php/zobrazVyhovujiciTerminy.php?url_zajezd="+urlZajezd+"&id_zajezd="+idZajezd+getZastavka, true);
        xmlHttp.open("GET", "/ajax-php/zobrazVyhovujiciTerminy.php?url_zajezd="+urlZajezd+"&id_zajezd="+idZajezd+getMesto, true);
        //alert("ajax-php/zobrazVyhovujiciTerminy.php?url_zajezd="+urlZajezd+"&id_zajezd="+idZajezd+getZastavka);
        //alert('/ajax-php/zobrazVyhovujiciTerminy.php?url_zajezd='+urlZajezd+'&id_zajezd='+idZajezd+getMesto);
        
        xmlHttp.onreadystatechange = function() {
            if(xmlHttp.readyState == 4) {
              if(xmlHttp.status == 200) {
                document.getElementById('vyhovujici_terminy_zajezdu').innerHTML = xmlHttp.responseText;
              }
            }
          } 
          
          xmlHttp.send(null);
    
}
// test vyplneni registracni formular
// vsechna pole povinna
function test_regForm(frm, menitHeslo) {
       var err=0;
       var hlas="";
   
       if (frm.login.value == "") {
          err = 1;
          hlas += "Vyplňte Vaše přihlašovací jméno\n";
       }

       if (frm.heslo.value == "" && menitHeslo) {
          err = 1;
          hlas += "Vyplňte heslo\n";
       }
       if (frm.heslo.value != frm.hesloz.value) {
          err = 1;
          hlas += "Heslo nesouhlasí s kontrolním heslem\n";
       }
       
       if (frm.jmeno.value == "") {
          err = 1;
          hlas += "Vyplňte Vaše jméno\n";
       }
       if (frm.prijmeni.value == "") {
          err = 1;
          hlas += "Vyplňte Vaše příjmení\n";
       }
       if (frm.ulice.value == "") {
          err = 1;
          hlas += "Vyplňte Vaše ulice\n";
       }
       if (frm.mesto.value == "") {
          err = 1;
          hlas += "Vyplňte Vaše obec\n";
       }
       if (frm.psc.value == "") {
          err = 1;
          hlas += "Vyplňte Vaše psc\n";
       }
       
       if (frm.telefon.value == "") {
//          err = 1;
//          hlas += "Vyplňte telefonní číslo\n";
       } else {
	       if (window.RegExp) {
                 re=new RegExp("^[^@]+@[^.]+\\.[^.]+$");
				 re2=new RegExp("^[^@]+@[^.]+\\.[^.]+\\.[^.]+$");
                 if (!re.test(frm.email.value)) {
					if(!re2.test(frm.email.value)) {
						err=1;
    	                hlas+="Chybný formát e-mailové adresy.\n";
					}
                 }
	       }       
       }
       if (frm.email.value == "") {
          err = 1;
          hlas += "Vyplňte e-mailovou adresu\n";
       } else {
              if (window.RegExp) {
                 re=new RegExp("^[^@]+@[^.]+\\.[^.]+$");
                 if (!re.test(frm.email.value)) {
                    err=1;
                    hlas+="Chybný formát e-mailové adresy\n";
                 }
              }
       }
     
       if (err) {
          alert(hlas);
          return false;
       } else return true;
}

/*skryje nebo zobrazi element*/
function ShowOrHideElement(elementId,hide)
{
    var obj = document.getElementById(elementId);
    if (obj.style.display.toLowerCase() == "block" && hide)
    {
        obj.style.display = "none";
    }
    else
    {
        obj.style.display = "block";
    }
}

var errorCount = 0;

function kontrolaZakazanychSlov(element, slova)
{
	var zakazanaSlova = slova.split(" , ");
	for (var i = 0; i!=zakazanaSlova.length; i++)
	{
		if (document.getElementById(element).value.toLowerCase().search(zakazanaSlova[i])!=-1)
		{
			document.getElementById(element).style.border = "1px solid red";
			document.getElementById("error").style.display = "block";
			document.getElementById("submit").disabled = true;
			errorCount++;
			return;
		}
	}
	document.getElementById(element).style.border = "";
	errorCount--;
	if (errorCount == 0) 
	{
		document.getElementById("error").style.display = "none";
		document.getElementById("submit").disabled = false;
	}
}





/*******************************************
 * javaScrip pro praci s posuvnou galeriii
 * *****************************************/
 
function posun(smer,ie,velikostCelkem, idTab) {
  
  //alert("aa");
  var cesta=document.getElementById(idTab);
  //alert(cesta);
  
  //zjistuji aktualni pozici TOP tabulky se kterou posouvam
  if (ie=="0") {
    real=parseInt(document.defaultView.getComputedStyle(cesta,null).top);
  } 
  else {
    real=parseInt(cesta.currentStyle.top);
  }
  
  //alert(real);
            
  //budeme top ubirat do zaporne hodnoty
  if (smer=="nahoru") {
    //takze tento rozmer muzeme od celkove velikosti zanedbat
    if (real > -velikostCelkem) {
      document.getElementById(idTab).style.top=(real-4)+"px";
    }
  } else {
      if (real <= 0) {
        document.getElementById(idTab).style.top=(real+4)+"px";
      }
  }
  cykl=setTimeout('posun("'+smer+'","'+ie+'","'+velikostCelkem+'","'+idTab+'")',6);       
}   

function stop() { 
  clearTimeout(cykl); 
}   












