function popUp(URL) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=660,left = 0,top = 0');");
}
function popWin(URL, width, height) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=" + width + ",height=" + height + ",left = 0,top = 0');");
}
function setCellColor(theCell, thePointerColor)
{
    if (thePointerColor == '' || typeof(theCell.style) == 'undefined') {
	   return false;
	}
    theCell.style.backgroundColor = thePointerColor;
    return true;
}

function verifyVRLoginForm()
{
    return_flag = true;
    tag = document.getElementById('form_email2');
    if (isBlank(tag.value) || tag.value == 'email address') {
        alert("Please specify a valid email address!");
        tag.focus();
        return_flag = false;
    }
    if (((!isBlank(tag.value) && !checkemail(tag.value)) || tag.value == 'email address') && return_flag) {
        alert("Please specify a valid email address!");
        tag.focus();
        return_flag = false;
    }
    tag = document.getElementById('form_passwd');
    if ((isBlank(tag.value) || tag.value == '******') && return_flag ) {
        alert("Please specify a your password!");
        tag.focus();
        return_flag = false;
    }
    return return_flag;
}

function iq_disallowADate(date)
{
    if ( date < iq_low_limit_datea )  return true; else return false;
}

function iq_AdateChanged(calendar)
{
    if (calendar.dateClicked) {
        var iq_enddate_tag=document.getElementById('iq_enddate');
        // OK, a date was clicked, setup the end date
        var iq_enddate=new Date(calendar.date.getFullYear(), calendar.date.getMonth(), calendar.date.getDate() +2 );
        iq_enddate_tag.value = iq_enddate.print("%m/%d/%Y");
    }
}

function iq_disallowBDate(date)
{
    var iq_startdate_tag=document.getElementById('iq_startdate');
    var filter=/^\d{1,2}\/\d{1,2}\/\d{2,4}$/;
    if ( filter.test(iq_startdate_tag.value)) {
        var iq_limit_date=Date.parseDate(iq_startdate_tag.value, "%m/%d/%Y");
        iq_limit_date.setDate(iq_limit_date.getDate() + 2);
        if ( date < iq_limit_date )  return true; else return false;
    } else {
        if ( date < iq_low_limit_dateb )  return true; else return false;
    }
}

function verifycellphonesForm()
{
    var tag=document.getElementById('contact_firstname');
    if (isBlank(tag.value)) {
        alert('Please specify a First Name!'); tag.focus(); return false;
    }
    var tag=document.getElementById('contact_lastname');
    if (isBlank(tag.value)) {
        alert('Please specify a Last Name!'); tag.focus(); return false;
    }
    var tag=document.getElementById('contact_email');
    if (!checkemail(tag.value)) {
      alert(tag.value + ' is not a valid email address!'); tag.focus(); return false;
    }
    var tag=document.getElementById('contact_phone');
    if (isBlank(tag.value)) {
        alert('Please specify a Daytime Phone number!'); tag.focus(); return false;
    }
    var tag=document.getElementById('contact_departure_date');
    if (isBlank(tag.value)) {
        alert('Please specify a Departure Date!'); tag.focus(); return false;
    }
    if (!checkdate2(tag.value)) { alert(tag.value + ' is not a valid date value. Please use mm/dd/yyyy format.'); document.getElementById('contact_departure_date').focus(); return false; }
    return true;
}

function verifyChangePasswdForm()
{
    regex = /^[a-zA-Z0-9]+$/;
    return_flag = true;
    current_passwd_tag = document.getElementById('form_current_passwd');
    new_passwd_tag = document.getElementById('form_new_passwd');
    retype_passwd_tag = document.getElementById('form_retype_passwd');
    if (isBlank(current_passwd_tag.value)) {
        alert("Please specify a Current Password!");
        current_passwd_tag.focus();
        return_flag = false;
    }
    if (isBlank(new_passwd_tag.value) && return_flag) {
        alert("Please specify a New Password!");
        new_passwd_tag.focus();
        return_flag = false;
    }
    if (!isBlank(new_passwd_tag.value) && return_flag && !regex.test(new_passwd_tag.value)) {
        alert("Wrong symbols in the New Password!");
        new_passwd_tag.focus();
        return_flag = false;
    }
    if (isBlank(retype_passwd_tag.value) && return_flag) {
        alert("Please specify a Verify New Password!");
        retype_passwd_tag.focus();
        return_flag = false;
    }
    if (!isBlank(retype_passwd_tag.value) && return_flag && !regex.test(retype_passwd_tag.value)) {
        alert("Wrong symbols in the Verify New Password!");
        retype_passwd_tag.focus();
        return_flag = false;
    }
    if (!isBlank(new_passwd_tag.value) && !isBlank(retype_passwd_tag.value) && new_passwd_tag.value != retype_passwd_tag.value && return_flag) {
        alert("Passwords mismatch!");
        retype_passwd_tag.focus();
        return_flag = false;
    }
    return return_flag;
}

