// JavaScript Document
function isEmpty(theField) {
		if ((theField.value =="")||(theField.value =="Vaše jméno")){
			return true;
		}
		else {
			return false;
		}
}

function checkEmail(address){
  re = /^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,4}$/;
  return address.search(re) == 0;
}

function  check(theField1) {
    var Empty = false;

    if (isEmpty(theField1.name)) {
        alert("Je nutné vyplnit pole Vaše jméno.\nProsíme vyplňte!");
        theField1.name.focus();
        Empty = true;
    }
    if (Empty == false && !checkEmail(self.document.forms.recommendation.email.value) == true) {
        alert("Pole email není vyplněno, nebo nepravdivě vyplněno.\nProsíme vyplňte!");
        theField1.email.focus();
        Empty = true;
    }
    if (Empty == false ) {
    	page = "doporuceni.php?name=" + self.document.forms.recommendation.name.value + "&email=" + self.document.forms.recommendation.email.value;
        window.open(page,"_blank",'toolbar=0,location=0,directories=0, status=0,menubar=0,scrollbars=0,resizable=0, width=200,height=150');
        self.document.forms.recommendation.name.value="Vaše jméno";
        self.document.forms.recommendation.email.value="Email adresáta";
    }
}
//-->

