function ValidateForm() {
	myArray=new Array(0)
	i=0;
	if (document.form.fname.value == "") {
		hideAllErrors();
		myArray[i]="fnameError";
		i++;
		document.form.fname.focus();
	}
	if (document.form.email.value == "") {
    	hideAllErrors();
		myArray[i]="emailError";
		i++;
    	document.form.email.focus();
  	}
	else {
		var apos=document.form.email.value.indexOf("@");
		var dotpos=document.form.email.value.lastIndexOf(".");
		if (apos<1||dotpos-apos<2){ 
  			hideAllErrors();
			myArray[i]="invalidemailError";
			i++;
    		document.form.email.focus();
		}
	}
	for (var i=0; i<myArray.length; i++) { 
		if(myArray[i]=="fnameError")	{
		document.getElementById("fnameError").style.display="inline"
		}
		if(myArray[i]=="emailError")	{
		document.getElementById("emailError").style.display="inline"
		}
		if(myArray[i]=="invalidemailError")	{
		document.getElementById("invalidemailError").style.display="inline"
		}
	}
	if(myArray.length > 0) {
		return false;
	}
}

/*************************************************************************\
This function hides all error messages if no error is found or the 
button has not been submitted yet.
\*************************************************************************/
function hideAllErrors() {
document.getElementById("fnameError").style.display = "none";
document.getElementById("emailError").style.display = "none";
document.getElementById("invalidemailError").style.display = "none";
}

//  End -->