﻿
//////////////////////////////////////////////////////////////////
/// Image rollover
//////////////////////////////////////////////////////////////////
function imgRoll(obj,flag){
	var pathsrc=obj.getAttribute("src");
	var path=pathsrc.slice(0,pathsrc.lastIndexOf("/")+1);
	var imgname=pathsrc.slice(pathsrc.lastIndexOf("/")+1,pathsrc.length);
	if(flag){
		imgname=imgname.replace(/_def/i,"_cur");
	} else{
		imgname=imgname.replace(/_cur/i,"_def");
	}
	obj.setAttribute("src",path+imgname);
}
function imgRollId(obj,flag){
	var pathsrc=document.getElementById(obj).getAttribute("src");
	var path=pathsrc.slice(0,pathsrc.lastIndexOf("/")+1);
	var imgname=pathsrc.slice(pathsrc.lastIndexOf("/")+1,pathsrc.length);
	if(flag){
		imgname=imgname.replace(/_def/i,"_cur");
	} else{
		imgname=imgname.replace(/_cur/i,"_def");
	}
	document.getElementById(obj).setAttribute("src",path+imgname);
}



//////////////////////////////////////////////////////////////////
/// Window open
//////////////////////////////////////////////////////////////////
// 汎用
function openSubWindow(strUrl,winName,winWidth,winHeight){
	var features='toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width='+winWidth+',height='+winHeight;
	winName=window.open(strUrl,winName,features);
	winName.focus();
	return false;
}



//////////////////////////////////////////////////////////////////
/// 汎用id表示切り替え
//////////////////////////////////////////////////////////////////
function switchBlock(id,vl){
	var elm=document.getElementById(id);
	elm.style.display=vl;
}
function switchZindex(id,vl){
	var elm=document.getElementById(id);
	elm.style.zIndex=vl;
}
function switchClass(id,vl){
	var elm=document.getElementById(id);
	elm.className=vl;
}
function switchBgImg(id,vl){
	var elm=document.getElementById(id);
	elm.style.backgroundImage="url("+vl+")";
}
var dispBlk=function(id,src){
	var idBlk=document.getElementById(id);
	idBlk.innerHTML=src;
}


//////////////////////////////////////////////////////////////////
/// フォーム使用開始操作
//////////////////////////////////////////////////////////////////
function startText(elms){
	var formVl=elms.parentNode;
	var formNm=formVl.getAttribute("name");
	var vlText=document.forms[formNm].elements[0].value;
	if(vlText=="商品名・キーワード") document.forms[formNm].elements[0].value="";
}


////////////////////////////////////////////////////////////////////////////////
/// クッキー操作
////////////////////////////////////////////////////////////////////////////////

var getCookie=function(key){
	key = strCookiePre+key;
	var i,index,arr;
	arr=document.cookie.split(";");
	for(var i=0;i<arr.length;i++){
		index=arr[i].indexOf("=");
		if(arr[i].substring(0,index)==key||arr[i].substring(0,index)==" "+key) return unescape(arr[i].substring(index+1));
	}
	return "";
}
var setCookie=function(key,value,expire){
	key = strCookiePre+key;
	document.cookie=key+"="+value+";path=/;expires="+expire;
}
var setCookiePre=function(key,value,cookie_period){
	expire=new Date();
	previsit=expire.toGMTString();
	expire.setTime(expire.getTime()+cookie_period*60*60*1000);
	expire=expire.toGMTString();
	setCookie(key,value,expire);
}



//////////////////////////////////////////////////////////////////
/// unescape sub function
//////////////////////////////////////////////////////////////////
var docUsc=function(obj){
	if(obj!="") document.write(unescape(obj));
}



//////////////////////////////////////////////////////////////////
/// 価格数値カンマ制御
//////////////////////////////////////////////////////////////////

var commaDelim=function(str){
	while(str.match(/\s/)){
		str=str.replace(/\s/,"");
	}
	if(str.length>3&&str.indexOf(",")==-1){
		var oriStr=str;
		var num=Math.floor(str.length/3);
		var measure=str.length/3-Math.floor(str.length/3);
		measure=Math.floor(measure*10);
		measure=measure/3;
		str="";
		if(measure>0) str=oriStr.slice(0,measure);
		for(var i=0;i<(num);i++){
			if(str!="") str+=",";
			str+=oriStr.slice(measure+i*3,measure+(i+1)*3);
		}
	}
	return str;
}



//////////////////////////////////////////////////////////////////
/// マウスカーソルフォーカス処理
//////////////////////////////////////////////////////////////////
/*
マウスカーソルフォーカス時に文字列例削除
------------------------------------------------------------*/
function delStrignAtFocus(obj,strInputExample){
	if(obj.className=='textBox'&&obj.value==strInputExample){
		obj.value='';
		obj.className='textBoxOn';
	}
}

/*
マウスカーソルアウト時に文字列例復帰
------------------------------------------------------------*/
function checkStrignAtBlur(obj,strInputExample){
	if(obj.value==''){
		obj.className='textBox';
		obj.value=strInputExample;
	}
}

function checkStringAtReturn(strInputExample){
	 var onload_event = window.onload;

	window.onload = function(){
		if (typeof onload_event == "function") {
			onload_event();
		} else {
			if (onload_event) {
				eval(onload_event);
			}
		}
		var obj = document.forms['0'].elements['q'];
		if(obj.value != strInputExample && obj.value != ''){
			obj.className='textBoxOn';
		}else if(obj.value == ''){
			obj.value = strInputExample;
			obj.className='textBox';
		}
	}
}

