 var isMSIE = /*@cc_on!@*/false;
    if (isMSIE)
    	document.write("<link rel='stylesheet' href='project/css/ie7style.css' type='text/css' media='screen,projection' />");
    else
    	document.write("");


function showHlaska(hlaska) {
  document.getElementById(hlaska).style.display = "block";
}

function CheckReg1(form)
{
	var formular = document.getElementById(form);
	
	if (formular.jmeno.value=="") //místo „jméno“ napište název formuláře 
	{
		showHlaska("hlaska-alert"); //vypsání chyby
		document.getElementById('hlaska-alert').innerHTML = poleFormJmeno;
		formular.jmeno.focus();//místo „jméno“ napište název formuláře 
		return false;
	}
	if (formular.email.value=="")//místo „email“ napište název formuláře 
	{
		showHlaska("hlaska-alert");//vypsání chyby
		formular.email.focus();//místo „email“ napište název formuláře 
		document.getElementById('hlaska-alert').innerHTML = poleFormEmail;
		return false;
	}
	if (window.RegExp)
	{
		re = new RegExp("^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,3}$");//znaky, která má či nemá obsahovat emailová adresa
		if (!re.test(formular.email.value))// místo „email“ napište název formuláře 
		{
			showHlaska("hlaska-alert");// vypsání chyby
			document.getElementById('hlaska-alert').innerHTML = poleFormBadEmail;
			formular.email.focus();//místo „email“ napište název formuláře 
			return false;
		}
	}
	if (formular.telefon.value=="")//místo „email“ napište název formuláře 
	{
		showHlaska("hlaska-alert");//vypsání chyby
		document.getElementById('hlaska-alert').innerHTML = poleFormTelefon;
		formular.telefon.focus();//místo „email“ napište název formuláře 
		return false;
	}
	
	return true;
}


var myTWin = window.myTWin;
function openCal(link) {
	var retValue=true;
	if (myTWin!=null && !myTWin.closed) {
		myTWin.focus();
		myTWin.location.href=link;
	} else {
		myTWin=window.open( link, 'calendar', 'scrollbars=1, resizable=0, width=600, height=300, top=50, left=50, menu=0, navigate=0, statusbar=0' );
		if (myTWin==null || typeof(myTWin)=="undefined")
			retValue=false;
		else {
			link.target = 'calendar';
			myTWin.focus();
		}
	}
	return retValue;
}





    var myTWin = window.myTWin;
    
    function OpenMyWin(link,winName)
    {
      var retValue=true;
      if (myTWin!=null && !myTWin.closed)
      {
        myTWin.focus();
        myTWin.location.href=link.href;
      }
      else
      {
        myTWin=window.open(link.href, winName, 'scrollbars=1,resizable=1,width=1024,height=768,top=30,left=30,menu=0,navigate=0,statusbar=0');
        if (myTWin==null || typeof(myTWin)=="undefined")
          retValue=false;
        else
        {
          link.target=winName;
          myTWin.focus();
        }
      }
      return retValue;
    }





    var myTWin = window.myTWin;
    
    function OpenMyWin1(link,winName)
    {
      var retValue=true;
      if (myTWin!=null && !myTWin.closed)
      {
        myTWin.focus();
        myTWin.location.href=link.href;
      }
      else
      {
        myTWin=window.open(link.href, winName, 'scrollbars=1,resizable=1,width=400,height=520,top=30,left=30,menu=0,navigate=0,statusbar=0');
        if (myTWin==null || typeof(myTWin)=="undefined")
          retValue=false;
        else
        {
          link.target=winName;
          myTWin.focus();
        }
      }
      return retValue;
    }




    var myTWin = window.myTWin;
    
    function OpenMyWin2(link,winName)
    {
      var retValue=true;
      if (myTWin!=null && !myTWin.closed)
      {
        myTWin.focus();
        myTWin.location.href=link.href;
      }
      else
      {
        myTWin=window.open(link.href, winName, 'scrollbars=1,resizable=1,width=800,height=600,top=30,left=30,menu=1,navigate=1,statusbar=1');
        if (myTWin==null || typeof(myTWin)=="undefined")
          retValue=false;
        else
        {
          link.target=winName;
          myTWin.focus();
        }
      }
      return retValue;
    }
    
    function calendarSub() {
    	return document.forms["kalendarForm"].submit();
    }
    

function zobrazSkryj(idecko){ 
el=document.getElementById(idecko).style; 
el.display=(el.display == 'block')?'none':'block'; 
}

function naplnCas (){
	var xhr;
	if (window.XMLHttpRequest) { xhr = new XMLHttpRequest(); }
	if (window.ActiveXObject) { xhr = new ActiveXObject("Microsoft.XMLHTTP");	}
		
	xhr.onreadystatechange = function(){
	  if ( xhr.readyState == 4 ) {
	    if ( xhr.status == 200 ) {
	      document.getElementById('cas').innerHTML = xhr.responseText;
	    }
	  }
	};
	xhr.open("GET", '/project/inc/presny-cas.php', true);
	xhr.send(null);
}
       


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

