/*------------------------------------------Honza rozklikavaci menu------------------------------------------*/

function men2(uli){
	var ul = document.getElementById(uli);
	var ulia = uli + "a";
	if (ul.style.display == 'block') {
    ul.style.display = 'none';
    //document.getElementById(ulia).style.fontWeight = 'normal';
	}
		else{
			document.getElementById('amjz').style.display = 'none';
			//document.getElementById('amjza').style.fontWeight = 'normal';
      
      document.getElementById('amsz').style.display = 'none';
			//document.getElementById('amsza').style.fontWeight = 'normal';
			
      document.getElementById('skal').style.display = 'none';
			//document.getElementById('skala').style.fontWeight = 'normal';
      
      document.getElementById('amjv').style.display = 'none';
			//document.getElementById('amjva').style.display = 'normal';
			
			document.getElementById('kal').style.display = 'none';
			document.getElementById('new').style.display = 'none';
			document.getElementById('nov').style.display = 'none'
			document.getElementById('was').style.display = 'none';
      document.getElementById('amj').style.display = 'none';
      document.getElementById('vel').style.display = 'none';
      	document.getElementById('flo').style.display = 'none';
			
			
			ul.style.display = 'block';
			document.getElementById(ulia).style.fontWeight = 'bold';
		}
}

/* --------------------------------------------------------Honza konec--------------------------------------------------------*/
function vychodzapad(co){
  if (document.getElementById){
		if (co == 'vychod') {
			document.getElementById('vychod').style.display = 'block';
			document.getElementById('zapad').style.display = 'none';
			document.getElementById('vychodh2').className="vychod-a";
			document.getElementById('zapadh2').className="zapad-a";
		}
			else {
			document.getElementById('vychod').style.display = 'none';
			document.getElementById('zapad').style.display = 'block';
			document.getElementById('vychodh2').className="vychod";
			document.getElementById('zapadh2').className="zapad";
			}
		return false;
	}
	  else
	    return true;
}

function GBDId(id){
  if (document.getElementById){
    element=document.getElementById(id);
  }
    else 
      if (document.all){
        element=document.all[id];
      }
        else 
          if (document.layers){
            element=document.layers[id];
          }
  return element;
}


function ukaz(id){
	schovej_vse();
	GBDId(id).style.display="block";
}

function skryj(){
	cas=setTimeout("schovej_vse()",900);
	zapnuty_timer=true;
}
function pauzni(){
	if (zapnuty_timer){
		clearTimeout(cas);
		cas=null;
		zapnuty_timer=false;
	}
}

function schovej_vse(id)
{
	pauzni();

	for (i=0; i<polozky.length; i++)
	{
		if ( id != '' )
		{
			if ( polozky[i] != id )
			{
				GBDId(polozky[i]).style.display="none";
			}
		}
		else
		{
			GBDId(polozky[i]).style.display="none";
		}
	}
}
polozky = new Array('washington-menu','oregon-menu','utah-menu','nevada-menu','nove-mexiko-menu','arizona-menu','nebraska-menu','oklahoma-menu','texas-menu','colorado-menu','dakota-menu','wyoming-menu','idaho-menu');
zapnuty_timer = false;



function kontrolaPrazdna(id) {
  if (!jePrazdny(document.getElementById(id).value)) {
      document.getElementById(id).style.background = '#CAFBC0';
      document.getElementById(id).style.border = '1px solid #30FF00';
    return true;
  } else {
      document.getElementById(id).style.background = '#FBC0C0';
      document.getElementById(id).style.border = '1px solid #FF0000';
    return false;
  }
}

function kontrolaMailu(id) {
    value=document.getElementById(id).value;
		reg_vyraz=/.+@.+\..+/;
		if (reg_vyraz.test(value)) {
        document.getElementById(id).style.background = '#CAFBC0';
        document.getElementById(id).style.border = '1px solid #30FF00';
      return true;
    } else {
        document.getElementById(id).style.background = '#FBC0C0';
        document.getElementById(id).style.border = '1px solid #FF0000';
      return false;
    }
}

function jePrazdny(retezec)
    {
      for(var i = 0; i < retezec.length; i++) {
        var znak = retezec.charAt(i);
        if ((znak != ' ') && (znak != '\n') && (znak != '\t')) return false;
      }
      return true;
    }

function spam() {
  document.getElementById('kontrola').value = '123';
  document.getElementById('kontrola-div').style.visibility = 'hidden';
  document.getElementById('kontrola-div').style.display = 'none';
}

// -- KONTROLA CELEHO FORMULARE ------------------------------------------------
function kontrolaFormulare() {
  var kontrola = true;
  if (!kontrolaPrazdna('jmeno')) {kontrola=false;}
  if (!kontrolaPrazdna('prijmeni')) {kontrola=false;}
  if (!kontrolaPrazdna('email')) {kontrola=false;}
  if (!kontrolaMailu('email')) {kontrola=false;}
  
  if (!kontrola) {alert('Špatně vyplněný formulář! \n\nZkontroluje zdali máte správně vyplněny všechny povinné položky.');}
  return kontrola; 
}

// -- KONTROLA CELEHO FORMULARE ------------------------------------------------
function kontrolaDotaz() {
  var kontrola = true;
  if (!kontrolaPrazdna('email')) {kontrola=false;}
  if (!kontrolaMailu('email')) {kontrola=false;}
  if (!kontrolaPrazdna('dotaz')) {kontrola=false;}
  
  if (!kontrola) {alert('Špatně vyplněný formulář! \n\nZkontroluje zdali máte správně vyplněny všechny povinné položky.');}
  return kontrola; 
}