function verifyCreateAccountLoginForm()
{
    return_flag = true;
    tag = document.getElementById('form_first_name');
    if (isBlank(tag.value) && return_flag) {
        alert("Please specify a first name!");
        tag.focus();
        return_flag = false;
    }
    tag = document.getElementById('form_last_name');
    if (isBlank(tag.value) && return_flag) {
        alert("Please specify a last name!");
        tag.focus();
        return_flag = false;
    }
    tag = document.getElementById('form_email');
    if (isBlank(tag.value) && return_flag) {
        alert("Please specify a valid email address!");
        tag.focus();
        return_flag = false;
    }
    if (!isBlank(tag.value) && !checkemail(tag.value) && return_flag) {
        alert("Please specify a valid email address!");
        tag.focus();
        return_flag = false;
    }
    return return_flag;
}

function verifyForgotPasswordForm()
{
    return_flag = true;
    tag = document.getElementById('form_first_name');
    if (isBlank(tag.value) && return_flag) {
        alert("Please specify a first name!");
        tag.focus();
        return_flag = false;
    }
    tag = document.getElementById('form_last_name');
    if (isBlank(tag.value) && return_flag) {
        alert("Please specify a last name!");
        tag.focus();
        return_flag = false;
    }
    tag = document.getElementById('form_email');
    if (isBlank(tag.value) && return_flag) {
        alert("Please specify a valid email address!");
        tag.focus();
        return_flag = false;
    }
    if (!isBlank(tag.value) && !checkemail(tag.value) && return_flag) {
        alert("Please specify a valid email address!");
        tag.focus();
        return_flag = false;
    }
    return return_flag;
}

function ClickItCompare()
{
    var PropIds = '';
    var boxes = document.frmProp.PropIDCompare;
    var iCount = 0;

    for (i = 0; i < boxes.length; i++) {
        if (boxes[i].checked == true) {
            PropIds = PropIds + boxes[i].value + ',';
            iCount ++;
        }
    }
	/*** check to see how many were checked ***/
    if (iCount > 4) {
        alert('You have selected too many properties to compare. Please select up to 4.');
        return false;
    } else if (iCount == 1) {
        alert('Please select at least 2 properties to compare.');
        return false;
    }
	PropIds = PropIds.substring(0, PropIds.length - 1);
    if (PropIds == 0) {
        alert('No properties were selected. Please select at least 2 properties.');
    } else {
        PopUpCompare('compare_properties.html?PropIds=' + PropIds);
    }
    return false;
}
function PopUpCompare(url)
{
    remote = window.open(url , "compare", 'align=center,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no');
    if (remote.opener == null) {
        remote.opener = window;
        remote.opener.name = "main";
    }
}

function homes_disallowBDate(date)
{
    var startdate_tag=document.getElementById('startdate');
    var filter=/^\d{1,2}\/\d{1,2}\/\d{2,4}$/;
    if ( filter.test(startdate_tag.value)) {
      var limit_date=Date.parseDate(startdate_tag.value, "%m/%d/%Y");
      limit_date.setDate(limit_date.getDate() + 1);
      if ( date < limit_date )  return true; else return false;
    } else {
      if ( date < homes_low_limit_dateb )  return true; else return false;
    }
}

function homes_disallowADate(date)
{
    if ( date < homes_low_limit_datea )  return true; else return false;
}

function homes_AdateChanged(calendar)
{
    if (calendar.dateClicked) {
        var enddate_tag=document.getElementById('enddate');
        // OK, a date was clicked, setup the end date
        var enddate=new Date(calendar.date.getFullYear(), calendar.date.getMonth(), calendar.date.getDate() + 1 );
        enddate_tag.value = enddate.print("%m/%d/%Y");
    }
}

function iq_disallowADate(date)
{
    if ( date < iq_low_limit_datea )  return true; else return false;
}

function iq_AdateChanged(calendar)
{
    if (calendar.dateClicked) {
        var iq_enddate_tag=document.getElementById('iq_enddate');
        // OK, a date was clicked, setup the end date
        var iq_enddate=new Date(calendar.date.getFullYear(), calendar.date.getMonth(), calendar.date.getDate() +2 );
        iq_enddate_tag.value = iq_enddate.print("%m/%d/%Y");
    }
}

function iq_disallowBDate(date)
{
    var iq_startdate_tag=document.getElementById('iq_startdate');
    var filter=/^\d{1,2}\/\d{1,2}\/\d{2,4}$/;
    if ( filter.test(iq_startdate_tag.value)) {
        var iq_limit_date=Date.parseDate(iq_startdate_tag.value, "%m/%d/%Y");
        iq_limit_date.setDate(iq_limit_date.getDate() + 2);
        if ( date < iq_limit_date )  return true; else return false;
    } else {
        if ( date < iq_low_limit_dateb )  return true; else return false;
    }
}

