function isEmail(strEMail) //validations for email
{
	var strInvalidChars,blnTemp,i,strTemp,intdot,IsMail,strEMailRev,intAtTheRate;
    intdot = strEMail.lastIndexOf(".");
	if (intdot == -1 )
		return false;
    
	intdot=strEMail.length-intdot-1;
	if (intdot < 2 )
		return false;
    
    // Disallowed characters
    strInvalidChars = "!#$%^&*()=+{}[]|\;:'/?>,< ";

	intAtTheRate = strEMail.indexOf("@") ;

    // Check that there is at least one '@' and a character before @
    if (intAtTheRate < 1)
		blnTemp=true;
	else
		blnTemp=false;

    if (blnTemp)
		return !blnTemp;
	
	// Check that there is at least one '.' in the form a@a.com
    blnTemp = (strEMail.indexOf(".") < 3);
   if (blnTemp)
		return !blnTemp;

	//   Check that there is at least one char between '.' and @ after @
	intdot= strEMail.indexOf(intAtTheRate+1,".");
	blnTemp = (intdot==2);
     if (blnTemp)
		return !blnTemp;

	//   Check that there is at least one char between '.' and @ before @
    blnTemp = (strEMail.substring(intAtTheRate - 1, intAtTheRate) == ".");
    if (blnTemp)
		return !blnTemp;

	//  and that the length is at least six (a@a.co)
    blnTemp = (strEMail.length < 6);
   if (blnTemp) 
		return !blnTemp;
	//  Check that there is only one '@'
    blnTemp = (intAtTheRate != strEMail.lastIndexOf("@"));
    
   if (blnTemp)
	return !blnTemp;
   //    extra checks
  //     AFTER '@' space is not allowed
	strTemp=strEMail.substring(intAtTheRate+1);
	blnTemp = (strTemp.indexOf(" ") > 0);
   if (blnTemp) 
		return !blnTemp;

  //   Check that there is one dot AFTER '@'
    blnTemp = (strTemp.indexOf(".") == 0);
   if (blnTemp)
		return !blnTemp;
    
	//    Check if there's a quote (")
    blnTemp = strEMail.indexOf("\"") > 0;
     if (blnTemp )
		return !blnTemp;
    
	//     Check if there's any other disallowed chars
	//     optimize a little if strEMail longer than strInvalidChars
	//     check the other way around
    if (strEMail.length > strInvalidChars.length)
	{
        for(var i = 0; i< strInvalidChars.length;i++)
		{
            if (strEMail.indexOf(strInvalidChars.substring(i,i+1)) > 0 )
                  blnTemp = true;
            if (blnTemp )
				break;
        } //end for
    } //end if
	else
	{
        for(var i = 0 ;i< strEMail.length;i++)
		{
            if (strInvalidChars.indexOf(strEMail.substring(i,i+1)) > 0) 
                  blnTemp = true;
            if (blnTemp )
				break;
        } //end for
    } //end else
    if (blnTemp)
		return !blnTemp;
    
	//     extra check
	 //    no two consecutive dots
    blnTemp = strEMail.indexOf("..") > 0;
    if (blnTemp)
		return !blnTemp;
    
	//    if any of the above are true, invalid e-mail
    return !blnTemp;

}<!-- 