function cutStringAtSearch(strInputExample){
	var obj = document.forms['0'].elements['q'];
	if(obj.value == strInputExample){
		obj.value='';
	}
}



//////////////////////////////////////////////////////////////////
/// グローバルナビカレント処理
//////////////////////////////////////////////////////////////////

var setGNCur=function(vl){
	var idGN=document.getElementById("GLOBAL_NAVI");
	tnLi=idGN.getElementsByTagName("li");
	if(tnLi[vl-1].firstChild){
		if(document.all) tnLi[vl-1].firstChild.className="cur";
		else tnLi[vl-1].firstChild.setAttribute("class","cur");
	}
}



//////////////////////////////////////////////////////////////////
/// リンク動作抑止
//////////////////////////////////////////////////////////////////

var evtCncl=function(event){
	if(!event){
		event=window.event;
	}
	if(event.preventDefault){
		event.preventDefault();
	}else{
		event.returnValue=false;
	}
}



//////////////////////////////////////////////////////////////////
/// 10の位「0」追加
//////////////////////////////////////////////////////////////////

var plusZero=function(vl){
	vl=((vl+"").length==1)?"0"+(vl+""):(vl+"");
	return vl;
}



//////////////////////////////////////////////////////////////////
/// 英単語強制分割
//////////////////////////////////////////////////////////////////

var forceBreak=function(vl,byte){
	vlPart=vl.split(" ");
	for(var i=0;i<vlPart.length;i++){
		var lenVl=vlPart[i].length;
		var countVl=lenVl/byte;
		if(countVl>1){
			var vlPartNew=vlPart[i].slice(0,byte);
			for(var j=0;j<Math.floor(countVl);j++){
				vlPartNew+=(j!=Math.floor(countVl))?" "+vlPart[i].slice(byte*(j+1),byte*(j+2)):" "+vlPart[i].slice(byte*(j+1),lenVl);
			}
			vlPart[i]=vlPartNew;
		}
		vl=(i>0)?vl+" "+vlPart[i]:vlPart[i];
	}
	return vl;
}



//////////////////////////////////////////////////////////////////
/// float box
//////////////////////////////////////////////////////////////////

var block_cont="FLOAT_CONTENT";
var block_base="FLOAT_BASE";
var block_img="FLOAT_CONTENT_IMG";
var dispFloat=function(event,src){
	evtCncl(event);
	if(src!=""){
		var cEDiv=document.createElement("div");
		cEDiv.setAttribute("id",block_cont);
		var cEImg=document.createElement("img");
		cEImg.setAttribute("id",block_img);
		cEImg.setAttribute("src",src);
		cEDiv.appendChild(cEImg);
		var cEDiv02=document.createElement("div");
		cEDiv02.innerHTML='<p class="taCenter mt8"><a href="javascript:void(0);" onclick="deleteFloat();" class="close">'+textSet_search[5]+'</a></p>';
		cEDiv.appendChild(cEDiv02);
		document.body.appendChild(cEDiv);
		$('#'+block_cont).show();
		setTimeout(function(){
			var iW=document.getElementById(block_cont).firstChild.width;
			var iH=document.getElementById(block_cont).firstChild.height;
			$('#'+block_cont).hide();
			floatOvrCord(block_cont,iW,iH);
			$('#'+block_cont).fadeIn(400);
		},300);
		setTimeout(function(){
			var cEBaseA=document.createElement("a");
			document.body.appendChild(cEBaseA);
			cEBaseA.setAttribute("id",block_base);
			cEBaseA.setAttribute("href","javascript:deleteFloat();");
			cEBaseA.setAttribute("onclick","deleteFloat();");
			floatBgSize(block_base);
		},300);

		searchSel("none");
	}
	window.onresize=function(){
		floatBgSize(block_base);
		floatOvrCord(block_cont,iW,iH);
	}
}

/*
オブジェクトクローズ
------------------------------------------------------------*/
var deleteFloat=function(){
	if(document.getElementById(block_base)) document.body.removeChild(document.getElementById(block_base));
	if(document.getElementById(block_cont)) document.body.removeChild(document.getElementById(block_cont));
	searchSel("inline");
}

/*
フロートオブジェクトサイズ
------------------------------------------------------------*/
var floatOvrCord=function(idCont,w,h){
	var idTOv=document.getElementById(idCont);
	var bdWidth=dBody().clientWidth;
  if(document.all&&!window.opera) bdWidth=dBody().clientWidth;
	else bdWidth=window.innerWidth;
	var bdHeight;
  if(document.all&&!window.opera) bdHeight=dBody().clientHeight;
	else bdHeight=window.innerHeight;
	var sclHeight;
  if(document.all&&!window.opera) sclHeight=dBody().scrollTop;
	else sclHeight=window.scrollY;
	var winWidth=bdWidth/2-w/2;
	var winHeight=bdHeight/2+sclHeight-h/2-21;
	if(winWidth<0) winWidth=0;
	if(winHeight<0) winHeight=0;
	idTOv.style.top=winHeight+"px";
	idTOv.style.left=winWidth+"px";
}

/*
背景サイズ
------------------------------------------------------------*/
var floatBgSize=function(idBase){
	var idTBg=document.getElementById(idBase);
	var bdHeight;
  if(document.all&&!window.opera) bdHeight=dBody().clientHeight;
	else bdHeight=window.innerHeight;
	var contWidth=dBody().scrollWidth;
  var contHight=dBody().scrollHeight;
	idTBg.style.width=contWidth+"px";
	if(contHight>bdHeight) idTBg.style.height=contHight+'px';
	else idTBg.style.height=bdHeight+'px';
}


