function disallowBDateStatic(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() + 2);
        if ( date < limit_date )  return true; else return false;
    } else {
        if ( date < low_limit_dateb )  return true; else return false;
    }
}

function bookmark_link(title, url)
{
    if (window.sidebar) { // firefox
	   window.sidebar.addPanel(title, url, "");
    } else if(window.opera && window.print){ // opera
	   var elem = document.createElement('a');
	   elem.setAttribute('href',url);
	   elem.setAttribute('title',title);
	   elem.setAttribute('rel','sidebar');
	   elem.click();
    }
    else if(document.all) { // ie
	   window.external.AddFavorite(url, title);
    }
}

function write_bookmark_link (name, title, url)
{
    if (window.sidebar || (window.opera && window.print) || document.all) {
        document.write('<a href="javascript:;" onclick=' + "'javascript:bookmark_link(" + '"' + title + '","' + url + '"' + ")'>" + name + '</a>');
    }
}

function showDialogText(dialog_key)
{
    if (typeof popup_texts === 'undefined') {
        alert('popup_texts does not exist!');
    } else {
        if (typeof popup_texts[ dialog_key ] === 'undefined') {
            alert(dialog_key + ' does not exist!')
        } else {
            $('#modalDialog').html(popup_texts[ dialog_key ].html).dialog('option', 'title', popup_texts[ dialog_key ].title).dialog('open');
        }
    }
}

function update_reservation_prices_with_insurance(reservation_id, flag_tag)
{
    if (flag_tag.checked == true) {
        xajax_ajax_update_reservation_prices_with_insurance(reservation_id, 1);
    } else {
        xajax_ajax_update_reservation_prices_with_insurance(reservation_id, 0);
    }
}

function update_prereservation_prices_with_insurance(startdate, enddate, unit_id, occupants, occupants_small, flag_tag)
{
    if (flag_tag.checked == true) {
        xajax_ajax_update_prereservation_prices_with_insurance(startdate, enddate, unit_id, occupants, occupants_small, 1);
    } else {
        xajax_ajax_update_prereservation_prices_with_insurance(startdate, enddate, unit_id, occupants, occupants_small, 0);
    }
}
