

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( 'Your name is required' );
        return false;
    }
        if( notValidEmail( form.email ) ){
        alert( 'Write your email' );
        return false;

    }

     if( isEmpty( form.subject ) ){
        alert( 'Ypur phone number is required' );
        return false;
    }
  
else{
    return true;
}
}