//////////////////////////////////////////////////////////////////
/// wish list write
//////////////////////////////////////////////////////////////////

/*
カレンダークッキー項目名
------------------------------------------------------------*/
/*hotel
----------------------------------------*/
var cookie_wl_hotel="wlHId";

/*room
----------------------------------------*/
var cookie_wl_room="wlRId";

/*
クッキー保存期限 ／ 単位 ： 時間
------------------------------------------------------------*/
var cookie_period_wl=24; //24時間

/*
wishlist block open flag
------------------------------------------------------------*/
var wishOpenFlag=0;


/*
Cookie writing
------------------------------------------------------------*/
var writeWish=function(type,itemId,cIn,cOut,guest,rooms){
	if(type==1){
		itemId=itemId.replace(" ","");
		var data=getCookie(cookie_wl_hotel);
		if(data.indexOf(itemId) == -1){
		if(data!=""){
			data=data.split("\t");
			
			var j=0;
			dataNew=new Array();
			for(var i=0;i<data.length;i++){
				
				if(itemId!=data[i]){
					dataNew[j]=data[i];
					j++;
					if(j==9) break;
				}
			}
			itemId=itemId+"\t"+dataNew.join("\t");
		}
		
		setCookiePre(cookie_wl_hotel,escape(itemId),cookie_period_wl);
	}
	}else{
		var data=getCookie(cookie_wl_room);
		var str=itemId+","+cIn+","+cOut+","+guest+","+rooms;
		
		if(data.indexOf(str) == -1){
		if(data!=""){
			data=data.split("\t");
			var j=0;
			dataNew=new Array();
			for(var i=0;i<data.length;i++){
				if(str!=data[i]){
					dataNew[j]=data[i];
					j++;
					if(j==9) break;
				}
			}
			str=str+"\t"+dataNew.join("\t");
		}else{
			str=itemId+","+cIn+","+cOut+","+guest+","+rooms;
		}
		setCookiePre(cookie_wl_room,escape(str),cookie_period_wl);
	}
	}
	loadWish();
	dispWish(1);
	wishOpenFlag=1;
	setTimeout(function(){
		if(wishOpenFlag==1){
			dispWish(0);
			wishOpenFlag=0;
		}
	},2000);
}


/*
room detail handle
------------------------------------------------------------*/
var writeWishRD=function(id){
	var data01=document.getElementById("CI_DATA01").firstChild.nodeValue;
	var data02=document.getElementById("CI_DATA02").firstChild.nodeValue;
	var data03=document.getElementById("CI_DATA03").firstChild.nodeValue;
	var data04=document.getElementById("CI_DATA04").firstChild.nodeValue;
	writeWish(2,id,data01,data02,data03,data04);
}


//////////////////////////////////////////////////////////////////
/// wish list load
//////////////////////////////////////////////////////////////////

/*
id config
------------------------------------------------------------*/
var id_wl_hotel="WL_HOTEL_LIST";
var id_wl_room="WL_ROOM_LIST";

var id_wl_num_hotel="WL_HOTEL_VALUE";
var id_wl_num_room="WL_ROOM_VALUE";

var id_wl_left="WL_LEFT";
var id_wl_right="WL_RIGHT";

/*
xml path
------------------------------------------------------------*/
//修正0722 BY KURODA
//var xml_wl_path="/common/xml/wish_list.xml";
var xml_wl_path="ajax/wishlist.aspx";



/*
load
------------------------------------------------------------*/
var loadWish=function(){
	loadWishNumber(cookie_wl_hotel,id_wl_num_hotel);
	loadWishNumber(cookie_wl_room,id_wl_num_room);
	loadWishContentHotel();
}
var getWishNumFlg=function(){
	var dataHotel=getCookie(cookie_wl_hotel);
	var dataRoom=getCookie(cookie_wl_room);
	var isWishExt = false;
	
	if(dataHotel != "" || dataRoom != ""){
		isWishExt = true;
	}
	
	return isWishExt;
}

/*
load number
------------------------------------------------------------*/
var loadWishNumber=function(cookie,id){
	var data=getCookie(cookie);
	if(data!=""){
		var num=(data.split("\t")).length;
		document.getElementById(id).innerHTML=num;
	}else{
		document.getElementById(id).innerHTML="0";
	}
}

