// JavaScript Document
/*[TopModuleTab]*/
function JLJS_TopModuleTab(){
	this.sidePane_ticket = null;
	this.sidePane_hotel = null;
	this.cookies = null;
	this.tab_airticket = null;
	this.tab_hotel = null;
	this.ticketLoadFlg = false;
	this.hotelLoadFlg = false;
	this.imgUrl = "/world/en/common/img/";
	this.langCode = null;
	this.tabImgText = null;
	this.countryCD = null;
}

JLJS_TopModuleTab.prototype = {
	init : function() {
		this.sidePane_ticket = document.getElementById("sidePane-airTicket"); 
		this.sidePane_hotel = document.getElementById("sidePane-hotel");
		this.tab_airticket = document.images["tab_airticket"];
		this.tab_hotel = document.images["tab_hotel"];		
		this.cookies = JLJS_CookieMgr.getCookie("moduleTab");	
		
		this.langCode = JLJS_countryObj.langCode;
		this.tabImgText = JLJS_countryObj.tabImgText;
		this.countryCD = JLJS_countryObj.countryCD;
		
		if(this.cookies){
			if(this.cookies == "hotel"){
				this.tabChange(1);
			}else if(this.cookies == "airticket"){
				this.tabChange(0);
			}
		}else{
			this.tabChange(0);
		}
		
	},

	tabChange : function( prmFlg ) {
		if(!this.sidePane_ticket && !this.sidePane_hotel){ return false; }
	 
		if( prmFlg == 1 ){	
			this.sidePane_ticket.style.display = "none";
			this.sidePane_hotel.style.display = "block";
			
			this.tab_hotel.src = this.imgUrl + "tab_sidepane_hotel_" + this.langCode + "_s.gif";
			this.tab_airticket.src = this.imgUrl + this.tabImgText + this.langCode + "_n.gif";
		 
			if(!this.hotelLoadFlg){
				JLJS_HM.topModuleSetup();
				this.hotelLoadFlg = true;
			}
		 
			JLJS_CookieMgr.setCookie("moduleTab", "hotel");
		 
		}else{
			this.sidePane_hotel.style.display = "none";
			this.sidePane_ticket.style.display = "block";
			
			this.tab_airticket.src = this.imgUrl + this.tabImgText + this.langCode + "_s.gif";
			this.tab_hotel.src = this.imgUrl + "tab_sidepane_hotel_" + this.langCode + "_n.gif";
		 
			if(!this.ticketLoadFlg){
				JLJS_countryObj.ticketModuleSetUp(this.countryCD);
				this.ticketLoadFlg = true;
			}
		 
			JLJS_CookieMgr.setCookie("moduleTab", "airticket");
		}
	},
	
	tabImgOn : function( flg ) {
		if(!this.sidePane_ticket && !this.sidePane_hotel){ return false; }
		
		if(flg == 1){
			if(this.sidePane_ticket.style.display == "none"){
			 this.tab_airticket.src = this.imgUrl + this.tabImgText + this.langCode + "_o.gif";
			}
		}
		
		if(flg == 2){
			if(this.sidePane_hotel.style.display == "none"){
				 this.tab_hotel.src = this.imgUrl + "tab_sidepane_hotel_" + this.langCode + "_o.gif";
			}
		}
	},
	
	tabImgOff : function() {
		if(!this.sidePane_ticket && !this.sidePane_hotel){ return false; }
		
		if(this.sidePane_ticket.style.display == "none"){
			 this.tab_airticket.src = this.imgUrl + this.tabImgText + this.langCode + "_n.gif";
	  }else{
			this.tab_hotel.src = this.imgUrl + "tab_sidepane_hotel_" + this.langCode + "_n.gif";
	  }
	}
}

var JLJS_hotelTab = new JLJS_TopModuleTab();
/*[/TopModuleTab]*/