
//////////////////////////////////////////////////

// Open Popup 

openPopup = function(mypage,w,h,scroll,resizable,Lpos,Tpos) {
	var win = null;
	
	settings = 'height='+h+',width='+w+',top='+Tpos+',left='+Lpos+',scrollbars='+scroll+',resizable='+resizable+'';
	
	win = window.open(mypage,"popUp",settings)
	win.focus();
}

/*
 * Create email adresses
 * Used instead of mailto: for preventing spam
 */
 
sendMail = function(user,domain) {
	try {
		locationstring = "mailto:" + user + "@" + domain; 
		window.location = locationstring; 
	}
	catch(error) {
		errorMessage(error, "There was an error when trying to send mail to:\n\n"+user+"@"+domain);
		return false;
	}
}


/*
 * Resizable pop up script
 */

		function PopupPic(sPicURL) { 
     window.open( "pop.asp?"+sPicURL, "pop",  
     "resizable=1,height=100,width=100"); } 

//////////////////////////////////////////////////

// Form Field checker - Contact


function Validate(objForm)
{
	if (objForm.txtName.value == "")
	{
		window.alert("Name is a required Field");
		objForm.txtName.focus();
		return false;
	}
	
		if (objForm.txtSurname.value == "")
	{
		window.alert("Surname is a required Field");
		objForm.txtSurname.focus();
		return false;
	}
	
	if (objForm.txtPostcode.value == "")
	{
		window.alert("Postcode is a required Field");
		objForm.txtPostcode.focus();
		return false;
	}
	
	if (objForm.txtTelephone.value == "")
	{
		window.alert("Telephone is a required Field");
		objForm.txtTelephone.focus();
		return false;
	}
	
	if (objForm.txtEmail.value == "")
	{
		window.alert("Email Address is a required Field");
		objForm.txtEmail.focus();
		return false;
	}

	if (objForm.txtEmail.value.indexOf("@", 0) == -1 || (objForm.txtEmail.value.indexOf("@", 0) != objForm.txtEmail.value.lastIndexOf("@", (objForm.txtEmail.value.length - 1))) || objForm.txtEmail.value.indexOf(".", 0) == -1)
	{
		window.alert("Email Address must be a valid Email Address");
		objForm.txtEmail.focus();
		return false;
	}

	return true;
}


