function isEmpty( str){
    strRE = new RegExp( );
    strRE.compile( '^[\s ]*$', 'gi' );
    return strRE.test( str.value );
}

function notValidEmail( str ){
    mailRE = new RegExp( );
    mailRE.compile( '^[\._a-z0-9-]+@[\.a-z0-9-]+[\.]{1}[a-z]{2,4}$', 'gi' );
    return !(mailRE.test( str.value ));
}

function checkForm( form ){

    if( isEmpty( form.name ) ){
        alert( 'enter your name' );
        return false;
    }

    if( isEmpty( form.message ) ){
        alert( 'enter message!' );
        return false;
    }

    if( notValidEmail( form.email ) ){
        alert( 'enter a valid email address' );
        return false;
    }
else{
    return true;
}
}
