function verifyReferAFriendForm()
{
    return_flag = false;
    entered_email = false;
    is_error = false;
    for (i=1; i <= 4; i++) {
        email_tag = document.getElementById('refer_email_' + i);
        check_value = 'email address #' + i;
        if (!isBlank(email_tag.value) && email_tag.value != check_value) {
            if (!checkemail(email_tag.value)) {
                alert("Please specify a valid email address!");
                email_tag.focus();
                is_error = true;
            } else {
                entered_email = true;
            }
        }
    }
    if (!is_error && !entered_email) {
        alert("No emails were entered. Please specify at least one email.");
    }
    image_code_tag = document.getElementById('image_code');
    if (!is_error && entered_email) {
        if (isBlank(image_code_tag.value)) {
            alert("Please enter Image Code.");
            image_code_tag.focus();
            return_flag = false;
            is_error = true;
            return false;
        }
    }
    if (!is_error && entered_email) {
        return_flag = true;
    }
    return return_flag;
}

function verifyContactForm()
{
    var tag=document.getElementById('contact_name');
    if ( isBlank(tag.value)) { alert("Please enter your name."); tag.focus(); return false; }
    tag=document.getElementById('contact_email');
    if ( isBlank(tag.value)) { alert("Please enter your E-mail address."); tag.focus(); return false; }
    tag=document.getElementById('contact_time');
    if ( isBlank(tag.value)) { alert("Please specify the best time to contact you."); tag.focus(); return false; }
    return true;
}

function verifyReciprocalForm()
{
    var tag=document.getElementById('owner_first_name');
    if ( isBlank(tag.value)) { alert("Please enter your First Name."); tag.focus(); return false; }
    tag=document.getElementById('owner_last_name');
    if ( isBlank(tag.value)) { alert("Please enter your Last Name."); tag.focus(); return false; }
    tag=document.getElementById('owner_email');
    if ( isBlank(tag.value)) { alert("Please enter your E-mail address."); tag.focus(); return false; }
    if (! checkemail(tag.value)) { alert(tag.value + " is not a valid E-mail address."); tag.focus(); return false; }

    tag=document.getElementById('site_title');
    if ( isBlank(tag.value)) { alert("Please enter your Site Title."); tag.focus(); return false; }
    tag=document.getElementById('link_url');
    if ( isBlank(tag.value)) { alert("Please enter your Site URL."); tag.focus(); return false; }
    if (! checkurl(tag.value)) { alert(tag.value + " is not a valid Site URL."); tag.focus(); return false; }
    tag=document.getElementById('reciprocal_url');
    if ( isBlank(tag.value)) { alert("Please enter Reciprocal URL."); tag.focus(); return false; }
    if (! checkurl(tag.value)) { alert(tag.value + " is not a valid URL (Reciprocal URL field)."); tag.focus(); return false; }
    return true;
}

function VerifyLoginForm()
{
    var tag=document.getElementById('member_email');
    if ( isBlank(tag.value)) { alert("Please enter you email address!"); tag.focus(); return false; }
    if ( !checkemail(tag.value)) { alert(tag.value + " is not a valid email address!"); tag.focus(); return false; }
    tag=document.getElementById('member_password');
    if ( isBlank(tag.value)) { alert("Please enter you password!"); tag.focus(); return false; }
    return true;
}
function VerifyForgotForm()
{
    var tag=document.getElementById('forgot_email');
    if ( isBlank(tag.value)) { alert("Please enter you email address!"); tag.focus(); return false; }
    if ( ! checkemail(tag.value)) { alert(tag.value + " is not a valid email address!"); tag.focus(); return false; }
    return true;
}

function VerifySignupForm()
{
    var tag=document.getElementById('member_email');
    if ( isBlank(tag.value)) { alert("Please enter your email address!"); tag.focus(); return false; }
    if ( !checkemail(tag.value)) { alert(tag.value + " is not a valid email address!"); tag.focus(); return false; }
    var tag1=document.getElementById('member_password1');
    var tag2=document.getElementById('member_password2');
    if(tag1.value != tag2.value) { alert("Passwords don't match!"); tag.focus(); return false; }
    if(isBlank(tag1.value)) { alert("Password cannot be blank!"); tag.focus(); return false; }
    return true;
}

function verifyRequestForm()
{
    var tag=document.getElementById('first_name');
    if (isBlank(tag.value)) { alert('Please enter your first name.'); tag.focus(); return false; }
    tag=document.getElementById('last_name');
    if (isBlank(tag.value)) { alert('Please enter your last name.'); tag.focus(); return false; }
    tag=document.getElementById('email');
    if (isBlank(tag.value)) { alert('Please enter your E-mail address.'); tag.focus(); return false; }
    if (!checkemail(tag.value)) { alert( tag.value + ' is not a valid email address.'); tag.focus(); return false; }
    return true;
}

function verifyRatesForm()
{
    var date_begin = document.getElementById('startdate').value;
    var date_end = document.getElementById('enddate').value;
    if (!checkdate2(date_begin)) { alert(date_begin+ ' is not a valid date value. Please use mm/dd/yy format.'); return false; }
    if (!checkdate2(date_end)) { alert(date_end + ' is not a valid date value. Please use mm/dd/yy format.'); return false; }
    if (!compare_dates_strong(date_begin, date_end)) { alert('Please select a valid reservation period! Begin date can not be later or equal the end date.'); return false;}
    return true;
}

function RatesFormdisallowADate(date)
{
    if ( date < low_limit_datea )  return true; else return false;
}

function show_availability_form()
{
    document.getElementById('availability_button').style.display = 'none';
    document.getElementById('availability_form').style.display = '';
}