// JavaScript Document
// validates that the entry is formatted as an email address
function isEMailAddr(elem) {
    var str = elem.value;
    var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
    if (!str.match(re)) {
        alert("Verify the email address format.");
		
		return false;
    } else {
        return true;
    }
}

// validates the if the email is the same
function isSameEmail(elem) {
	
	if(document.mail_form.email.value != document.mail_form.email2.value)
	{
		alert("Email did not match. Re-Type Email!");
		return false;
	} 
		return true;
    }
	
function genvalidate(form) {
		 if (isEMailAddr(form.email)) { // for confirm email
		  if (isEMailAddr(form.email2)) { // for confirm email
			if (isSameEmail(form.email2)) { // for confirm email
				return true;
				}
			}
		}
	return false;
}