// JavaScript Document
 
 
	
	 
function checkrequired(which) {
	 
	
    var pass=true;
   
    for (i=0;i<which.length;i++) {
	   
    var tempobj=which.elements[i];
    if (tempobj.className.indexOf('required') != -1) {
      if (((tempobj.type=="text"||tempobj.type=="textarea")&&
          tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
          tempobj.selectedIndex==0)) {
        pass=false;		 
        break;
      }
    }
  }
 /* if (!pass) {
    shortFieldName=tempobj.name.substring(8,30).toUpperCase();
    alert("The "+shortFieldName+" field is a required field.");
    return false;
  } */
  if (!pass) {
    shortFieldName=tempobj.name.toUpperCase();
    alert(shortFieldName + "   field is required  ");
	tempobj.focus();
    return false;
  } 
  
  if (!pass) {
    shortFieldName=tempobj.name.toUpperCase();
    errordiv.innerHTML = shortFieldName + "   field is required  ";
    return false;
  } 
  
 var str =document.getElementById("email").value; 
  if(!echeck(str))
   {
	   return false;
   }
     else {
  return true;
  }
 
  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){
	  errordiv.innerHTML="Invalid E-mail ID e=mail id is of the form myname@mydomain.com";
     // alert("Invalid E-mail ID  e-mail id is of the form  myname@mydomain.com") ;
     return false
  }


  if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
     errorDiv.innerHTML = "Invalid E-mail ID" ;
     return false
  }
  if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
       errorDiv.innerHTML = "Invalid E-mail ID" ;
      return false
  }
   if (str.indexOf(at,(lat+1))!=-1){
        errorDiv.innerHTML = "Invalid E-mail ID" ;
      return false
   }
   if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
        errorDiv.innerHTML = "Invalid E-mail ID" ;
      return false
   }
   if (str.indexOf(dot,(lat+2))==-1){
        errorDiv.innerHTML = "Invalid E-mail ID" ;
      return false
   }
   if (str.indexOf(" ")!=-1){
        errorDiv.innerHTML = "Invalid E-mail ID" ;
      return false
   }
   return true          
}



  
  
  
  
  
  

}

