function validateEmail(){
	
//Email Validation - start
	var email = window.document.frmContact.email.value;

	var invalid = ' /:,;'

    if (document.frmContact.email.value == '')
		return false;

	for(var i=0; i<invalid.length; i++)
	{
		var badChar = invalid.charAt(i)

		if (email.indexOf(badChar,0) != -1)
		{
			alert( 'The e-mail address you entered contains one or more invalid characters.' )
			return false;
		}
	}

	var atSignPos = email.indexOf('@',1)

	if (atSignPos == -1)
	{
		alert( 'The e-mail address you entered is missing its @ sign.' )
		return false;
	}
	else if (email.indexOf('@',atSignPos+1) != -1)
	{
		alert( 'The e-mail address you entered contains too many @ signs.' )
		return false;
	}

	var dotPos = email.indexOf('.',atSignPos+2)

	if (dotPos == -1)
	{
		alert( 'The e-mail address you entered is missing its extension.' )
		return false;
	}
	else if (dotPos+3 > email.length)
	{
		alert( 'The e-mail address you entered appears to use an invalid extension.' )
		return false;
	}
	// Validation - end

return true;
} 


<!-- JavaScript code to validate the form entry fields -----------------------------

function validate() {

    errorMsg = "";
    document.getElementById("f1").style.color = "black";
    document.getElementById("f2").style.color = "black";
    document.getElementById("f3").style.color = "black";
    document.getElementById("f4").innerHTML   = "";

    if (document.frmContact.cname.value == '') {                 //--- validate name
        document.getElementById("f1").style.color = "red";
        errorMsg = "yes";
    }

   if (validateEmail()==false) {                //--- validate email           
        document.getElementById("f2").style.color = "red";
        errorMsg = "yes";
    }
	
    if (document.frmContact.comments.value == '') {                //--- validate address           
        document.getElementById("f3").style.color = "red";
        errorMsg = "yes";
    }

    if (errorMsg != '') {                                   //--- if there are errors
        document.getElementById("f4").innerHTML = "Please correct highlighted fields";
	return(false);
    }
	
	register();
    return(true);
}

    