function copy_text(val, id)
{
	$(id).value = val;
}

function copy_text_blok(id1, id2)
{
    if($(id2).value == ""){
    val = $(id1).value;
	$(id2).value = val;}
}


function pickup_state(type, enabled)
{
	var when = document.getElementById(type + "-when-form");
	var address = document.getElementById(type + "-address-form");

	if (enabled)
	{
		when.className = "form-when";
		address.className = "entry cell-box";
		for (var i = 1; i <= 6; i++)
		{
			if ($(type + '-mandatory-cell-' + i))
			{
				$(type + '-mandatory-cell-' + i).className = $(type + '-mandatory-cell-' + i).className + " mandatory";
			}
		}
		
		if (type == 'to')
		{
			if ($('from-entry').selectedIndex == 1)
			{
				if ($('to-exit').selectedIndex != 1)
				{
					$('to-exit').selectedIndex = 1;
					zobrazSkryj("skryty02");
					skryj('nazev04');
          zobrazSkryj('nazev03');
          
				}
				
				copy_text_blok('from-city-other', 'to-city-other');
				copy_text_blok('from-street-other', 'to-street-other');
				copy_text_blok('from-house-number-other', 'to-house-number-other');
				zmenPodsviceni('to-exit', 'to-mandatory-cell-6');
				
				//$('to-city-other').value = $('from-city-other').value;
				//$('to-street-other').value = $('from-street-other').value;
				//$('to-house-number-other').value = $('from-house-number-other').value;
			}
		}
	}
	else
	{
		when.className = "form-when disabled";
		address.className = "entry disabled-borders";
		for (var i = 1; i <= 6; i++)
		{
			if ($(type + '-mandatory-cell-' + i))
			{
				var cl = $(type + '-mandatory-cell-' + i).className;
				var pos = cl.indexOf(type + "-mandatory-cell-" + i);
				cl = cl.substr(0, pos);
				$(type + '-mandatory-cell-' + i).className = cl;
			}
		}
	}

	$(type + '-date').disabled = !enabled;
	$(type + '-time-hours').disabled = !enabled;
	$(type + '-time-minutes').disabled = !enabled;
	$(type + '-city').disabled = !enabled;
	$(type + '-street').disabled = !enabled;
	$(type + '-house-number').disabled = !enabled;
	$(type + '-note').disabled = !enabled;
	$(type + '-flight-number').disabled = !enabled;
	$(type + '-flight-city').disabled = !enabled;
	if (type == 'to')
		$(type + '-exit').disabled = !enabled;
	else
		$(type + '-entry').disabled = !enabled;
}








function showHlaska(hlaska) {
  document.getElementById(hlaska).style.display = "block";
}

function CheckReg8(formular)
{
  document.getElementById("hlaska9").style.display = "none";
  document.getElementById("hlaska10").style.display = "none";

     if (formular.rychlyemail.value=="")//mĂ­sto â€žemailâ€ś napiĹˇte nĂˇzev formulĂˇĹ™e 
{
showHlaska("hlaska9");//vypsĂˇnĂ­ chyby
formular.rychlyemail.focus();//mĂ­sto â€žemailâ€ś napiĹˇte nĂˇzev formulĂˇĹ™e 
return false;
}
else if (window.RegExp)
{
re = new RegExp("^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,3}$");//znaky, kterĂˇ mĂˇ ÄŤi nemĂˇ obsahovat emailovĂˇ adresa
if (!re.test(formular.rychlyemail.value))// mĂ­sto â€žemailâ€ś napiĹˇte nĂˇzev formulĂˇĹ™e 
{
showHlaska("hlaska10");// vypsĂˇnĂ­ chyby
formular.rychlyemail.focus();//mĂ­sto â€žemailâ€ś napiĹˇte nĂˇzev formulĂˇĹ™e 
return false;
}
}
else 
return true;
}

function spocitej_km (objekt)
{
	var kmtaxi = 0;
	var cenabezkmtaxi = 0;
	if ((objekt.cena_taxi.value > 0)) 
	{
		kmtaxi = objekt.cena_taxi.value * 21 + (40 * 1.15);
		objekt.km_taxi.value = eval ((Math.ceil (kmtaxi / 100)) * 100);
	}
	else alert ("Počet kilometrů musí být číslo větší než nula!");
}

function spocitej_km1 (objekt1)
{
	var kmvice = 0;
	var cenabezkmvice = 0;
	if ((objekt1.cena_vice.value > 0)) 
	{
		kmvice = objekt1.cena_vice.value * 28 + (40 * 1.15);
    objekt1.km_vice.value = eval ((Math.ceil (kmvice / 100)) * 100);
	}
	else alert ("Počet kilometrů musí být číslo větší než nula!");
}


function zmenPodsviceni(selectId, id)
{
   if ($(selectId).selectedIndex != 1)
     $(id).className = "mandatory"; // pri kliknuti na Praha-Ruzyne
   else
     $(id).className = "backgroundnot"; // pri kliknuti na Jine m.
}
