function validateForm(whichbutton) {
	var btton = whichbutton;
	if(btton =="contact_form"){
		with (document.form1) {
			var alertMsg = "The following fields are REQUIRED, they have either been left empty or contain errors:\n";
			if (YourName.value == "") alertMsg += "\n Your Name:  Enter your name.\n";
			if ((Email.value==null)||(Email.value=="")) alertMsg += "\n Email:  You left this field blank";
			if (echeck(Email.value)==false) alertMsg += "\n Email:  Your email address is invalid\n";
			if ((Phone.value==null)||(Phone.value=="")) alertMsg += "\n Phone:  You left this field blank";
			if (!(IsNumeric(Phone.value))) alertMsg += "\n Phone: - The number entered is invalid, it number must be numeric\n";
			if (Description.value == "") alertMsg += "\n Description: - Please type a description.";

			if (alertMsg != "The following fields are REQUIRED, they have either been left empty or contain errors:\n") {
				alert(alertMsg);
				return false;
			} else {
				return true;
				//alert("test");
			}
		}
	}
}

function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }


function echeck(str) {
		var blnResult = true;
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   //alert("Invalid E-mail ID")
		   blnResult = false;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   //alert("Invalid E-mail ID")
		   blnResult = false;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    //alert("Invalid E-mail ID")
		    blnResult = false;
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    //alert("Invalid E-mail ID")
		    blnResult = false;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    //alert("Invalid E-mail ID")
		    blnResult = false;
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    //alert("Invalid E-mail ID")
		    blnResult = false;
		 }
		
		 if (str.indexOf(" ")!=-1){
		   // alert("Invalid E-mail ID")
		    blnResult = false;
		 }

 		 return blnResult;				
	}