/*
load number
------------------------------------------------------------*/
var loadWishContentHotel=function(){
	var cookData01=getCookie(cookie_wl_hotel);
	cookData01=cookData01.split("\t");
	var cookData02=getCookie(cookie_wl_room);
	cookData02=cookData02.split("\t");
	loadXml(cookData01,cookData02,id_wl_hotel,id_wl_room);
	wishListSize(id_wl_hotel,id_wl_left,cookData01.length);
	wishListSize(id_wl_room,id_wl_right,cookData02.length);
}
/*load hotel xml
----------------------------------------*/
var loadXml=function(arr01,arr02,id01,id02){
	if(!xml_wl_path){
		var souce=outputError();
		showErrorLoadFail(souce);
		return;
	}
	$(function(){
		result=$.ajax({
			type:"get",
			url:xml_wl_path,
			cache: false,
			error:function(data){
				var souce=outputError();
				showErrorLoadFail(souce);
			},
			success:function(data){
				var nvWlData=setWl(data);
				if(!xml_rate_path){
					var souce=outputError();
					showErrorLoadFail(souce);
					return;
				}
				$(function(){
					result=$.ajax({
						type:"get",
						url:xml_rate_path,
						cache: false,
						error:function(data){
							var souce=outputError();
							showErrorLoadFail(souce);
						},
						success:function(data){
							var nvData=setXData(data);
							var source01=prodWlHSrc(arr01,nvData);
							dispBlk(id01,source01);
							loadComma();
						}
					});
				});
				var source02=prodWlRSrc(arr02);
				dispBlk(id02,source02);
			}
		});
	});
}
/*produce hotel data
----------------------------------------*/
var setWl=function(data){
	var tnItemWl=data.getElementsByTagName("item");
	nvWlData=new Array();
	for(var i=0;i<tnItemWl.length;i++){
		nvWlData[i]=new Array();
		nvWlData[i][0]=tnItemWl.item(i).getElementsByTagName("type").item(0).firstChild.nodeValue;
		if(nvWlData[i][0]=="hotel"){
			nvWlData[i][1]=tnItemWl.item(i).getElementsByTagName("id").item(0).firstChild.nodeValue;
			nvWlData[i][2]=tnItemWl.item(i).getElementsByTagName("title").item(0).firstChild.nodeValue;
			nvWlData[i][3]=tnItemWl.item(i).getElementsByTagName("link").item(0).firstChild.nodeValue;
			nvWlData[i][4]=tnItemWl.item(i).getElementsByTagName("image").item(0).firstChild.nodeValue;
			nvWlData[i][5]=tnItemWl.item(i).getElementsByTagName("comment").item(0).firstChild.nodeValue;
			nvWlData[i][6]=tnItemWl.item(i).getElementsByTagName("price").item(0).firstChild.nodeValue;
		}else{
			nvWlData[i][1]=tnItemWl.item(i).getElementsByTagName("id").item(0).firstChild.nodeValue;
			nvWlData[i][2]=tnItemWl.item(i).getElementsByTagName("title").item(0).firstChild.nodeValue;
			nvWlData[i][3]=tnItemWl.item(i).getElementsByTagName("room").item(0).firstChild.nodeValue;
			nvWlData[i][4]=tnItemWl.item(i).getElementsByTagName("link").item(0).firstChild.nodeValue;
			nvWlData[i][5]=tnItemWl.item(i).getElementsByTagName("image").item(0).firstChild.nodeValue;
		}
	}
	return nvWlData;
}
/*produce hotel source
----------------------------------------*/
var prodWlHSrc=function(arr,nvData){
	var dateAll=new Date();
	thisYear=dateAll.getFullYear();
	thisMonth=(((dateAll.getMonth()+1)+"").length==1)?"0"+((dateAll.getMonth()+1)+""):dateAll.getMonth();
	thisDate=((dateAll.getDate()+"").length==1)?"0"+(dateAll.getDate()+""):dateAll.getDate();
	var list=makeData02(nvData);
	var source="";
	for(var i=0;i<arr.length;i++){
		for(var j=0;j<nvWlData.length;j++){
			if(nvWlData[j][0]=="hotel"&&arr[i]==nvWlData[j][1]){
				source+='<!---->\n<div class="wlItem">\n';
				source+='<div class="wlInner clearFix">\n';
				source+='<div class="wlContent">\n';
				source+='<p class="photo"><a href="'+nvWlData[j][3]+'">';
				source+='<img src="'+nvWlData[j][4]+'" alt="" width="99" height="74" /></a></p>\n';
				source+='<div class="texts">\n';
				source+='<p class="mainTi"><a href="'+nvWlData[j][3]+'">'+nvWlData[j][2]+'</a></p>\n';
				source+='<p class="comment mt15">'+nvWlData[j][5]+'</p>\n';
				source+='<ul class="priceLine mt5 clearFix">\n';
				source+='<li>'+getPriceTxtListWithRoom(commaDelim(nvWlData[j][6]))+'</li>\n';
				source+='<li>';

				source+='<a href="javascript:void(0);" ';
				source+='onclick="closeAllWl();$(\'#RRWL_A_'+i+'_DEF\').hide();$(\'#RRWL_A_'+i+'_CUR\').show();$(\'#RRWL_'+i+'\').fadeIn(200);" ';
				source+='class="refAnc" id="RRWL_A_'+i+'_DEF">'+textSet_search[6]+'</a> ';
				source+='<a href="javascript:void(0);" ';
				source+='onclick="$(\'#RRWL_A_'+i+'_DEF\').show();$(\'#RRWL_A_'+i+'_CUR\').hide();$(\'#RRWL_'+i+'\').fadeOut(200);" ';
				source+='class="refAnc cur" id="RRWL_A_'+i+'_CUR">'+textSet_search[6]+'</a> ';

				source+='<span class="number">';

				source+='<a href="javascript:void(0);" ';
				source+='onclick="closeAllWl();$(\'#RATEWL_A_'+i+'_DEF\').hide();$(\'#RATEWL_A_'+i+'_CUR\').show();$(\'#RATEWL_'+i+'\').fadeIn(200);" ';
				source+='id="RATEWL_A_'+i+'_DEF">';
				source+='<span class="rateCrnt">USD</span>';
				source+='<img src="/common/images/main/item01_btn_pricerate.gif" alt="" class="ml3 vam" height="14" width="14"></a> ';
				source+='<a href="javascript:void(0);" ';
				source+='onclick="$(\'#RATEWL_A_'+i+'_DEF\').show();$(\'#RATEWL_A_'+i+'_CUR\').hide();$(\'#RATEWL_'+i+'\').fadeOut(200);" ';
				source+='class="cur" id="RATEWL_A_'+i+'_CUR">';
				source+='<span class="rateCrnt">USD</span>';
				source+='<img src="/common/images/main/item01_btn_pricerate_cur.gif" alt="" class="ml3 vam" height="14" width="14"></a> ';

				source+='<span class="priceDisp"></span></span></li>\n';
				source+='</ul><!--floatBox-->\n';
				source+='<div class="fbWrapWl">';
				source+='<div id="RRWL_'+i+'" class="floatBoxWl reference"><div class="innerWl01"><div class="innerWl02">\n';
				source+='<p class="taCenter"><em>'+thisDate+'/'+thisMonth+'/'+thisYear+'</em></p>\n';
				source+='<p class="taCenter">'+getRateTxt()+' = <span class="rateCrnt"></span> <em><span class="baseRate"></span></em></p>\n';
				source+='<p class="taCenter mt5">';
				source+='<a href="javascript:void(0);" onclick="$(\'#RRWL_'+i+'\').fadeOut(200);" class="close">'+textSet_search[5]+'</a></p>\n';
				source+='</div></div></div></div>\n<!--/floatBox-->\n';
				source+='<!--floatBox-->\n';
				source+='<div class="fbWrapWl"><div id="RATEWL_'+i+'" class="floatBoxWl rate"><div class="innerWl01"><div class="innerWl02">\n';
				source+='<div class="taCenter">'+list+'</div>\n';
				source+='<p class="taCenter mt10">';
				source+='<a href="javascript:void(0);" onclick="$(\'#RATEWL_'+i+'\').fadeOut(200);" class="close">'+textSet_search[5]+'</a></p>\n';
				source+='</div></div></div></div>\n<!--/floatBox-->\n</div>\n</div>\n';
				source+='<div class="buttons">\n<p class="mt5">';
				source+='<a href="javascript:void(0);" onclick="deleteWish(\''+nvWlData[j][0]+'\',\''+nvWlData[j][1]+'\');" class="close">';
				source+=textSet_wish[4]+'</a></p>\n<p class="mt25">';
				source+='<a href="'+nvWlData[j][3]+'" onmouseover="imgRoll(this.firstChild,1);" onmouseout="imgRoll(this.firstChild,0);">';
				source+='<img src="'+htlCtnImg+'/hotelscontents/images/general/wish_btn_select_s_def.gif" alt="" width="83" height="25" /></a></p>\n';
				source+='</div>\n</div>\n</div>\n';
			}
		}
	}
	return source;
}
/*produce room source
----------------------------------------*/
var prodWlRSrc=function(arr){
	var source="";
	for(var i=0;i<arr.length;i++){
		for(var j=0;j<nvWlData.length;j++){
			if(nvWlData[j][0]=="room"&&(arr[i].split(","))[0]==nvWlData[j][1]){
				source+='<!---->\n<div class="wlItem">\n';
				source+='<div class="wlInner clearFix">\n';
				source+='<div class="wlContent">\n<p class="photo">';
				source+='<a href="'+nvWlData[j][4]+'">';
				source+='<img src="'+nvWlData[j][5]+'" alt="" width="99" height="74" /></a></p>\n';
				source+='<div class="texts">\n';
				source+='<p class="mainTi"><a href="'+nvWlData[j][4]+'">'+nvWlData[j][2]+'</a></p>\n';
				source+='<p class="subTi mt7"><a href="'+nvWlData[j][4]+'">'+nvWlData[j][3]+'</a></p>\n';
				source+='<ul class="checkIn mt10 clearFix">\n';
				source+='<li><em>'+textSet_wish[0]+' : </em>'+(arr[i].split(","))[1]+'</li>\n';
				source+='<li class="rightM15"><em>'+textSet_wish[1]+' : </em>'+(arr[i].split(","))[2]+'</li>\n';
				source+='<li><em>'+textSet_wish[2]+' : </em>'+(arr[i].split(","))[3]+'</li>\n';
				source+='<li class="rightEnd"><em>'+textSet_wish[3]+' : </em>'+(arr[i].split(","))[4]+'</li>\n';
				source+='</ul>\n</div>\n</div>\n<div class="buttons">\n<p class="mt5">';
				source+='<a href="javascript:void(0);" onclick="deleteWish(\''+nvWlData[j][0]+'\',\''+nvWlData[j][1]+'\');" class="close">';
				source+=textSet_wish[4]+'</a></p>\n<p class="mt30">';
				source+='<a href="'+nvWlData[j][4]+'" onmouseover="imgRoll(this.firstChild,1);" onmouseout="imgRoll(this.firstChild,0);">';
				source+='<img src="'+htlCtnImg+'/hotelscontents/images/general/wish_btn_select_s_def.gif" alt="" width="83" height="25" /></a></p>\n';
				source+='</div>\n</div>\n</div>\n';
			}
		}
	}
	return source;
}

