    var RE_EMAIL = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/

    function isEmpty( str ) {   
        return ( ( str == null ) || ( str.length == 0 ) );
    }

    function lTrim( str ) {
        return str.replace( /^\s+/, '' );
    }

    function rTrim( str ) {
        return str.replace( /\s+$/, '' );
    }

    function trim( str ) {
        return rTrim( lTrim( str ) );
    }

    function isValidEmailAddress( str ) {
        return RE_EMAIL.test( trim( str ) );
    }

    function validateCreate() {
        if( isEmpty( trim( document.getElementById("email1").value ) ) ) {
	    alert( "Please enter your email address." );
	    return false;
        }
        if ( !isValidEmailAddress( trim( document.getElementById("email1").value ) ) ) {
	    alert( "There seems to be an error in your email address." );
	    return false;
        }
        if( isEmpty( trim( document.getElementById("password1").value ) ) ) {
	    alert( "Please enter your password." );
	    return false;
        }
        return true;
    }

    function validateAccess() {
        if( isEmpty( trim( document.getElementById("email2").value ) ) ) {
	    alert( "Please enter your email address." );
	    return false;
        }
        if ( !isValidEmailAddress( trim( document.getElementById("email2").value ) ) ) {
	    alert( "There seems to be an error in your email address." );
	    return false;
        }
        if( isEmpty( trim( document.getElementById("password2").value ) ) ) {
	    alert( "Please enter your password." );
	    return false;
        }
        return true;
    }

    function validateForget() {
        if( isEmpty( trim( document.getElementById("email3").value ) ) ) {
	    alert( "Please enter your email address." );
	    return false;
        }
        if ( !isValidEmailAddress( trim( document.getElementById("email3").value ) ) ) {
	    alert( "There seems to be an error in your email address." );
	    return false;
        }
        return true;
    }