
function validate(){ 
var email = document.service.email.value;
var comment = document.service.comment.value;
var name = document.service.name.value;
var phone = document.service.phone.value;


	if (email != "")  {
		if (isEmail(email))  {
			if (comment != "") {
				if (name != "") {
					if (IsNumeric(phone) || phone == "")  {
						document.service.action="service.php";
						document.service.method= "post";
						document.service.submit(); 				
					} else {
						alert ("Phone Number is not Valid");	
						document.forms[0].elements[6].select();
						document.forms[0].elements[6].focus();
					}
				} else {
					alert ("Name is Blank");
					document.forms[0].elements[2].select();
					document.forms[0].elements[2].focus();
				}
			} else {
				alert ("Comment/Question is Blank");				
				document.forms[0].elements[1].select();
				document.forms[0].elements[1].focus();
			}
		} else {
			alert ("Email address is Invalid");				
			document.forms[0].elements[0].select();
			document.forms[0].elements[0].focus();
		}
	} else {
		alert ("Email is Blank");
		document.forms[0].elements[0].select();
		document.forms[0].elements[0].focus();
	}
}

function isEmail(string) {
if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
return true;
else
return false;
}


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;
   }
