// JavaScript Document

function isEmailAddr (s){ 
	var rv = false
	if ((s == null) || (s.length == 0)) 
       rv = false;
  else {
		var reEmail =/([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		//reEmail = /.+\@.+\..+$/
		
		rv = reEmail.test(s)
    }
	if(rv){
	return rv
	}else{
		return false
	}
}
 
 function validation(theForm){
  if (theForm.firstname.value == ""){
    alert("Please enter your first name.");
    theForm.firstname.focus();
    return (false);
  }
  if (theForm.lastname.value == ""){
    alert("Please enter your surname.");
    theForm.lastname.focus();
    return (false);
  }
  if (theForm.address.value == ""){
    alert("Please enter your address.");
    theForm.address.focus();
    return (false);
  }
  if (theForm.city.value == ""){
    alert("Please enter your city.");
    theForm.city.focus();
    return (false);
  }
  if (theForm.postcode.value == ""){
    alert("Please enter your postcode.");
    theForm.postcode.focus();
    return (false);
  }
  if (theForm.phonenumber.value == ""){
    alert("Please enter your phone number.");
    theForm.phonenumber.focus();
    return (false);
  }
  if (!isEmailAddr(theForm.email_from.value)){
    alert("Please enter a complete email address in the form: yourname@yourdomain.com");
    theForm.email_from.focus();
    return (false);
  }
return true
}

var popUpWin=0;
function popUp(URLStr, width, height)
{
var left = 50
var top = 50
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}


function isEmailAddr (s){ 
	var rv = false
	if ((s == null) || (s.length == 0)) 
       rv = false;
  else {
		var reEmail =/([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		//reEmail = /.+\@.+\..+$/
		
		rv = reEmail.test(s)
    }
	if(rv){
	return rv
	}else{
		return false
	}
}
 
function freebook(theForm){
  if (theForm.name.value == ""){
    alert("Please enter your name.");
    theForm.name.focus();
    return (false);
  }
  if (theForm.Address.value == ""){
    alert("Please enter your delivery address.");
    theForm.Address.focus();
    return (false);
  }
  if (!isEmailAddr(theForm.email_from.value)){
    alert("Please enter a complete email address in the form: yourname@yourdomain.com");
    theForm.email_from.focus();
    return (false);
  }
return true
}