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 notChecked( box ){
    if( box.checked ){
        return false;
    }
    else{
        return true;
    }
}

//it accepts "form" as parameter
function checkForm( form ){

    //lets check if Name text field is empty. This field has name "name".
    if( isEmpty( form.checkIn ) ){
        alert( 'Check In Date is required!' );
        return false;
    }

   if( isEmpty( form.checkOut ) ){
        alert( 'Check Out Date is required!' );
        return false;
    }
    
    return true;
}

