
function emailvalidation(entered, alertbox)
{
// E-mail Validation by Henrik Petersen / NetKontoret
// Explained at www.echoecho.com/jsforms.htm
// Please do not remove this line and the two lines above.
with (entered)
{
apos=value.indexOf("@"); 
dotpos=value.lastIndexOf(".");
lastpos=value.length-1;
if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) 
{if (alertbox) {alert(alertbox);} return false;}
else {return true;}
}
}

	
function emptyvalidation(entered, alertbox)
{
// Emptyfield Validation by Henrik Petersen / NetKontoret
// Explained at www.echoecho.com/jsforms.htm
// Please do not remove this line and the two lines above.
with (entered)
{
if (value==null || value=="")
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
}


function formvalidation(thisform)
{
// This function checks the entire form before it is submitted
// Note: This function needs to be customized to fit your form
	
	with (thisform)
	{
		if (emptyvalidation(author,"Please fill in your name")==false) {author.focus(); return false;};	
		if (emailvalidation(email,"Please enter a valid email address")==false) {email.focus(); return false;};
	}
}


function cdformvalidation(thisform)
{
// This function checks the entire form before it is submitted
// Note: This function needs to be customized to fit your form
	
	with (thisform)
	{
		if (emptyvalidation(name,"Please fill in your name")==false) {name.focus(); return false;};				
		/*
		if (emptyvalidation(address,"Please fill in your address")==false) {address.focus(); return false;};	
		if (emptyvalidation(city,"Please fill in your city")==false) {city.focus(); return false;};	
		if (emptyvalidation(province,"Please fill in your province")==false) {province.focus(); return false;};	
		if (emptyvalidation(postalcode,"Please fill in your postal code")==false) {postalcode.focus(); return false;};	
		*/
		if (emptyvalidation(phone,"Please fill in your phone number")==false) {phone.focus(); return false;};					
		if (emailvalidation(email,"Please enter a valid email address")==false) {email.focus(); return false;};
	
	}
}
