function required_fields(formName) {
	
	var firstname = formName.firstname.value;
     if (firstname == "" || firstname==null) {  
	 	alert ("Please enter your First Name.");
		formName.firstname.focus();
		return false; 
	}

 	var friend_name = formName.friend_name.value;
     if (friend_name == "" || friend_name==null) {  
	 	alert ("Please enter your Friend's Name.");
		formName.friend_name.focus();
		return false; 
	}
            
     //  Will check for @, period after @ and text in between
    var addr = formName.friend_email.value;
    if (addr=="")  
       {  alert ("Please enter your email address.");
           formName.friend_email.focus();
           return false; }

    var in_space = addr.indexOf(" ");
    if (in_space != -1)
      { alert ("Email address should contain no spaces and be of the format jdoe\@aol.com");
           formName.friend_email.focus();
           return false;  }
    var len = addr.length;
    var alpha = addr.indexOf("@");
    var last_alpha = addr.lastIndexOf("@");

    if (alpha != last_alpha)
       {  alert ("Please check your email address, it should contain only one @ and be of the format jdoe\@aol.com");
           formName.friend_email.focus();
           return false; }

    // No @, in first position, or name too short
    if (alpha == -1 || alpha == 0 || len<6 )
       {  alert ("Please check your email address, it should contain an @ and be of the format jdoe\@aol.com");
           formName.friend_email.focus();
           return false; }

     var last_p = addr.lastIndexOf(".");
          // Be sure period at least two spaces after @, but not last char.
     if (last_p - alpha < 2 || last_p == (len - 1) )
        {  alert ("Please check your email address, it should contain a period after the @ and be of the format jdoe\@aol.com");
           formName.friend_email.focus();
            return false; }
            
     var message = formName.comments.value;
     if (message == "" || message==null) {  
	 	alert ("Please enter your message.");
		formName.comments.focus();
		return false; 
	}
}