function verifyInventorForm()
{
    var tag=document.getElementById('contact_firstname');
    if (isBlank(tag.value)) {
        alert('Please specify a First Name!'); tag.focus(); return false;
    }
    var tag=document.getElementById('contact_lastname');
    if (isBlank(tag.value)) {
        alert('Please specify a Last Name!'); tag.focus(); return false;
    }
    var tag=document.getElementById('contact_email');
    if (!checkemail(tag.value)) {
      alert(tag.value + ' is not a valid email address!'); tag.focus(); return false;
    }
    var tag=document.getElementById('contact_phone');
    if (isBlank(tag.value)) {
        alert('Please specify a Phone number!'); tag.focus(); return false;
    }
    return true;
}

function verifyOnlineRequestsForm()
{
    var tag=document.getElementById('contact_first_name');
    if (isBlank(tag.value)) {
        alert('Please specify a First Name!'); tag.focus(); return false;
    }
    var tag=document.getElementById('contact_last_name');
    if (isBlank(tag.value)) {
        alert('Please specify a Last Name!'); tag.focus(); return false;
    }
    var tag=document.getElementById('contact_email');
    if (!checkemail(tag.value)) {
      alert(tag.value + ' is not a valid email address!'); tag.focus(); return false;
    }
    var tag=document.getElementById('message');
    if (isBlank(tag.value)) {
        alert('Please specify a Message!'); tag.focus(); return false;
    }
    var tag = document.getElementById('secret_code');
	if (isBlank(tag.value)) {
	    alert("Please enter verification code."); tag.focus(); return false;
	}
    return true;
}

function verifyNewsletterSubscribe2()
{
    return_flag = true;
    tag = document.getElementById('newsletter_email2');
    if (isBlank(tag.value) || tag.value == 'email address') {
        alert("Please specify a valid email address!");
        tag.focus();
        return_flag = false;
    }
    if (((!isBlank(tag.value) && !checkemail(tag.value)) || tag.value == 'email address') && return_flag) {
        alert("Please specify a valid email address!");
        tag.focus();
        return_flag = false;
    }
    return return_flag;
}

function verifyRealEstateForm()
{
    var tag=document.getElementById('contact_firstname');
    if (isBlank(tag.value)) {
        alert('Please specify a First Name!'); tag.focus(); return false;
    }
    var tag=document.getElementById('contact_lastname');
    if (isBlank(tag.value)) {
        alert('Please specify a Last Name!'); tag.focus(); return false;
    }
    var tag=document.getElementById('contact_email');
    if (!checkemail(tag.value)) {
      alert(tag.value + ' is not a valid email address!'); tag.focus(); return false;
    }
    var tag=document.getElementById('contact_phone');
    if (isBlank(tag.value)) {
        alert('Please specify a Daytime Phone number!'); tag.focus(); return false;
    }
    return true;
}

function verifyUnsubLoginForm()
{
    var tag=document.getElementById('une');
    if ( isBlank(tag.value) ) {
        alert('Please enter your E-mail address !'); tag.focus(); return false;
    }
    return true;
}

function verifyComplexUnsubLoginForm()
{
    var tag=document.getElementById('une');
    if ( isBlank(tag.value) ) {
        alert('Please enter your E-mail address !'); tag.focus(); return false;
    }
    return true;
}

function verifyVotingForm()
{
    var tag=document.getElementById('voting_answer_1');
    var tag2=document.getElementById('voting_answer_2');
    if(tag.checked == false && tag2.checked == false) {
        alert('Please select an answer!'); return false;
    }
    return true;
}

function verifyWeddingsForm()
{
    var tag=document.getElementById('contact_firstname');
    if (isBlank(tag.value)) {
        alert('Please specify a First Name!'); tag.focus(); return false;
    }
    var tag=document.getElementById('contact_lastname');
    if (isBlank(tag.value)) {
        alert('Please specify a Last Name!'); tag.focus(); return false;
    }
    var tag=document.getElementById('contact_email');
    if (!checkemail(tag.value)) {
      alert(tag.value + ' is not a valid email address!'); tag.focus(); return false;
    }
    var tag=document.getElementById('contact_phone');
    if (isBlank(tag.value)) {
        alert('Please specify a Daytime Phone number!'); tag.focus(); return false;
    }
    var tag = document.getElementById('secret_code');
	if (isBlank(tag.value)) {
	    alert("Please enter verification code."); tag.focus(); return false;
	}
    return true;
}

function show_floor_plan(URL, width, height)
{
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=" + width + ",height=" + height + ",left = 0,top = 0');");
}

function display_news_comment(boxid)
{
    if(document.getElementById(boxid).style.display=='block') { document.getElementById(boxid).style.display = 'none'; }
    else { document.getElementById(boxid).style.display = 'block'; }
}
function verifyAddNewsCommentForm()
{
	var tag = document.getElementById('name');
	if (isBlank(tag.value)) { alert("Please specify a Your Name."); tag.focus(); return false; }
	var tag = document.getElementById('comment_text');
	if (isBlank(tag.value)) { alert("Please specify a Your Comment."); tag.focus(); return false; }
	var tag = document.getElementById('secret_code');
	if (isBlank(tag.value)) { alert("Please enter verification code."); tag.focus(); return false; }
	return true;
}

function random_banner() {
}
