function Trim(str) 
{
    return str.replace(/\s/g,"");
}
function IsBlank(obj, msgstr)
{
    if(Trim(obj.value)=="")
    {
        alert(msgstr);
        obj.focus();
        return false;
    }
    return true;
}
function IsEmail(obj, string, varmessage) 
{
    if(string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
        return true;
    else
	{
		alert(varmessage);
        obj.focus();
        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;
   }




function valid() {
if (!IsBlank(document.form1.title,"Please Enter Title")) return false;
if (!IsBlank(document.form1.contactname,"Please Enter Your Name")) return false;
if (!IsBlank(document.form1.lastname,"Please Enter Your Last Name")) return false;
if (!IsBlank (document.form1.tele_no, "Please Enter Your Telephone Number")) return false;
if (!IsNumeric(form1.tele_no.value)) 
   { 
      alert('Please Enter Valid Telephone Number') 
      form1.tele_no.focus(); 
      return false; 
      } 
if (!IsBlank(document.form1.mobile_no,"Please Enter Your Mobile Number")) return false;

if (!IsNumeric(form1.mobile_no.value)) 
   { 
      alert('Please Enter Valid Mobile Number') 
      form1.mobile_no.focus(); 
      return false; 
      } 

if (!IsEmail(document.form1.email, document.form1.email.value,"Please Enter a Valid Email")) return false;
if (!IsEmail(document.form1.email1, document.form1.email1.value,"Email does not match!")) return false;
if(document.form1.email1.value!=document.form1.email.value)
		{
			alert("Email does not match!");
			document.form1.email1.focus();
         return false;
		
		}
if (!IsBlank(document.form1.area_of_law,"Please Select Area of Law")) return false;
if (!IsBlank(document.form1.message_text,"Please Enter Message")) return false;

return true;

}
