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,resizable=1";
  //return window.open(url,name,str);
  window.open(url,name,str);
  return false;
}

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.textfield4.value) && !zkontroluj_email(theForm.textfield5.value)) {
			theForm.textfield5.style.backgroundColor = "#c00";
			theForm.textfield5.style.color = "#fff";
  		theForm.textfield4.style.backgroundColor = "#c00";
			theForm.textfield4.style.color = "#fff";
			
			alert("Nevyplnily jste srávně svůj kontaktní email nebo telefon!");

			return (false);
		}

	return (true);
}

//[emailer FNC]--------------------------------------
function RunEmailControl(adresa){re=/^[+_a-zA-Z0-9-]+(\.[+_a-zA-Z0-9-]+)*@[\.a-zA-Z0-9-]+\.[a-zA-Z0-9-]{2,4}$/;return adresa.search(re)==0;}
function EmailControl(address){if(RunEmailControl(address)){return true;}else{alert('chybny email')return false}}