/*
size cntrol
------------------------------------------------------------*/
/*item height
----------------------------------------*/
var wlItem_defHeight=115;

var wishListSize=function(id,pid,num){
	var geId=document.getElementById(id);
	geId.style.height=wlItem_defHeight*num+"px";
}


//////////////////////////////////////////////////////////////////
/// wish list delete
//////////////////////////////////////////////////////////////////
var deleteWish=function(type,itemId){
	if(type=="hotel") var cookData=getCookie(cookie_wl_hotel);
	else if(type=="room") var cookData=getCookie(cookie_wl_room);
	cookData=cookData.split("\t");
	var j=0;
	dataNew=new Array();
	if(type=="hotel"){
		for(var i=0;i<cookData.length;i++){
			if(itemId!=cookData[i]){
				dataNew[j]=cookData[i];
				j++;
				if(j==9) break;
			}
		}
		if(j==0) $('#'+id_wl_left).hide();
	}else if(type=="room"){
		for(var i=0;i<cookData.length;i++){
			if(itemId!=(cookData[i].split(","))[0]){
				dataNew[j]=cookData[i];
				j++;
				if(j==9) break;
			}
		}
		if(j==0) $('#'+id_wl_right).hide();
	}
	dataNew=dataNew.join("\t");
	if(type=="hotel") setCookiePre(cookie_wl_hotel,escape(dataNew),cookie_period_wl);
	else if(type=="room") setCookiePre(cookie_wl_room,escape(dataNew),cookie_period_wl);
	loadWishNumber(cookie_wl_hotel,id_wl_num_hotel);
	loadWishNumber(cookie_wl_room,id_wl_num_room);
	var cookData01=getCookie(cookie_wl_hotel);
	cookData01=cookData01.split("\t");
	var cookData02=getCookie(cookie_wl_room);
	cookData02=cookData02.split("\t");
	if(cookData01==""&&cookData02=="") deleteWlBln();
	
	loadWish();
	
	if(!getWishNumFlg()){
		$('#WISH_LIST_WRAP').hide();
	}
}



