//	Zjist vku aktivnho okna
function getWinHeight() {
	if (window.innerHeight)
		// NN4 a kompatibiln prohlee
		return window.innerHeight;
	else if (document.documentElement && document.documentElement.clientHeight)
		// MSIE6 v std. reimu - Opera a Mozilla ji usply s window.innerHeight
		return document.documentElement.clientHeight;
	else if (document.body && document.body.clientHeight)
		// star MSIE + MSIE6 v quirk reimu
		return document.body.clientHeight;
	else
		return null;
}

//	Vrt vku aktivnho okna nebo minimln pednastavenou vku
function getWinH() {
	var vyska = 780;
	if( getWinHeight() > 780 ) vyska = getWinHeight();
	return vyska;
}

//	Vype poloku menu
function MenuItem(desc,url,what,target) {
	document.write("<a href='" + url + "' target='" + target + "' onMouseOver='zhasni();popUp(\"" + what + "\",true); window.status=\"" + desc + "\"; return true;' onMouseOut='window.status=\"\"; return true;'><DIV class=menuitems" + target + ">" + desc + "<IMG src='img/menu_sipka.gif' style='position: relative; top: -1px; right: 0px; border: none; margin-left: 5px;'></DIV></a>");
}

//	Zjitn verze prohlee
NS4 = (document.layers) ? 1 : 0;
IE4 = (document.all) ? 1 : 0;
DOM = (document.getElementById) ? 1 : 0;
ver4 = (NS4 || IE4) ? 1 : 0;

//	Zobrazen podmenu
function popUp(menuName,on) {
	if (on) {
		if (NS4) {
			document.layers[menuName].visibility = "show";
		} else if (DOM) {
			if (document.getElementById(menuName)) document.getElementById(menuName).style.visibility = "visible";
		} else {
			document.all[menuName].style.visibility = "visible";
		}
	} else {
		if (NS4) {
			document.layers[menuName].visibility = "hide";
		} else if (DOM) {
			document.getElementById(menuName).style.visibility = "hidden";
		} else {
			document.all[menuName].style.visibility = "hidden";
		}
	}
}

//	Skryt podmenu
function zhasni() {
popUp('ofirme',false);
popUp('ponor2012',false);
popUp('ponor',false);
popUp('spojky',false);
popUp('reference',false);
popUp('poptavka',false);
popUp('horizontal',false);
popUp('vodarny',false);
}

function zhasni1() {
popUp('otacky1450',false);
popUp('otacky2900',false);
}

//	Zjist, zda se jedna o produktovou strnku a ped hodnotu pro vpoet posunu podmenu
function JeProdukt(posunuti) {
//	var posunuti = "blabla";
/*	var string2test = location.pathname.substring(location.pathname.lastIndexOf("/")+1,location.pathname.lastIndexOf(".asp"))
	if(string2test == "cerpaci-jimky-hcp" || string2test == "produkty" || string2test == "produkty2" || string2test == "produkty3" || string2test == "produkty4" || string2test == "produkty_vodarny") {
		return -70;
	} else {
		return 0;
	}*/
	if(posunuti==1){	
		return -70;		
	}
	else{
		return 0;
	}
}

//	Zjist, zda se jedna o produktovou strnku a ped hodnotu pro vpoet posunu podmenu ponornch erpadel
function PonorPos() {
	var string2test = location.pathname.substring(location.pathname.lastIndexOf("/")+1,location.pathname.lastIndexOf(".asp"))
	if(string2test == "produkty" || string2test == "produkty2" || string2test == "produkty3" || string2test == "produkty4" || string2test == "produkty_vodarny") {		
		return 298;
	} else {		
		return 0;
	}
}


//	Rozklikvn obrzk
function nahled1(aaa,bbb) {
	prewiev2 = window.open(aaa+'/obrazek.html?'+bbb,'nahledy','toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,width=200,height=100,left=10,top=10');
	prewiev2.window.focus();
}
//	Rozklikvn obrzk
function nahled2(aaa,bbb) {
	prewiev2 = window.open(aaa+'/obrazek2.html?'+bbb,'nahledy','toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,width=200,height=100,left=10,top=10');
	prewiev2.window.focus();
}

//	Rozklikvn referennch obrzk - vce fotek v adresi
function referenceimg(aaa) {
	prewiev2 = window.open('reference/obrazek.asp?adr1='+aaa,'reference','toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,width=200,height=100,left=10,top=10');
	prewiev2.window.focus();
}

//	Vmna obrzk (loga firem)
function mys(what,status) {
	if(status == "off") {
		document.getElementById(what).style.display='';
		document.getElementById(what+'_on').style.display='none';
	} else {
		document.getElementById(what).style.display='none';
		document.getElementById(what+'_on').style.display='';
	}
}


function changeform() {
	if(document.form.co.value == 'cerpadlo') location.href='poptavka_cerpadlo.html';
	if(document.form.co.value == 'spojka') location.href='poptavka_spojka.html';
	if(document.form.co.value == 'elektromotor') location.href='poptavka_elektromotor.html';
	if(document.form.co.value == 'ostatni') location.href='poptavka_ostatni.html';
}

/*
function check_email(adresa) {
		re = /^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,4}$/;
		return adresa.search(re) == 0;
}
*/

re = /^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,4}$/;

function sendform() {

	if ( document.form.firma.value == "" ) {
	   alert("Není zadán název firmy!");
	   document.form.firma.focus();
	   return false;
	}

	if ( document.form.ic.value == "" ) {
	   alert("Není zadáno IČ!");
	   document.form.ic.focus();
	   return false;
	}

	if ( document.form.mesto.value == "" ) {
	   alert("Není zadáno město!");
	   document.form.mesto.focus();
	   return false;
	}

	if ( document.form.telefon.value == "" ) {
	   alert("Není zadán telefon!");
	   document.form.telefon.focus();
	   return false;
	}

//	Kontrola e-mailu
	if ( document.form.email.value != "" ) {
		if (re.test(document.form.email.value) == 0) {
			alert ("E-mailov adresa není platná");
			document.form.email.focus();
			document.form.email.select();
			return false;
		}
	}



	if ( document.form.vyplnil.value == "" ) {
	   alert("Není zadáno Vaše jméno!");
	   document.form.vyplnil.focus();
	   return false;
	}

	document.form.submit();

}

