function emptyvalidation(entered, alertbox)
{
	with (entered)
	{
		if (value==null || value=="")
		{
			if (alertbox!="") {alert(alertbox);} return false;
		}
		else
		{
			return true;
		}
	}
}

function emailvalidation(entered, alertbox)
{
	with (entered)
	{
		apos=value.indexOf("@"); 
		dotpos=value.lastIndexOf(".");
		lastpos=value.length-1;
		if (apos<1 || dotpos-apos<2 || lastpos-dotpos>4 || lastpos-dotpos<2) 
		{
			if (alertbox) 
			{
				alert(alertbox);
			} 
			return false;
		}
		else
		{
			return true;
		}
	}
} 


function Validation(thisform)
{
	with (thisform)
		{
			if (emptyvalidation(name,"Please enter your name.")==false) {name.focus(); return false;};
			if (emailvalidation(email,"The email address you entered isn't valid. Please retype the address.")==false) {email.focus(); return false;};
			if (emptyvalidation(message,"Please enter a message.")==false) {message.focus(); return false;};			
			if (emptyvalidation(code,"Please fill type the code in the image.")==false) {code.focus(); return false;};			
		}
	return true;
}
