function cook_cookie(name,value,expires,path,domain,secure) {

  document.cookie = name + "=" + escape (value) +

    "; expires=Thu, 01-Jan-10 00:00:01 GMT" +

    ((path) ? "; path=" + path : "") +

    ((domain) ? "; domain=" + domain : "") +

    ((secure) ? "; secure" : "");

}

//otevira a zavira skryte DIVy na mailform.php
	function show_hide_element(i) 

{
		obj = document.getElementById(i)
// 		
// 		var children = obj.childNodes;
// 		alert(children[0]);
		if (obj.style.visibility == '' || obj.style.visibility == 'hidden') {
		   obj.style.display =  'table-row';
		   obj.style.visibility = 'visible';
		}

		else {
		   obj.style.visibility = 'hidden';
		   obj.style.display =  'none';
		}
	}

//funkce otevira a zavira hlavni menu
	function func(i)

	{

		obj = document.getElementById('ul_'+i)
		obj2 = document.getElementById('li_'+i)
// 		if (obj.style.visibility == '' || obj.style.visibility == 'hidden') {
// 		   obj.style.display =  'block';
// 		   obj.style.visibility = 'visible';
// 		   obj2.style.backgroundImage =  'url("http://czech-transport.com/img/bg-menu-right3-minus.png")';
// 		   
// 		}
// 
// 		else {
// 		   obj.style.visibility = 'hidden';
// 		   obj.style.display =  'none';
// 		   obj2.style.backgroundImage =  'url("http://czech-transport.com/img/bg-menu-right3.png")';
// 		}
		if (obj2.className == 'exch plus'){
// 		   obj.style.display =  'block';
// 		   obj.style.visibility = 'visible';
		   obj.className = 'sub visible';
		   obj2.className = 'exch minus';
		}
		else {
// 		   obj.style.visibility = 'hidden';
// 		   obj.style.display =  'none';
		   obj.className = 'sub hidden';
		   obj2.className = 'exch plus';
		}
	}


function is_str(str,regexp)
{
var val = false;
var re = new RegExp(regexp);
if (str.match(re)) val = true;
return val;
}

function testResults(forma,jm,pr,mejl,dat,let,time,air)
{
var returnVal = false;
  if (forma.jmeno.value.length < 2){
	alert (jm);
	forma.jmeno.focus();
	halt();
  }
  if (!(is_str(forma.mejl.value,'^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,6})$'))){
	alert (mejl);
	forma.mejl.focus();
	halt();
  }
  if (forma.airline.value == 0){
	alert (air);
	forma.airline.focus();
	halt();
  }
  if ((forma.let.value.length > 7) || (forma.let.value.length < 3)){
	alert (let);
	forma.let.focus();
	halt();
  }
  if (forma.den.value == 0) {
	alert (dat);
	halt();
  }
  if (forma.mesic.value == 0) {
	alert (dat);
	halt();
  }
  if (forma.rok.value < 1) {
	alert (dat);
	halt();
  }
  if (forma.hodina.value == -1) {
	alert (time);
	halt();
  }
  if (forma.minuta.value == -1) {
	alert (time);
	halt();
  }
	cook_cookie('name',forma.jmeno.value);
	cook_cookie('email',forma.mejl.value);
	forma.submit();
}
function pausecomp(millis)
{
date = new Date();
var curDate = null;

do { var curDate = new Date(); }
while(curDate-date < millis);
} 
function Show(){
	//pausecomp(20);
	elem = document.getElementById("sh");
	elem.style.visibility="visible";
	document.getElementById("buttON").style.visibility="hidden";
	for (var i=0;i < 40; i++) {
	window.scrollBy(0,10);
	}
	elem.jmeno.focus();

}
