function formChecker(theForm)	{
	if(theForm.Name.value == "")	{
		alert("Please ensure that you enter your name.");
		theForm.Name.focus();
		return false;
	}
	if(theForm.Tel.value == "")	{
		alert("Please ensure that you enter your telephone number.");
		theForm.Tel.focus();
		return false;
	}	
	if(theForm.EmailAddress.value == "")	{
		alert("Please ensure that you enter a valid email address.");
		theForm.EmailAddress.focus();
		return false;
	}	
	allValid = true;
	checkOK = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.@-_";
	for (i = 0;  i < theForm.EmailAddress.value.length;  i++)	{
		ch = theForm.EmailAddress.value.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
			break;
		if (j == checkOK.length)	{
			allValid = false;
			break;
		}
	}	
	if (!allValid)	{
		alert("Please enter only letters, digits and \" - _ @ . \" characters in the \"Email\" field.");
		theForm.EmailAddress.focus();
		return false;
	}	
	if ((theForm.EmailAddress.value.length < 6) || (theForm.EmailAddress.value.indexOf('@') == -1) || (theForm.EmailAddress.value.indexOf('.') == -1)	|| ((theForm.EmailAddress.value.indexOf('@')+1) == theForm.EmailAddress.value.length) || ((theForm.EmailAddress.value.indexOf('.')+1) == theForm.EmailAddress.value.length)) {
		alert("Please enter a valid email address");
		theForm.EmailAddress.focus();
		return false;
	}	
	if(theForm.MailAddress.value == "")	{
		alert("Please ensure that you enter your mail address.");
		theForm.MailAddress.focus();
		return false;
	}
	theForm.submit();
	return true;
}

function friendChecker(theForm)	{
	if(theForm.UserName.value == "")	{
		alert("Please ensure that you enter your name.");
		theForm.UserName.focus();
		return false;
	}
	if(theForm.FriendName.value == "")	{
		alert("Please ensure that you enter your friends name.");
		theForm.FriendName.focus();
		return false;
	}	
	if((theForm.UserMail.value == "")||(theForm.FriendMail.value == ""))	{
		alert("Please ensure that you enter a valid email address for you and your friend.");
		return false;
	}
	if((emailCheck(theForm.FriendMail.value) == false)||(emailCheck(theForm.UserMail.value) == false))	{
		alert("Please ensure that you enter a valid email address for you and your friend.");
		return false;
	}
	if(theForm.textfield.value == "")	{
		alert("Please ensure that you enter a message for your friend.");
		theForm.textfield.focus();
		return false;
	}
	theForm.submit();
	return true;	
}
function emailCheck(theValue)	{	
	allValid = true;
	checkOK = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.@-_";
	for (i = 0;  i < theValue.length;  i++)	{
		ch = theValue.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
			break;
		if (j == checkOK.length)	{
			allValid = false;
			break;
		}
	}	
	if (!allValid)	{
		return false;
	}	
	if ((theValue.length < 6) || (theValue.indexOf('@') == -1) || (theValue.indexOf('.') == -1)	|| ((theValue.indexOf('@')+1) == theValue.length) || ((theValue.indexOf('.')+1) == theValue.length)) {
		return false;
	}	
	return true;
}