function echeck(str) {
  var at="@"
  var dot="."
  var lat=str.indexOf(at)
  var lstr=str.length
  var ldot=str.indexOf(dot)
  if (str.indexOf(at)==-1){
     alert("Invalid E-mail Address")
     return false
  }
  if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
     alert("Invalid E-mail Address")
     return false
  }
  if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
      alert("Invalid E-mail Address")
      return false
  }
   if (str.indexOf(at,(lat+1))!=-1){
      alert("Invalid E-mail Address")
      return false
   }
   if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
      alert("Invalid E-mail Address")
      return false
   }
   if (str.indexOf(dot,(lat+2))==-1){
      alert("Invalid E-mail Address")
      return false
   }
   if (str.indexOf(" ")!=-1){
      alert("Invalid E-mail Address")
      return false
   }
   return true          
}

function ValidatecrmForm(){
	
  var FN=document.crm.first_name
  var LN=document.crm.last_name	
  var street=document.crm.street
  var phone=document.crm.phone
  var mobile=document.crm.mobile
  var emailID=document.crm.email
  
    if ((FN.value==null)||(FN.value=="")){
    alert("Please enter your first name")
    FN.focus()
    return false
  }
  
    if ((LN.value==null)||(LN.value=="")){
    alert("Please enter your last name")
    LN.focus()
    return false
  }
  
 	    if ((street.value==null)||(street.value=="")){
    alert("Please enter your address")
    street.focus()
    return false
  }
  
      if ((phone.value==null)||(phone.value=="")){
    alert("Please enter your home phone")
    phone.focus()
    return false
  }
  
      if ((mobile.value==null)||(mobile.value=="")){
    alert("Please enter your mobile phone")
    mobile.focus()
    return false
  }
  
  
  
  if ((emailID.value==null)||(emailID.value=="")){
    alert("Please enter your email address")
    emailID.focus()
    return false
  }
  if (echeck(emailID.value)==false){
    emailID.value=""
    emailID.focus()
    return false
  }
  return true
 }
// End -->