//////////////////////////////////////////////////////////////////
/// wish list
//////////////////////////////////////////////////////////////////

var block_wish_wrap="WISH_LIST_WRAP";
var block_wish="WISH_LIST";
var block_wish_offset=40;
var block_wish_defheight=37;
var block_wish_fullheight=70;
var wish_slide_speed=200;
var selMapFLG = 0;
var wlFLG=0;

var dispWish=function(vl){	
if(getWishNumFlg()){
	$('#WISH_LIST_WRAP').show();
	if(vl){$('#DEF').hide();$('#ON').slideDown(wish_slide_speed);}
	else{$('#ON').hide();$('#DEF').fadeIn(wish_slide_speed);}
}else{
	$('#WISH_LIST_WRAP').hide();
}
}

var judgeWish=function(){
	wlFLG=1;
	if(window.addEventListener){
		window.addEventListener("scroll",deleteWlBlnScr,true);
		window.addEventListener("mousewheel",deleteWlBlnScr,true);
		window.addEventListener("resize",deleteWlBlnScr,true);
	}else{
		window.attachEvent("onscroll",deleteWlBlnScr);
		window.attachEvent("onmousewheel",deleteWlBlnScr);
		window.attachEvent("onresize",deleteWlBlnScr);
	}
}
var judgeWishDel=function(){
	if(window.addEventListener){
		window.removeEventListener("scroll",deleteWlBlnScr,true);
		window.removeEventListener("mousewheel",deleteWlBlnScr,true);
		window.removeEventListener("resize",deleteWlBlnScr,true);
	}else{
		window.detachEvent("onscroll",deleteWlBlnScr);
		window.detachEvent("onmousewheel",deleteWlBlnScr);
		window.detachEvent("onresize",deleteWlBlnScr);
	}
}

/*
calc height
------------------------------------------------------------*/
var calcWlHeight=function(){
	var bdHeight;
  if(document.all&&!window.opera) bdHeight=dBody().clientHeight;
	else bdHeight=window.innerHeight;
	var sclHeight;
  if(document.all&&!window.opera) sclHeight=dBody().scrollTop;
	else sclHeight=window.scrollY;
	var contWidth=dBody().scrollWidth;
	topPix=(contWidth>972||document.all)?(bdHeight+sclHeight-block_wish_offset):(bdHeight+sclHeight-block_wish_offset-18);
	return topPix;
}
var calcBdHeight=function(){
	topFullPix=dBody().scrollHeight;
	return topFullPix;
}

/*
wish list handle
------------------------------------------------------------*/
var wishHandleL=function(){
	var cookData=getCookie(cookie_wl_hotel);
	if(cookData.length>0){
		judgeWishDel();
		$('#'+id_wl_left).fadeIn(wish_slide_speed);
		$('#'+id_wl_right).hide();
		dispWlBln();
	}
}
var wishChkOML=function(a){
	if(wlFLG==0) judgeWish();
	var cookData=getCookie(cookie_wl_hotel);
	if(cookData.length==0) a.style.cursor="default";
}
var wishHandleR=function(){
	var cookData=getCookie(cookie_wl_room);
	if(cookData.length>0){
		judgeWishDel();
		$('#'+id_wl_left).hide();
		$('#'+id_wl_right).fadeIn(wish_slide_speed);
		dispWlBln();
	}
}
var wishChkOMR=function(a){
	if(wlFLG==0) judgeWish();
	var cookData=getCookie(cookie_wl_room);
	if(cookData.length==0) a.style.cursor="default";
}

/*
display balloon
------------------------------------------------------------*/
var dispWlBln=function(){
	var cEBaseA=document.createElement("a");
	document.body.appendChild(cEBaseA);
	cEBaseA.setAttribute("id",block_base);
	cEBaseA.setAttribute("href","javascript:deleteWlBln();");
	cEBaseA.setAttribute("onclick","deleteWlBln();");
	floatBgSize(block_base);
	searchSel("none");
}

