
function openwin(url,name) {
  var height = 600;
  var width = 800;
  var str = "height=" + height + ",innerHeight=" + height;
  str += ",width=" + width + ",innerWidth=" + width;
  if (window.screen) {
    var ah = screen.availHeight - 30;
    var aw = screen.availWidth - 10;
    var xc = Math.floor((aw - width) / 2);
    var yc = Math.floor((ah - height) / 2);
    str += ",left=" + xc + ",screenX=" + xc;
    str += ",top=" + yc + ",screenY=" + yc;
  }
  str += ",directories=0,location=0,menubar=1,personalbar=1,scrollbars=1,status=1,toolbar=1";
  return window.open(url,name,str);
}

//--------------------------------------------------------------------------------------------


function zkontroluj_email(adresa) {
  re = /^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,3}$/;
  return adresa.search(re) == 0;
}

function zkontroluj_telefon(cislo) {
  re = /^[+]? ?\d{3,14} ?\d{2,9} ?\d{2,6} ?\d{2,3} ?\d{0,2}$/;
  return cislo.search(re) == 0;
}

function Form_Validatore(theForm) {// jeden nebo druhy
	
	if (!zkontroluj_telefon(theForm.telefon.value) && !zkontroluj_email(theForm.e_mail.value)) {
			theForm.telefon.style.backgroundColor = "#666";
			theForm.telefon.style.color = "#fff";
  		theForm.e_mail.style.backgroundColor = "#666";
			theForm.e_mail.style.color = "#fff";
			
			alert("Nevyplnily jste správně telefon nebo e-mail");

			return (false);
		}

		if (!theForm.jmeno.value)
			{
				theForm.jmeno.style.backgroundColor = "#FFD1D1";
				alert("musí být vyplněno");
				theForm.jmeno.focus();
				return (false);
			}

		if (!theForm.adresa.value)
			{
				theForm.adresa.style.backgroundColor = "#FFD1D1";
				alert("musí být vyplněna");
				theForm.adresa.focus();
				return (false);
			}
			
	return (true);
}
	