function contact_form(frm_rec)
{
if (frm_rec.first_name.value=='')
	{
	alert("Please Enter Your First Name");
	frm_rec.first_name.focus();
	return false;
	}
if (frm_rec.last_name.value=='')
	{
	alert("Please Enter Your Last Name");
	frm_rec.last_name.focus();
	return false;
	}
if (IsNumeric(frm_rec.phone_no.value)==false)
	{
	//alert("Please enter phone no.");
	frm_rec.phone_no.select();
	frm_rec.phone_no.focus();
	return false;
	}
if (echeck(frm_rec.email_add.value)==false)
	{
	//alert("Please enter your email Id");
	frm_rec.email_add.select();
	frm_rec.email_add.focus();
	return false;
	}
/*if (frm_rec.address.value=='')
	{
	alert("Please enter your address please");
	frm_rec.address.focus();
	return false;
	}

if (frm_rec.state.value=='')
	{
	alert("Please enter your state");
	frm_rec.state.focus();
	return false;
	}
if (frm_rec.city.value=='')
	{
	alert("Please enter your city name");
	frm_rec.city.focus();
	return false;
	}
*/
if (frm_rec.country.value=='')
	{
	alert("Please enter your country name");
	frm_rec.country.focus();
	return false;
	}
	/*
if (frm_rec.zip.value=='')
	{
	alert("Please enter zip value");
	frm_rec.zip.focus();
	return false;
	}
	*/
}
function echeck(str) 
{

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str=='')
		{
		alert("Email Id should not be left blank");
		return false;
		}
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
}
function IsNumeric(strString)
   //  check for valid numeric strings	
{
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == '') 
   {
   alert("Phone no. should not be left blank")
   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)
         {
		 alert("Phone no. should be only numeric value")
         blnResult = false;
         }
      }
   return blnResult;
}