/*
close balloon
------------------------------------------------------------*/
var deleteWlBln=function(){
	$('#'+id_wl_left).hide();
	$('#'+id_wl_right).hide();
	$('#ON').hide();
	$('#DEF').fadeIn(wish_slide_speed);
	if(document.getElementById(block_base)) document.body.removeChild(document.getElementById(block_base));
	searchSel("inline");
	wlFLG=0;
}
var deleteWlBlnScr=function(){
	$('#'+id_wl_left).hide();
	$('#'+id_wl_right).hide();
	$('#ON').hide();
	$('#DEF').fadeIn(wish_slide_speed);
	if(document.getElementById(block_base)) document.body.removeChild(document.getElementById(block_base));
	wlFLG=0;
}

//////////////////////////////////////////////////////////////////
/// document.body
//////////////////////////////////////////////////////////////////

var dBody=function(){
	if(document.documentElement&&document.documentElement.clientHeight) return document.documentElement;
	if(document.body) return document.body;
	return 0;
}



//////////////////////////////////////////////////////////////////
/// IE6 select表示設定
//////////////////////////////////////////////////////////////////

var searchSel=function(vl){
	if(UAIE6==false) return;
	var tagSelect=document.getElementsByTagName('select');
	if(tagSelect==null) return;
	for(var i=0;i<tagSelect.length;i++){
		tagSelect[i].style.display=vl;
	}
}



/*
judge browser
------------------------------------------------------------*/
var UA=navigator.userAgent;
var UAIE6=UA.indexOf("MSIE 6")!=-1;
var UAIE8=UA.indexOf("MSIE 8")!=-1;


/*
id表示切り替え
------------------------------------------------------------*/
var switchBlock=function(id,vl){
	var elm=document.getElementById(id);
	elm.style.display=vl;
}


/*
add to URL Parameter
------------------------------------------------------------*/
function addPram(baseUri, addparam){
	
	var conjunction = "?";
	
	if(baseUri.indexOf(conjunction) != -1){
		conjunction = "&";
	}
	
	return baseUri + conjunction + addparam;
}



/*
Price
------------------------------------------------------------*/
function getPriceTxtRoom(strPrice){
	if(document.URL.toLowerCase().indexOf('korean') != -1){
		return '<span class="from"></span><span class="priceText"><span class="priceData">' + strPrice + '</span>엔~</span>';
		
	}else if(document.URL.toLowerCase().indexOf('traditional-chinese') != -1){
		return '<span class="from"></span><span class="priceText"><span class="priceData">' + strPrice + '</span>日圓起</span>';
		
	}else if(document.URL.toLowerCase().indexOf('simplified-chinese') != -1){
		return '<span class="from"></span><span class="priceText"><span class="priceData">' + strPrice + '</span>日元起</span>';
		
	}else{
		return '<span class="from">from</span><span class="priceText">JPY<span class="priceData">' + strPrice + '</span></span>';
	}
}


function getRateTxt(){
	if(document.URL.toLowerCase().indexOf('korean') != -1){
		return '<em>1</em>엔';
		
	}else if(document.URL.toLowerCase().indexOf('traditional-chinese') != -1){
		return '<em>1</em>日圓';
		
	}else if(document.URL.toLowerCase().indexOf('simplified-chinese') != -1){
		return '<em>1</em>日元';
		
	}else{
		return 'JPY <em>1</em>';
	}
}

function getChargeCalendarTxt(num){
	if(document.URL.toLowerCase().indexOf('korean') != -1){
		return num + '엔~';
		
	}else if(document.URL.toLowerCase().indexOf('traditional-chinese') != -1){
		return num + '日圓起';
		
	}else if(document.URL.toLowerCase().indexOf('simplified-chinese') != -1){
		return num + '日元起';
		
	}else{
		return 'from<br />JPY ' + num;
	}
}


function getPriceTxtList(strPrice){
	if(document.URL.toLowerCase().indexOf('korean') != -1){
		return '<span class="priceText"><span class="priceData">'+strPrice+'</span>엔~</span>';
		
	}else if(document.URL.toLowerCase().indexOf('traditional-chinese') != -1){
		return '<span class="priceText"><span class="priceData">'+strPrice+'</span>日圓起</span>';
		
	}else if(document.URL.toLowerCase().indexOf('simplified-chinese') != -1){
		return '<span class="priceText"><span class="priceData">'+strPrice+'</span>日元起</span>';
		
	}else{
		return 'from<span class="priceText">JPY <span class="priceData">'+strPrice+'</span></span>';
	}
}

function getPriceTxtListWithRoom(strPrice){
	if(document.URL.toLowerCase().indexOf('korean') != -1){
		return '<span class="price"><span class="priceData">'+strPrice+'</span>엔~</span>';
		
	}else if(document.URL.toLowerCase().indexOf('traditional-chinese') != -1){
		return '<span class="price"><span class="priceData">'+strPrice+'</span>日圓起</span>';
		
	}else if(document.URL.toLowerCase().indexOf('simplified-chinese') != -1){
		return '<span class="price"><span class="priceData">'+strPrice+'</span>日元起</span>';
		
	}else{
		return 'from  <span class="price">JPY <span class="priceData">'+strPrice+'</span></span>';
	}
}

