function inp(inp) {
	if (inp.value == "Vyhledat...") inp.value = "";
}

function isEmpty(e){
    return ((e == null) || (e.length == 0));
}

function isEmail(str){
	var filter=/^.+@.+\..{2,4}$/
	if (filter.test(str) == true){
		return true;
	}
	else{
		return false;
	}
}


// objednavka katalogu
function check_katalog2(form)
{
	var themessage = "Doplňte, prosím, následující údaje:\n";

	if (isEmpty(form.jmeno.value)) {
		themessage = themessage + " - jméno\n";
		}
	if (isEmpty(form.prijmeni.value)) {
		themessage = themessage + " - příjmení\n";
		}
	if (isEmpty(form.ulice.value))  {
		themessage = themessage + " - ulice a číslo\n";
		}
	if (isEmpty(form.mesto.value))  {
		themessage = themessage + " - město\n";
		}
	if (isEmpty(form.psc.value))  {
		themessage = themessage + " - PSČ\n";
		}
	if ((!form.atosprime.checked) && (!form.getz.checked) && (!form.accent.checked) && (!form.elantra.checked) && (!form.sonata.checked) && (!form.coupe.checked) && (!form.matrix.checked) && (!form.trajet.checked) && (!form.tucson.checked) && (!form.santafe.checked) && (!form.terracan.checked) && (!form.h1van.checked) && (!form.h1truck.checked))   	{
		themessage = themessage + " - vůz, o který máte zájem\n";
	}
	if (themessage == "Doplňte, prosím, následující údaje:\n")
	{
		return true;
	}
	else
	{
		alert(themessage);
		return false;
	}


   //(!form.grandeur.checked) DOPLNIT AZ SE VRATI GRANDEUR DO PODMINKY, KTERA KONTROLUJE CHECKBOXY
}


// zpravodaj - prihlaseni a odhlaseni
function zpravodaj(form) {
var themessage = "Doplňte, prosím, následující údaje:\n";
	if (isEmpty(form.jmeno.value)) {
		themessage = themessage + " - celé jméno\n";
		}
	if (!isEmail(form.email.value)) {
		themessage = themessage + " - Váš email\n";
		}
if (themessage == "Doplňte, prosím, následující údaje:\n") {
	return true; }
else {
	alert(themessage);
	return false;
   }
}

//kontaktni formular
function kontakt_form(form) {
var themessage = "Doplňte, prosím, následující údaje:\n";
	if (isEmpty(form.jmeno.value)) {
		themessage = themessage + " - celé jméno\n";
		}
	if (!isEmail(form.email.value)) {
		themessage = themessage + " - Váš email\n";
		}
	if (form.kraj.value == '14' ) {
		themessage = themessage + " - kraj\n";
		}
	if (form.prodejce.value == 'Vyberte prodejce' ) {
		themessage = themessage + " - prodejce\n";
		}
	if (isEmpty(form.zprava.value)) {
		themessage = themessage + " - zpráva\n";
		}
if (themessage == "Doplňte, prosím, následující údaje:\n") {
	return true; }
else {
	alert(themessage);
	return false;
   }
}

//testovaci jizda
function test_jizda(form) {
var themessage = "Doplňte, prosím, následující údaje:\n";
	if (isEmpty(form.jmeno.value)) {
		themessage = themessage + " - jméno\n";
		}
	if (isEmpty(form.prijmeni.value)) {
		themessage = themessage + " - příjmení\n";
		}
	if (isEmpty(form.ulice.value)) {
		themessage = themessage + " - ulici a ČP\n";
		}
	if (isEmpty(form.mesto.value)) {
		themessage = themessage + " - město\n";
		}
	if (isEmpty(form.psc.value)) {
		themessage = themessage + " - PSČ\n";
		}
	if (!isEmail(form.email.value)) {
		themessage = themessage + " - Váš email\n";
		}
	if (form.kraj.value == '14' ) {
		themessage = themessage + " - kraj\n";
		}
	if (form.prodejce.value == 'Vyberte prodejce' ) {
		themessage = themessage + " - prodejce\n";
		}
if (themessage == "Doplňte, prosím, následující údaje:\n") {
	return true; }
else {
	alert(themessage);
	return false;
   }
}

