
function fastloading() { showbox('Tab1box');}
var locmap = new Array ( "Tab1box", "Tab2box", "Tab3box", "Tab4box", "Tab5box", "Tab6box"); /* add locations */
var javaloader = 0; // enable/disable java-loader


function showbox(sid){
var i,p;
	for (i=0; i < locmap.length; i++) {
		p = document.getElementById(locmap[i]);
		if (p) p.className = 'hidden guide_show_box'; 
	}
	p = document.getElementById(sid);
	if (p) p.className = 'shown guide_show_box'; 
	return false;

}

//-----------------------

// declare public variables
jsB 		= new Object() ;
jsB.init 	= false;
jsB.ajax  	= null; // for ...
jsB.toID	= null; // timeout object
//jsB.host	= "hno.th66.com";
 

jsB.cooView = 'historyHNO';
jsB.cooPara = 'paramsR24';
jsB.hno     = '0';
jsB.pv      = '63a';
jsB.region  = '';
jsB.loadgif = "<img src='imghotel/imgnearby/loading.gif'>";

var jsCoo	 = []; // paramsR24
jsCoo['cur'] = 'THB';	// currency
jsCoo['hno'] = '0';		// last HNO

// java startup code when page loaded and DOMload not fired
jsB.initpage = function() { 
	if (jsB.init) return false;
	jsB.init = true;
	//if (typeof onloading_guide== 'function') 	onloading_guide();	
	if (typeof onloading_landmark == 'function')onloading_landmark();
	if (typeof onloading_map== 'function') 		onloading_map();	
	if (typeof onloading_lists  == 'function') onloading_lists();
	return (jsB.init);
}

function getID(divID) {
    if( document.getElementById ) { //DOM; IE5, NS6, Mozilla, Opera
        return document.getElementById(divID); }
    if( document.all ) { //Proprietary DOM; IE4
        return document.all[divID]; }
    if( document.layers ) { //Netscape layers
        return document.layers[divID]; }
    if( document[divID] ) { //Netscape alternative
        return document[divID]; }
    return false;
}


jsB.map_showhide = function (show) {
	var p = document.getElementById('modlargemap');
	if (p) p.className = show ? 'shown':'hidden'; 
	var p = document.getElementById('gmap');
	if (p) p.className = show ? 'shown':'hidden'; 
	if (show) {
		p = document.getElementById('mapdistance');
		startGoogleMap (jsB.hno, p ? p.value : 1000); 
	}
	return false;
}

function ajaxObject(url, callbackFunction) {
  var that=this;      
  this.updating = false;
  this.abort = function() {
    if (that.updating) {
      that.updating=false;
      that.AJAX.abort();
      that.AJAX=null;
    }
  }
  this.update = function(passData,postMethod) { 
    if (that.updating) { return false; }
    that.AJAX = null;                          
    if (window.XMLHttpRequest) {              
      that.AJAX=new XMLHttpRequest();              
    } else {                                  
      that.AJAX=new ActiveXObject("Microsoft.XMLHTTP");
    }                                             
    if (that.AJAX==null) {                             
      return false;                               
    } else {
      that.AJAX.onreadystatechange = function() {  
		if (that.AJAX.readyState==4 || that.AJAX.readyState=="complete") {
          that.updating=false;                
          if (that.AJAX.status == 200) that.callback(that.AJAX.responseText, that.AJAX.responseXML, that.AJAX.status);        
          that.AJAX=null;                                         
        }                                                      
      }                                                        
      that.updating = new Date();                              
      if (/post/i.test(postMethod)) {
        var uri=urlCall+'?'+that.updating.getTime();
        that.AJAX.open("POST", uri, true);
        that.AJAX.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8");
        that.AJAX.setRequestHeader("Content-Length", passData.length);
        that.AJAX.send(passData);
      } else {
        var uri=urlCall+'?'+passData+'&timestamp='+(that.updating.getTime()); 
        that.AJAX.open("GET", uri, true);                             
        that.AJAX.send(null);                                         
      }              
      return true;                                             
    }                                                                           
  }
  var urlCall = url;        
  this.callback = callbackFunction || function () { };
}



var DomLoaded = {
	onload: [],
	loaded: function()
	{
		if (arguments.callee.done) return;
		arguments.callee.done = true;
		for (i = 0;i < DomLoaded.onload.length;i++) DomLoaded.onload[i]();
	},
	load: function(fireThis)
	{
		this.onload.push(fireThis);
		if (document.addEventListener) 
			document.addEventListener("DOMContentLoaded", DomLoaded.loaded, null);
		if (/KHTML|WebKit/i.test(navigator.userAgent))
		{ 
			var _timer = setInterval(function()
			{
				if (/loaded|complete/.test(document.readyState))
				{
					clearInterval(_timer);
					delete _timer;
					DomLoaded.loaded();
				}
			}, 10);
		}
	   window.onload = DomLoaded.loaded;
	}
};
window.onload =function() { jsB.initpage(); }
DomLoaded.load(function() { jsB.initpage(); });




function waitPreloadPage() { //DOM
	if (document.getElementById){
		document.getElementById('prepage').style.visibility='hidden';	}
	else{
		if (document.layers){ //NS4
		document.prepage.visibility = 'hidden';
		}
		else { //IE4
			document.all.prepage.style.visibility = 'hidden';
			}
	}
}










//----------------------------------------------------------------------------------------------------------------------------------------------


