function validcontact(frm)
{ 
with(frm)
	{
		if (validate_required(name,"Please enter your name")==false)
		{name.focus();return false;}
	/*	if (validate_required(company,"Please enter your company name")==false)
		{company.focus();return false;}
		if (validate_required(address,"Please enter your address")==false)
		{address.focus();return false;}
		if (validate_required(city,"Please enter your city")==false)
		{city.focus();return false;}
		if (validate_required(state,"Please enter your state")==false)
		{state.focus();return false;}
		
		if (validate_required(zip,"Please enter your zip")==false)
		{zip.focus();return false;}
			if(IsNumeric(zip.value)==false)
			{
				alert("Please enter numbers only");
				zip.value="";
				zip.focus();
				return false;
			}
		if (validate_required(phone,"Please enter your phone")==false)
		{phone.focus();return false;}
			if(IsNumeric(phone.value)==false)
			{
				alert("Please enter numbers only");
				phone.value="";
				phone.focus();
				return false;
			}*/
		
			if(validate_email(email)==false)
		{
			email.value="";
			email.focus();return false;
		}
	/*	 if (Advertising.checked==false && Branding.checked==false && Graphic.checked==false && Illustration.checked==false && CopyWriting.checked==false && Entertainment.checked==false && Broadcast.checked==false && Other.checked==false )
	    { 
		alert("Please select the area of interest");
		return false;
		}
		if (validate_required(comment,"Please enter your comment")==false)
		{comment.focus();return false;}
	*/
		
	}
		
	return true;
}








function validate_required(field,alerttxt)
{
	if(field.value==null || field.value=="")
	  {
			alert(alerttxt);
			return false;
	  }
	else
	 {
		return true;
	 }
}




//Email validation

function validate_email(field)
{

	if (field.value==null||field.value=="")
	{
		alert("Please enter email address");
		return false;
	}
	else
	{
			apos=field.value.indexOf("@");
			dotpos=field.value.lastIndexOf(".");
			if (apos<1||dotpos-apos<2) 
			 {
			  alert("Invalid Email");
			  return false;
			  }
			else 
			{
				return true;
			}
	}
	return true;
}

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 clearvalue()
   {
	 document.form.name.value="";
	 document.form.phone.value="";
	 document.form.etype.value="";
	 document.form.elocation.value="";
	 document.form.email.value="";
	 document.form.subject.value="";
	 document.form.message.value="";
     document.form.name.focus();
    }