function sestava_emailem2(form) {
var themessage = "Doplňte, prosím, následující údaje:\n";
	if (isEmpty(form.jmeno.value)) {
		themessage = themessage + " - Váše jméno\n";
		}

	if (!isEmail(form.email.value)) {
		themessage = themessage + " - Váš email\n";
		}
	/*if (form.prodtaky.checked) {
		if (isEmpty(form.jmeno.value)) {
		themessage = themessage + " - jméno a příjmení\n";
		}
		if (form.kraj.value == '14' ) {
		themessage = themessage + " - kraj\n";
		}
		if (form.prodejce.value == 'Vyberte prodejce' ) {
		themessage = themessage + " - prodejce\n";
		}
	}*/
if (themessage == "Doplňte, prosím, následující údaje:\n") {
	return true; }
else {
	alert(themessage);
	return false;
   }
}

// prodej-sluzby/fleet-program.php
function dotaznik(form) {
var themessage = "Doplňte, prosím, následující údaje:\n";
	if (isEmpty(form.mesto.value)) {
		themessage = themessage + " - město\n";
		}
	if (isEmpty(form.ulice.value)) {
		themessage = themessage + " - ulice\n";
		}
	if (isEmpty(form.psc.value)) {
		themessage = themessage + " - PSČ\n";
		}
	if (isEmpty(form.kontakt.value)) {
		themessage = themessage + " - kontaktní osoba\n";
		}
	if (isEmpty(form.psc.value)) {
		themessage = themessage + " - PSČ\n";
		}
	if (!isEmail(form.email.value)) {
		themessage = themessage + " - Váš email\n";
		}
	if (isEmpty(form.telefon.value)) {
		themessage = themessage + " - Váš telefon\n";
		}
if (themessage == "Doplňte, prosím, následující údaje:\n") {
	return true; }
else {
	alert(themessage);
	return false;
   }
}

function radioImg(cislo){
  vyberPole = cislo.value;
  for (i=1;document.getElementById("color"+i);i++){
  document.getElementById("color"+i).style.display = (i==vyberPole) ? "inline" : "none";
  }
}

function image_open(file,popis,sirka,vyska) {
    if ((sirka>(screen.availWidth-20)) || (vyska>(screen.availHeight-40)))
            okno = window.open( "","",'width='+(screen.availWidth/1.5)+',height='+(screen.availHeight/1.5)+',top=100,left=100,location=no,toolbar=no,directories=no,status=no,resizable=yes,scrollbars=yes,copyhistory=no' );
    else
            okno = window.open( "","",'width='+sirka+',height='+vyska+',top=100,left=100,location=no,toolbar=no,directories=no,status=no,resizable=no,scrollbars=no,copyhistory=no' );
	var str_buffer = new String (
		"<html>\n"+
		"<head>\n"+
		"	<title>" + popis + " - kliknutím na obrázek zavřete okno</title>\n"+
		"</head>\n"+
		"<body style=\"margin: 0; padding: 0; background: white;\">\n"+
		"<a href=\"javascript:window.close();\" title=\"kliknutím zavřete okno\"><img src=\"" + file + "\" alt=\"X\" style=\"width: " + sirka + "; border: 0px; margin: 0px\" /></a>\n"+
        "</body>\n</html>");
	okno.opener = self;
	okno.focus();
	var okno_doc = okno.document;
	okno_doc.write (str_buffer);
	okno_doc.close();
}

function image_open01(file) {
var str_buffer = new String (
"<html>\n"+
"<head>\n"+
"<title>Kliknutím na obrázek zavřete okno</title>\n"+
"<script language=\"JavaScript\">\n"+
"function velikost() {\n"+
"if ((obr.width>(screen.availWidth-20)) || (obr.height>(screen.availHeight-40)))\n"+
"window.resizeTo(obr.width+26, obr.height/2);\n"+
"else\n"+
"window.resizeTo(obr.width+10, obr.height+30);\n"+
"}\n"+
"</script>\n"+
"<link href=\"style.css\" rel=\"stylesheet\" type=\"text/css\">\n"+
"</head>\n"+
"<body onload=\"velikost();\" bgcolor=\"White\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" style=\"margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;\">\n"+
"<a href=\"javascript:window.close();\" title=\"kliknutím zavřete okno\"><img name=\"obr\" src=\"" + file + "\"  alt=\"Kliknutˇm na obr zek zav©ete okno\" border=0 ></a>\n"+
        "</body>\n</html>");
var okno = window.open("","okno1",'width=1,height=1,left=20,top=20,location=no,toolbar=no,directories=no,status=no,scrollbars=no,copyhistory=no');
okno.opener = self;
okno.focus();

var okno_doc = okno.document;
okno_doc.write (str_buffer);
okno_doc.close();
}