function getPriceTxtRoomDetail(strPrice){
	if(strPrice == "-"){
		return '-';
	}
	if(document.URL.toLowerCase().indexOf('korean') != -1){
		return strPrice + '엔';
		
	}else if(document.URL.toLowerCase().indexOf('traditional-chinese') != -1){
		return strPrice + '日圓';
		
	}else if(document.URL.toLowerCase().indexOf('simplified-chinese') != -1){
		return strPrice + '日元';
		
	}else{
		return 'JPY'+strPrice;
	}
	
}

function getPriceTxtSimple(strPrice){
	if(document.URL.toLowerCase().indexOf('korean') != -1){
		return strPrice + '엔';
		
	}else if(document.URL.toLowerCase().indexOf('traditional-chinese') != -1){
		return strPrice + '日圓';
		
	}else if(document.URL.toLowerCase().indexOf('simplified-chinese') != -1){
		return strPrice + '日元';
		
	}else{
		return 'JPY'+strPrice;
	}
}

function getAreaTxt(pref, subArea, mesh){
	if(document.URL.toLowerCase().indexOf('korean') != -1){
		return pref + ' , ' + subArea + ' , <span>' + mesh + '</span>';
		
	}else if(document.URL.toLowerCase().indexOf('traditional-chinese') != -1){
		return pref + ' ＞' + subArea + '＞<span>' + mesh + '</span>';
		
	}else if(document.URL.toLowerCase().indexOf('simplified-chinese') != -1){
		return pref + '＞' + subArea + '＞<span>' + mesh + '</span>';
		
	}else{
		return '<span>' + mesh + '</span>, ' + subArea + ', ' + pref;
	}
}

//Processing of ROUTE MAP image
//---------------------------------------------------------------------------------
showOverRMap = function(imgname) {
	var overdiv = document.getElementById("overContainer");
	overdiv.firstChild.src = htlCtnImg + "/hotelscontents/images/route_map/"+imgname+".gif";
}
//
deleteOverRMap = function() {
	var overdiv = document.getElementById("overContainer");
	overdiv.firstChild.src = "/common/images/search_map/s.gif";
}
/*
  Cookie制御
============================*/
function setPrmCookie(obj){
		setCookiePre('_'+obj.name,escape(obj.selectedIndex),cookie_period_cal);
}

function setNosmokingPrm(obj){
	setCookiePre('no_smoking',escape(obj.checked),cookie_period_cal);
}

function getPrmCookie(prmName){
	var prmByCookie = getCookie('_'+prmName);
	if(prmByCookie && prmByCookie != '--'){
		document.forms["search"].elements[prmName].selectedIndex = prmByCookie;
	}
}

function loadPrmSd(){
	var prmArr = new Array("rn","rs","pn","rz","mt");
	for(var i = 0; i < prmArr.length; i++){
		getPrmCookie(prmArr[i]);
	}
	
	//no smoking
	if(getCookie('no_smoking') == 'true'){
		document.forms["search"].elements["ns"].checked = true;
	}
}

var load_cont = "LOAD_CONTENT";
var load_base = "LOAD_BASE";
var load_img = "LOAD_IMG";
function openLoadLayer(){
	var cEDiv=document.createElement("div");
	cEDiv.setAttribute("id",load_base);
	cEDiv.innerHTML='loadding';
	
	//document.getElementById('CONTAINER').appendChild(cEDiv);
	
	//window.onload = function() {
	//	document.getElementById("CONTAINER").appendChild(cEDiv);
	//}
	
	//document.body.appendChild(cEDiv);
	
	//floatBgSize(load_base);
	
	//cEDiv.setAttribute("id",load_cont);
	
	//var cEImg=document.createElement("img");
	//cEImg.setAttribute("id",load_img);
	//cEImg.setAttribute("src","/common/images/main/search_waiting.gif");
	
	//cEDiv.appendChild(cEImg);
	
	//var cEDiv02=document.createElement("div");
	//cEDiv02.innerHTML='loadding';
	//cEDiv.appendChild(cEDiv02);
	//document.body.appendChild(cEDiv);
	
	//var cEBaseA=document.createElement("a");
	//document.body.appendChild(cEBaseA);
	//cEBaseA.setAttribute("id",load_base);
	//cEBaseA.setAttribute("href","javascript:closeLoadLayer();");
	//cEBaseA.setAttribute("onclick","closeLoadLayer();");
	//floatBgSize(load_base);
	
	//$('#'+load_cont).show();
	
	//setTimeout(function(){
		//var iW=document.getElementById(load_cont).firstChild.width;
		//var iH=document.getElementById(load_cont).firstChild.height;
		//$('#'+load_cont).hide();
		//floatOvrCord(load_cont,iW,iH);
		//$('#'+load_cont).fadeIn(400);
	//},300);
	//setTimeout(function(){
	//	var cEBaseA=document.createElement("a");
	//	document.body.appendChild(cEBaseA);
	//	cEBaseA.setAttribute("id",load_base);
	//	cEBaseA.setAttribute("href","javascript:closeLoadLayer();");
	//	cEBaseA.setAttribute("onclick","closeLoadLayer();");
	//	floatBgSize(load_base);
	//},300);
	
	searchSel("none");
	window.onresize=function(){
		//floatBgSize(load_base);
		//floatOvrCord(load_cont,iW,iH);
	}
}

function closeLoadLayer(){
	if(document.getElementById(load_base)){
		document.body.removeChild(document.getElementById(load_base));
	}
	
	if(document.getElementById(load_cont)){
		document.body.removeChild(document.getElementById(load_cont));
	}
	
	searchSel("inline");
}

function showErrorLoadFail(errorText){
		window.status = errorText;
}
