
//

// JavaScript Document

                                                         
function validEmail(email) 
{
	    var invalidChars;
		
		invalidChars = " /:,;\\";
	    //check to be sure it is not empty
		if (email.value == "") 
	             {
	                     messageString = messageString + "\n - You must enter your E-Mail @ddress.";
						 return false;
	             }
	    //check for invalid characters
		for (i=0; i<invalidChars.length; i++) //
	             {
	                     badChar = invalidChars.charAt(i);
	                     if (email.value.indexOf(badChar,0) != -1) 
	                     {
	                     	messageString = messageString + "\n - Your email address has invalid characters.";
						 return false;
	    				}
	             }
		
	    //be sure it contains the @ sign
		atPos = email.value.indexOf("@",1)
		if (atPos == -1) 
	             {
	                     messageString = messageString + "\n - Your e-Mail must contain the \"@\" symbol.";
						 return false;
	             }
		
		//there must be at least one character before the @ sign
	             if (email.value.indexOf("@",atPos+1) != -1) 
	             {
	                     messageString = messageString + "\n - There must be at least one character before the @ sign.";
						 return false;
	             }
	             
		
		periodPos = email.value.indexOf(".",atPos)
		
		//be sure there is at least one character between the "@" and the "."
		if (periodPos == atPos + 1) 
		{
		        messageString = messageString + "\n - You should have a character between the \"@\" and the \".\" ";
						 return false;
		}
		  
		//be sure there is a "." after the @ sign
	             if (periodPos == -1) 
	             {
	                     messageString = messageString + "\n - Your e-Mail must contain a period.";
						 return false;
	             }
	             
		//be sure there are at least 2 charcters after the "."
		if (periodPos+3 > email.value.length) 
	             {
	                     messageString = messageString + "\n - Your e-Mail must contain at least 2 charcters after the \".\".";
						 return false;
	             }	
		
	             return true;
}			
	
