var dateId = '';
var currId = 1;
var siteId = 3;
var language = 'en';
var urlRateTable = "/feedGuarantee_RateTable.php";

var balloon = new Balloon;
BalloonConfig(balloon,'GBubble');

function ajaxConnect(url, obj) {
    preLoad(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 preLoad(obj) {
    document.getElementById(obj).innerHTML = '<div align="center" style="width:100%; padding:80px 0;"><span class="txtred-16"><b><i>しばらくお待ち下さい。</i></b></span><img src="http://www.hotelthailand.com/images/shared/loading3x.gif" border="0" style="vertical-align:middle"><br><b class="txtblack-b12"><i>只今、検索中でございます。</i></b></div>';
}

	


function setUrlRateTable(language) {
    if (language == 'th')
        this.urlRateTable = "/feedGuarantee_RateTable_TH.php";
    else if (language == 'jp')
        this.urlRateTable = "/feedGuarantee_RateTable_JP.php";
    else
        this.urlRateTable = "/feedGuarantee_RateTable.php";
}


function ajaxRateTable(obj, dateId, currId) {
    setUrlRateTable(this.language);
    try {
		document.getElementById('tableGuaranteeRateBody').innerHTML  = '<div align="center" style="width:100%; padding:80px 0;"><span class="txtred-16"><b><i>Please Wait</i></b></span>					<img src="http://www.hotelthailand.com/images/shared/loading3x.gif" border="0" style="vertical-align:middle"><br><b class="txtblack-b12"><i>While we process your request...</i></b></div>';
		
        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 + "&language=" + this.language + "&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);
}

