var dateId = '';
var currId = 1;
var siteId = 5;
var urlRateTable = "/feedGuarantee_RateTable.cfm";
var urlKTClogo = "/feedKTC_logo.cfm";

var balloon    = new Balloon;
BalloonConfig(balloon,'GBubble');

function ajaxConnect(url, obj) {
    var xmlhttp;
    if (window.XMLHttpRequest) {
        xmlhttp=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } else {
        alert("Your browser does not support XMLHTTP!");
    }
    xmlhttp.onreadystatechange = function() {
        if(xmlhttp.readyState == 4) {
            document.getElementById(obj).innerHTML  = xmlhttp.responseText;
        }
    }
    xmlhttp.open("POST", url, true);
    xmlhttp.send(null);
}

function ajaxKTClogo(obj) {
    var url = this.urlKTClogo + "?hotelId=" + this.hotelId + "&noerror=true";
    ajaxConnect(url, obj);
}

function ajaxRateTable(obj, dateId, currId) {
    try {
        document.getElementById('tableGuaranteeRateBody').className = 'tbchkroom-disabled';
    } catch(err) {}
    var url = this.urlRateTable + "?object=" + obj + "&hotelId=" + this.hotelId + "&siteId=" + this.siteId + "&currId=" + this.currId + "&dateId=" + this.dateId + "&noerror=true";
    ajaxConnect(url, obj);
}

function prevWeek(dateId) {
    this.dateId = dateId;
    ajaxRateTable('tableGuaranteeRate', dateId, this.currId);
}
    
function nextWeek(dateId) {
    this.dateId = dateId;
    ajaxRateTable('tableGuaranteeRate', dateId, this.currId);
}

function changeCurrency(currId) {
    this.currId = currId;
    ajaxRateTable('tableGuaranteeRate', this.dateId, this.currId);
}
