// JavaScript Document
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;
   }
   
var remail=/^([_&a-zA-Z0-9-]+(\.[_&a-zA-Z0-9-]+)*@[&a-zA-Z0-9-]+\.+[&a-zA-Z0-9-]+)/;

function checkEmail(fieldvalue){
	if(remail.test(fieldvalue))
		return false;
	else
		return true;
}

function checkValidation(frm){
	
	if(frm.name.value==""){
		
		alert("Please Enter Your Name");
		frm.name.focus();
		return false;
	
	}
	
	if(frm.email.value==""){
		
		alert("Please Enter the Email Address");
		frm.email.focus();
		return false;
	
	}

	if(checkEmail(frm.email.value)){

		alert("Cannot Submit!!\n\nInvalid Email.\n");
		frm.email.focus();
		frm.email.select();
		return false;	

	}
	
	if(frm.telephone.value==""){
		
		alert("Please Enter the Telephone Number");
		frm.telephone.focus();
		return false;
	
	}
	
	if(IsNumeric(frm.telephone.value) == false) {

		alert("Cannot Submit!!\n\nInvalid Phone Number.\n");
		frm.telephone.focus();
		frm.telephone.select();
		return false;	

	}else{
		
		frm.actiontype.value="send_mail";
		return true;
	
	}
}