function imgbtnSmallCalendar_Click(formname, objImg,divName,returnFunction,strValidDate)
{
	var f = document.forms(0);
	var strValid = f.txtValidDate.value;
	var Mode = "1";
	var ValidDate = strValidDate;

	showCalendar(formname, objImg,divName, Mode,ValidDate,returnFunction);
}
function showCalendar(formname, objImg,divName, Mode,ValidDate,returnFunction) 
{	
	var left, top;
	left=getAbsLeftPost(objImg);  
	top=getAbsTopPost(objImg)+objImg.height+1;	
	if(document.all[divName].style.visibility=="visible")
	{
		hide2(divName);		
	}
	else
	{		
		var yyyy, mm;
		openLayer(Calendar, 
		"/ASPX/Common/CalenderSearch3.aspx?DivName=" + divName 
		+ "&ReturnFunction=" + returnFunction
		+ "&ValidDate=" + ValidDate
		, divName, left, top);
	}
}

function imgbtnSmallCalendar_Click_ourpicks(formname, objImg,divName,returnFunction,strValidDate)
{
	var f = document.forms(0);
	var strValid = f.txtValidDate.value;
	var Mode = "1";
	var ValidDate = strValidDate;

	showCalendar_ourpicks(formname, objImg,divName, Mode,ValidDate,returnFunction);
}
function showCalendar_ourpicks(formname, objImg,divName, Mode,ValidDate,returnFunction) 
{	
	var left, top;
	left=getAbsLeftPost(objImg);  
	top=getAbsTopPost(objImg)+objImg.height+1;	
	if(document.all[divName].style.visibility=="visible")
	{
		hide2(divName);		
	}
	else
	{		
		var yyyy, mm;
		openLayer(Calendar, 
		"/ASPX/Common/CalenderSearch2.aspx?DivName=" + divName 
		+ "&ReturnFunction=" + returnFunction
		+ "&ValidDate=" + ValidDate
		, divName, left, top);
	}
}




function hidePost(idLayer,idParent){
	bVer=new chkBrowserPost();
	ns4 = (document.layers)? true:false;
	ie4 = (document.all)? true:false;

	cLayer=bVer.dom?document.getElementById(idLayer).style:bVer.ie4?document.all[idLayer].style:bVer.ns4?idParent?document[idParent].document[idLayer]:document[idLayer]:0;
	if(cLayer.visibility){
		cLayer.visibility='hidden';
	}else{
		cLayer.display='none';
	}
}
function openLayer(win, surl, strlayer, left, top) 
{	
	win.location.href=surl;
	moveLayerPost(strlayer, left, top);
	showPost(strlayer);	
}
function hide2(idLayer,idParent){
	bVer=new chkBrowserPost();
	ns4 = (document.layers)? true:false;
	ie4 = (document.all)? true:false;

	cLayer=bVer.dom?document.getElementById(idLayer).style:bVer.ie4?document.all[idLayer].style:bVer.ns4?idParent?document[idParent].document[idLayer]:document[idLayer]:0;
	if(cLayer.visibility){
		cLayer.visibility='hidden';
	}else{
		cLayer.display='none';
	}
}

function getAbsLeftPost(obj) {
	return (obj.offsetParent==null)? 0:obj.offsetLeft+getAbsLeftPost(obj.offsetParent);
}

function getAbsTopPost(obj) {
	return (obj.offsetParent==null)? 0:obj.offsetTop+getAbsTopPost(obj.offsetParent);
}

function getAbsLeftPost(obj) {
	return (obj.offsetParent==null)? 0:obj.offsetLeft+getAbsLeftPost(obj.offsetParent);
}

function getAbsTopPost(obj) {
	return (obj.offsetParent==null)? 0:obj.offsetTop+getAbsTopPost(obj.offsetParent);
}
function moveLayerPost(idLayer, left, top) {
	bVer=new chkBrowserPost();
	ns4 = (document.layers)? true:false;
	ie4 = (document.all)? true:false;
	cLayer=bVer.dom?document.getElementById(idLayer).style:bVer.ie4?document.all[idLayer].style:bVer.ns4?idParent?document[idParent].document[idLayer]:document[idLayer]:0;
	if(cLayer) {
		cLayer.left = left;
		cLayer.top = top;
	}
}

function showPost(idLayer,idParent){	
	bVer=new chkBrowserPost();
	ns4 = (document.layers)? true:false;
	ie4 = (document.all)? true:false;
	cLayer=bVer.dom?document.getElementById(idLayer).style:bVer.ie4?document.all[idLayer].style:bVer.ns4?idParent?document[idParent].document[idLayer]:document[idLayer]:0;

	if(cLayer.visibility){		
		cLayer.visibility='visible';
	}else {
		cLayer.display='block';
	}
	divLinksForm=(ns4)?document.divLinks.document.divLinks:document.divLinks;
}

function getAbsLeftPost(obj) {
	return (obj.offsetParent==null)? 0:obj.offsetLeft+getAbsLeftPost(obj.offsetParent);
}

function getAbsTopPost(obj) {
	return (obj.offsetParent==null)? 0:obj.offsetTop+getAbsTopPost(obj.offsetParent);
}
function moveLayerPost(idLayer, left, top) {
	bVer=new chkBrowserPost();
	ns4 = (document.layers)? true:false;
	ie4 = (document.all)? true:false;
	cLayer=bVer.dom?document.getElementById(idLayer).style:bVer.ie4?document.all[idLayer].style:bVer.ns4?idParent?document[idParent].document[idLayer]:document[idLayer]:0;
	if(cLayer) {
		cLayer.left = left;
		cLayer.top = top;
	}
}

function showPost(idLayer,idParent){	
	bVer=new chkBrowserPost();
	ns4 = (document.layers)? true:false;
	ie4 = (document.all)? true:false;
	cLayer=bVer.dom?document.getElementById(idLayer).style:bVer.ie4?document.all[idLayer].style:bVer.ns4?idParent?document[idParent].document[idLayer]:document[idLayer]:0;

	if(cLayer.visibility){		
		cLayer.visibility='visible';
	}else {
		cLayer.display='block';
	}
	divLinksForm=(ns4)?document.divLinks.document.divLinks:document.divLinks;
}

function chkBrowserPost(){
		this.ver=navigator.appVersion;
		this.dom=document.getElementById?1:0;
		this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
		this.ie4=(document.all && !this.dom)?1:0;
		this.ns5=(this.dom && parseInt(this.ver,10) >= 5) ?1:0;
		this.ns4=(document.layers && !this.dom)?1:0;
		this.bVer=(this.ie5 || this.ie4 || this.ns4 || this.ns5);
		return this;
}

function ChangeDuration()
{
	document.Form1.Duration.value = document.Form1.ddlDuration.options[document.Form1.ddlDuration.selectedIndex].value;
	if(document.Form1.txtCheckInDateShow.value.length > 0)
	{		
		Duration_change();
	}
	else
	{
		document.Form1.txtCheckOutDate.value = '';
	}
	
	
}

// 달력을 보여주기
function Duration_change()
{
	var f = document.forms(0);
	var strCheckInDate			// 체크인 일자 YYYY-MM-DD
	var dtCheckOut			

	var strCheckInYYYY
	var strCheckInMM
	var strCheckInDD
	
	var strCheckOutYYYY
	var strCheckOutMM
	var strCheckOutDD
	var strCheckOut	
		
	var strRet
	var iAddDays = parseInt(f.ddlDuration[f.ddlDuration.selectedIndex].value,10);
	
	//f.PirceSearch.value = "N";
	
	strCheckInDate	= f.txtCheckInDateShow.value.substring(0,10)
	ArrCheckDate = f.txtCheckInDateShow.value.split('-');
	strCheckInYYYY	= ArrCheckDate[0];
	strCheckInMM	= ArrCheckDate[1];
	strCheckInDD	= ArrCheckDate[2];
	
		
	dtCheckOut =  new Date(strCheckInYYYY,strCheckInMM - 1, parseInt(strCheckInDD,10) + iAddDays)
	
	
	//05/05/2005
	strCheckOutYYYY = dtCheckOut.getFullYear();
	
	var NMonth = parseInt(dtCheckOut.getMonth()) + 1;	
	if(NMonth < 10)
	{
		strCheckOutMM = "0"+ parseInt(dtCheckOut.getMonth()+ 1) ;		
	}
	else
		strCheckOutMM = dtCheckOut.getMonth() + 1;
	
	
	if(dtCheckOut.getDate().toString().length < 2)
		strCheckOutDD = "0"+dtCheckOut.getDate();
	else
		strCheckOutDD = dtCheckOut.getDate();
		
	strCheckOut = strCheckOutYYYY + "-" + strCheckOutMM + "-" + strCheckOutDD	
	
	var tempSolar = strCheckOut.split("-");
	dtCheckOut =  new Date(tempSolar[0],Number(tempSolar[1])-1,tempSolar[2])
	var checkDay;

	switch(dtCheckOut.getDay())
	{
		case 0:
		{
			checkDay = "(일)";
			break;
		}
		case 1:
		{
			checkDay = "(월)";		
			break;
		}		
		case 2:
		{
			checkDay = "(화)";				
			break;
		}		
		case 3:
		{
			checkDay = "(수)";				
			break;
		}		
		case 4:
		{
			checkDay = "(목)";					
			break;
		}		
		case 5:
		{
			checkDay = "(금)";							
			break;
		}		
		case 6:
		{
			checkDay = "(토)";			
			break;
		}		
	}

	
	if(strCheckOut.length>0 && f.ddlDuration[f.ddlDuration.selectedIndex].value !="")
	{
		f.txtCheckOutDate.value = strCheckOut;
		f.txtCheckOutDateShow.value = strCheckOut + checkDay;
	}
	if(f.ddlDuration[f.ddlDuration.selectedIndex].value =="")
	{
		f.txtCheckOutDate.value = "";
		f.txtCheckOutDateShow.value = "";
	}
	

}



function ChangeDurationIndex()
{
	document.Form1.Duration.value = document.Form1.ddlDuration.options[document.Form1.ddlDuration.selectedIndex].value;
	if(document.Form1.txtCheckInDateShow.value.length > 0)
	{		
		Duration_change();
	}
	else
	{
		document.Form1.txtCheckOutDate.value = '';
	}
}

function ChangeGreadeCode()
{
	document.Form1.StarRating.value = document.Form1.ddlGreadeCode.options[document.Form1.ddlGreadeCode.selectedIndex].value;
}
function ChangeLocationCode()
{

	
	document.Form1.LocationCode.value = document.Form1.ddlLocationCode.options[document.Form1.ddlLocationCode.selectedIndex].value;
	parent.document.Form1.LocationCode.value = document.Form1.LocationCode.value;
	alert(parent.document.Form1.LocationCode.value);

}
function CityCodeChk()
{
	
	if(document.Form1.CityCode.value!=null)
	{		
		for(s=0;s<document.Form1.rdoCityCode.length;s++)
		{	
			if(document.Form1.rdoCityCode[s].value == document.Form1.CityCode.value)
			{				
				document.Form1.rdoCityCode[s].checked=true;
				chkCityCode(document.Form1.rdoCityCode[s]);				
				break;
			}
		}
	}
}
function chkCityCode(ClickRdo)
{		
	
	var strClickRad = ClickRdo.alt;
	var arrTmp = strClickRad.split("/");
	document.Form1.CityCode.value = arrTmp[0];
	document.Form1.txtCityCode.value = arrTmp[0];
	CityLocationIFrame.Form1.CityCode.value = arrTmp[0];
	
	document.Form1.txtClickType.value = 'A';
	CityLocationIFrame.Form1.submit();

	document.all["layerSelect"].innerHTML = "<font color='#000000'>" + arrTmp[1]+ "</font>";
	document.Form1.txtCityCode.focus();	
	
}

function GetLocation()
{
	CityLocationIFrame.Form1.CityCode.value = document.Form1.txtCityCode.value;
	document.Form1.txtClickType.value = 'A';
	CityLocationIFrame.Form1.submit();
}

function ClickSearchList()
{
	if (document.Form1.txtCityCode.value=="")
	{
		alert("\n숙박할 도시를 선택해 주세요.");
		document.Form1.txtCityCode.focus();
		return;
	}
	if (document.Form1.txtCheckInDateShow.value=="")
	{
		alert("\n체크인 날짜를 입력해 주세요.");
		document.Form1.txtCheckInDateShow.focus();
		return;
	}
	if (document.Form1.txtCheckOutDateShow.value=="")
	{
		alert("\n체크아웃 날짜를 입력해 주세요.");
		document.Form1.txtCheckOutDateShow.focus();
		return;
	}
	if(document.Form1.ddlBedTypeCode1.value != '')
	{
		if (Form1.ddlRoomCount1.value=="0")
		{
			alert("\n1번째 객실의 방 갯수를 선택하세요.");
			Form1.ddlRoomCount1.focus();
			return;
		}
	}
	if(document.Form1.ddlBedTypeCode2.value != '')
	{
		if (Form1.ddlRoomCount2.value=="0")
		{
			//alert("\n2번째 객실의 방 갯수를 선택하세요.");
			document.Form1.ddlBedTypeCode2.value = "";
			document.Form1.BedTypeCode2.value = "";
			
		}
	}
	if(document.Form1.ddlBedTypeCode3.value != '')
	{
		if (Form1.ddlRoomCount3.value=="0")
		{
			document.Form1.ddlBedTypeCode3.value = "";
			document.Form1.BedTypeCode3.value = "";
			
		}
	}
	
	if(document.Form1.CityCode.value=="")		
	{
		alert("도시검색을 다시 선택하세요");
		Form1.txtCityCode.focus();
		return;
	}
	
		
	document.Form1.CheckInDate.value = document.Form1.txtCheckInDate.value;
	var CheckInDateShow = document.Form1.txtCheckInDateShow.value;
	document.Form1.CheckInDateShow.value = escape(CheckInDateShow);	
	
	document.Form1.CheckOutDate.value = document.Form1.txtCheckOutDate.value;	
	var CheckOutDateShow = document.Form1.txtCheckOutDateShow.value;
	document.Form1.CheckOutDateShow.value = escape(CheckOutDateShow);
	
	/*
	document.Form1.Duration.value = "";
	document.Form1.BedTypeCode1.value = "";
	document.Form1.BedTypeCode2.value = "";
	document.Form1.BedTypeCode3.value = "";
	document.Form1.RoomCount1.value = "";
	document.Form1.RoomCount2.value = "";
	document.Form1.RoomCount3.value = "";
	document.Form1.ChildAge1.value = "";
	document.Form1.ChildAge2.value = "";
	document.Form1.ChildAge3.value = "";
	*/

	document.Form1.ItemName.value = document.Form1.txtHotelName.value;
	document.Form1.StarRating.value = document.Form1.ddlGreadeCode.options[document.Form1.ddlGreadeCode.selectedIndex].value;
	//document.Form1.LocationCode.value = document.Form1.CityLocationIFrame.ddlLocationCode.options[document.Form1.CityLocationIFrame.ddlLocationCode.selectedIndex].value;//CityLocationIFrame.Form1.ddlLocationCode.value;
	
//	if(document.Form1.chkAvailableOnly.checked)
//		document.Form1.AvailableOnly.value = 'true';
//	else
//		document.Form1.AvailableOnly.value = 'false';
		
	/*
	if(document.Form1.chkReCommendOnly.checked)
		document.Form1.ReCommendOnly.value = 'true';
	else
		document.Form1.ReCommendOnly.value = 'false';	
	*/
		
	var ReCommendOnly = document.Form1.ReCommendOnly.value;
	var AvailableOnly = document.Form1.AvailableOnly.value;
	var Duration = document.Form1.Duration.value;	
	var BedTypeCode1 = document.Form1.BedTypeCode1.value;
	var BedTypeCode2 = document.Form1.BedTypeCode2.value;
	var BedTypeCode3 = document.Form1.BedTypeCode3.value;
	var RoomCount1 = document.Form1.RoomCount1.value;
	var RoomCount2 = document.Form1.RoomCount2.value;
	var RoomCount3 = document.Form1.RoomCount3.value;
	var ChildAge1 = document.Form1.ChildAge1.value;
	var ChildAge2 = document.Form1.ChildAge2.value;
	var ChildAge3 = document.Form1.ChildAge3.value;
	var CityCode = document.Form1.CityCode.value;
	var CheckInDate = document.Form1.CheckInDate.value;
	var CheckInDateShow = document.Form1.CheckInDateShow.value;
	var CheckOutDateShow = document.Form1.CheckOutDateShow.value;
	var CheckOutDate = document.Form1.CheckOutDate.value;
	var LocationCode = document.Form1.LocationCode.value;
	var BookingCode = document.Form1.BookingCode.value;
	
	var StarRating = document.Form1.StarRating.value;
	var ItemName = document.Form1.ItemName.value;
			
	location.href = "/ASPX/Common/Loading.aspx?page="+"HotelProducts/HotelSearchResult.aspx&LoadingMsgID=HotelSearchMsg&CityCode="+CityCode+"&BedTypeCode1="+BedTypeCode1+"&RoomCount1="+RoomCount1+"&ChildAge1="+ChildAge1+"&BedTypeCode2="+BedTypeCode2+"&RoomCount2="+RoomCount2+"&ChildAge2="+ChildAge2+"&BedTypeCode3="+BedTypeCode3+"&RoomCount3="+RoomCount3+"&ChildAge3="+ChildAge3+"&Duration="+Duration+"&CheckInDate="+CheckInDate+"&CheckInDateShow="+escape(CheckInDateShow)+"&CheckOutDate="+CheckOutDate+"&CheckOutDateShow="+escape(CheckOutDateShow)+"&ReCommendOnly="+ReCommendOnly+"&AvailableOnly="+AvailableOnly+"&LocationCode="+LocationCode+"&StarRating="+StarRating+"&ItemName="+ItemName+"&BookingCode="+BookingCode;
	
}

function ShowEtc() {
	
	if(document.all.ETC.style.display=="block")
		document.all.ETC.style.display="none";
	else
		document.all.ETC.style.display="block";
}

// 추천호텔로 이동
function GoRecommendHotel(ItemCode, CityCode, ItemNo, CheckInDate, ItemName)
{
	if(ItemNo == null)
		ItemNo = "0";
	if(CheckInDate == null)
		CheckInDate = "";

	location.href = "/ASPX/Common/Loading.aspx?page=HotelProducts/HotelInformation.aspx&ItemCode=" + ItemCode + "&CityCode=" + CityCode + "&ItemNo=" + ItemNo + "&CheckInDate=" + CheckInDate + "&SearchType=URL_SEARCH";
	//location.href = "/ASPX/Common/Loading.aspx?page=HotelProducts/HotelSearchResult.aspx&ItemCode=" + ItemCode + "&CityCode=" + CityCode + "&ItemNo=" + ItemNo + "&CheckInDate=" + CheckInDate + "&ItemName=" + ItemName + "&SearchType=URL_SEARCH";
}


//객실1
function ChangeddlBedTypeCode1()
{
	
	var BedTypeCode1 = document.Form1.ddlBedTypeCode1.options[document.Form1.ddlBedTypeCode1.selectedIndex].value;
	
		
	if(BedTypeCode1 == 'BED06' || BedTypeCode1 == 'BED07')
	{	
		document.Form1.ddlChildAge1.disabled = false;		
	}
	else
	{
		document.Form1.ddlChildAge1.disabled = true;
		//document.Form1.ddlChildAge1.selectedIndex = 0;
		document.Form1.ChildAge1.value = "";
	}
	

			
	if(BedTypeCode1 !="" && document.Form1.ddlRoomCount1.options[document.Form1.ddlRoomCount1.selectedIndex].value =="0")
	{
		document.Form1.ddlRoomCount1.selectedIndex = 1;
		document.Form1.RoomCount1.value = document.Form1.ddlRoomCount1.options[document.Form1.ddlRoomCount1.selectedIndex].value;
	}
	
	if(BedTypeCode1 == "")
	{
		document.Form1.ddlRoomCount1.selectedIndex = 0;
		document.Form1.RoomCount1.value = "0";
		//document.Form1.ddlChildAge1.selectedIndex = 0;
		document.Form1.ChildAge1.value = "";
		
	}
	else
	{
		document.Form1.ddlRoomCount1.disabled = false;
	
	}
	ChangeddlRoomCount1();
	
	if(document.Form1.ddlBedTypeCode1.options[document.Form1.ddlBedTypeCode1.selectedIndex].value == document.Form1.ddlBedTypeCode2.options[document.Form1.ddlBedTypeCode2.selectedIndex].value)
	{	
		if(document.Form1.ddlBedTypeCode2.options[document.Form1.ddlBedTypeCode2.selectedIndex].value !="")
		{			
			document.Form1.RoomCount1.value = parseInt(document.Form1.ddlRoomCount1.options[document.Form1.ddlRoomCount1.selectedIndex].value) + parseInt(document.Form1.ddlRoomCount2.options[document.Form1.ddlRoomCount2.selectedIndex].value);
				
			document.Form1.ddlRoomCount1.selectedIndex = parseInt(document.Form1.ddlRoomCount1.options[document.Form1.ddlRoomCount1.selectedIndex].value) + parseInt(document.Form1.ddlRoomCount2.options[document.Form1.ddlRoomCount2.selectedIndex].value);
			
			document.Form1.ddlBedTypeCode2.selectedIndex = 0;
			document.Form1.BedTypeCode2.value = "";
			document.Form1.ddlRoomCount2.selectedIndex = 0;	
			document.Form1.RoomCount2.value = "";
		}
	}
	
	if(document.Form1.ddlBedTypeCode3.options[document.Form1.ddlBedTypeCode3.selectedIndex].value == document.Form1.ddlBedTypeCode1.options[document.Form1.ddlBedTypeCode1.selectedIndex].value)
	{	
		if(document.Form1.ddlBedTypeCode3.options[document.Form1.ddlBedTypeCode3.selectedIndex].value !="")
		{
			document.Form1.RoomCount1.value = parseInt(document.Form1.ddlRoomCount1.options[document.Form1.ddlRoomCount1.selectedIndex].value) + parseInt(document.Form1.ddlRoomCount3.options[document.Form1.ddlRoomCount3.selectedIndex].value);
				
			document.Form1.ddlRoomCount1.selectedIndex = parseInt(document.Form1.ddlRoomCount1.options[document.Form1.ddlRoomCount1.selectedIndex].value) + parseInt(document.Form1.ddlRoomCount3.options[document.Form1.ddlRoomCount3.selectedIndex].value);
			
			document.Form1.ddlBedTypeCode3.selectedIndex = 0;
			document.Form1.BedTypeCode3.value = "";
			document.Form1.ddlRoomCount3.selectedIndex = 0;	
			document.Form1.RoomCount3.value = "";
		}
	}
	
	
	document.Form1.BedTypeCode1.value = document.Form1.ddlBedTypeCode1.options[document.Form1.ddlBedTypeCode1.selectedIndex].value;
	document.Form1.txtClickType.value = 'A';
		
	
}
function ChangeddlRoomCount1()
{	
	var FrontRoomCnt = document.Form1.RoomCount1.value;
		
	document.Form1.RoomCount1.value = document.Form1.ddlRoomCount1.options[document.Form1.ddlRoomCount1.selectedIndex].value;			
	
	var RoomCnt = parseInt(document.Form1.ddlRoomCount1.options[document.Form1.ddlRoomCount1.selectedIndex].value) + parseInt(document.Form1.ddlRoomCount2.options[document.Form1.ddlRoomCount2.selectedIndex].value) +parseInt(document.Form1.ddlRoomCount3.options[document.Form1.ddlRoomCount3.selectedIndex].value);
	

	var RoomCount = 3;
	if( getCookie('GNB') == 'jp' || document.Form1.CountryCode.value == 'jp')
	{
		RoomCount = 10;
	}

	if( RoomCnt > RoomCount)
	{
		
		alert("객실 수는 모두 합하여"+ RoomCount+"개까지입니다. ");
		//Form1.ddlRoomCount1.value = FrontRoomCnt;
		Form1.ddlRoomCount1.selectedIndex = 0;
		return false;
	}
	else
	{
		document.Form1.txtClickType.value = 'A';
		
	}
	
}
function ChangeddlChildAge1()
{		
	document.Form1.ChildAge1.value = document.Form1.ddlChildAge1.options[document.Form1.ddlChildAge1.selectedIndex].value;			
	document.Form1.txtClickType.value = 'A';
	
}

//객실2
function ChangeddlBedTypeCode2()
{
	var BedTypeCode2 = document.Form1.ddlBedTypeCode2.options[document.Form1.ddlBedTypeCode2.selectedIndex].value;
		
	if(BedTypeCode2 == 'BED06' || BedTypeCode2 == 'BED07')
	{	
		document.Form1.ddlChildAge2.disabled = false;		
	}
	else
	{
		document.Form1.ddlChildAge2.disabled = true;
		//document.Form1.ddlChildAge2.selectedIndex = 0;
		document.Form1.ChildAge2.value = "";
	}
	
		
		
	if(BedTypeCode2 !="" && document.Form1.ddlRoomCount2.options[document.Form1.ddlRoomCount2.selectedIndex].value =="0")
	{
		document.Form1.ddlRoomCount2.selectedIndex = 1;
		document.Form1.RoomCount2.value = document.Form1.ddlRoomCount2.options[document.Form1.ddlRoomCount2.selectedIndex].value;
	}
	
	if(BedTypeCode2 == "")
	{
		document.Form1.ddlRoomCount2.selectedIndex = 0;
		document.Form1.RoomCount2.value = "0";
		//document.Form1.ddlChildAge2.selectedIndex = 0;
		document.Form1.ChildAge2.value = "";
	}
	else
		document.Form1.ddlRoomCount2.disabled = false;
	
	ChangeddlRoomCount2();
	
	if(document.Form1.ddlBedTypeCode1.options[document.Form1.ddlBedTypeCode1.selectedIndex].value == document.Form1.ddlBedTypeCode2.options[document.Form1.ddlBedTypeCode2.selectedIndex].value)
	{	
		if(document.Form1.ddlBedTypeCode2.options[document.Form1.ddlBedTypeCode2.selectedIndex].value !="")
		{			
			document.Form1.RoomCount1.value = parseInt(document.Form1.ddlRoomCount1.options[document.Form1.ddlRoomCount1.selectedIndex].value) + parseInt(document.Form1.ddlRoomCount2.options[document.Form1.ddlRoomCount2.selectedIndex].value);
				
			document.Form1.ddlRoomCount1.selectedIndex = parseInt(document.Form1.ddlRoomCount1.options[document.Form1.ddlRoomCount1.selectedIndex].value) + parseInt(document.Form1.ddlRoomCount2.options[document.Form1.ddlRoomCount2.selectedIndex].value);
			
			document.Form1.ddlBedTypeCode2.selectedIndex = 0;
			document.Form1.BedTypeCode2.value = "";
			document.Form1.ddlRoomCount2.selectedIndex = 0;	
			document.Form1.RoomCount2.value = "";
		}
	}
	
	if(document.Form1.ddlBedTypeCode3.options[document.Form1.ddlBedTypeCode3.selectedIndex].value == document.Form1.ddlBedTypeCode2.options[document.Form1.ddlBedTypeCode2.selectedIndex].value)
	{
		if(document.Form1.ddlBedTypeCode2.options[document.Form1.ddlBedTypeCode2.selectedIndex].value !="")
		{		
			document.Form1.BedTypeCode2.value = parseInt(document.Form1.ddlRoomCount2.options[document.Form1.ddlRoomCount2.selectedIndex].value) + parseInt(document.Form1.ddlRoomCount3.options[document.Form1.ddlRoomCount3.selectedIndex].value);
			
			document.Form1.ddlRoomCount2.selectedIndex = parseInt(document.Form1.ddlRoomCount2.options[document.Form1.ddlRoomCount2.selectedIndex].value) + parseInt(document.Form1.ddlRoomCount3.options[document.Form1.ddlRoomCount3.selectedIndex].value);		
			
			document.Form1.ddlBedTypeCode3.selectedIndex = 0;
			document.Form1.BedTypeCode3.value = "";
			document.Form1.ddlRoomCount3.selectedIndex = 0;	
			document.Form1.RoomCount3.value = "";
		}
	}
	
	
	document.Form1.BedTypeCode2.value = document.Form1.ddlBedTypeCode2.options[document.Form1.ddlBedTypeCode2.selectedIndex].value;
	document.Form1.txtClickType.value = 'A';
	
	
}
function ChangeddlRoomCount2()
{		
	var FrontRoomCnt = document.Form1.RoomCount2.value;
	
	document.Form1.RoomCount2.value = document.Form1.ddlRoomCount2.options[document.Form1.ddlRoomCount2.selectedIndex].value;
	var RoomCnt = parseInt(document.Form1.ddlRoomCount1.options[document.Form1.ddlRoomCount1.selectedIndex].value) + parseInt(document.Form1.ddlRoomCount2.options[document.Form1.ddlRoomCount2.selectedIndex].value) +parseInt(document.Form1.ddlRoomCount3.options[document.Form1.ddlRoomCount3.selectedIndex].value);
	
	var RoomCount=3;
	if( getCookie('GNB') == 'jp' || document.Form1.CountryCode.value == 'jp')
	{
		RoomCount = 10;
	}

	if( RoomCnt > RoomCount)
	{
		alert("객실 수는 모두 합하여 "+ RoomCount+"개까지입니다. ");
		//Form1.ddlRoomCount2.value = FrontRoomCnt;
		Form1.ddlRoomCount2.selectedIndex = 0;
		return false;
	}
	else
	{
		document.Form1.txtClickType.value = 'A';
		
	}
	
		
}
function ChangeddlChildAge2()
{		
	document.Form1.ChildAge2.value = document.Form1.ddlChildAge2.options[document.Form1.ddlChildAge2.selectedIndex].value;			
	document.Form1.txtClickType.value = 'A';
	
}
//객실3
function ChangeddlBedTypeCode3()
{
	var BedTypeCode3 = document.Form1.ddlBedTypeCode3.options[document.Form1.ddlBedTypeCode3.selectedIndex].value;
		
	if(BedTypeCode3 == 'BED06' || BedTypeCode3 == 'BED07')
	{	
		document.Form1.ddlChildAge3.disabled = false;		
	}
	else
	{
		document.Form1.ddlChildAge3.disabled = true;
		//document.Form1.ddlChildAge3.selectedIndex = 0;
		document.Form1.ChildAge3.value = "";
	}
	
	
	if(BedTypeCode3 !="" && document.Form1.ddlRoomCount3.options[document.Form1.ddlRoomCount3.selectedIndex].value =="0")
	{
		document.Form1.ddlRoomCount3.selectedIndex = 1;
		document.Form1.RoomCount3.value = document.Form1.ddlRoomCount3.options[document.Form1.ddlRoomCount3.selectedIndex].value;
	}
	
	if(BedTypeCode3 == "")
	{
		document.Form1.ddlRoomCount3.selectedIndex = 0;
		document.Form1.RoomCount3.value = "0";
		//document.Form1.ddlChildAge3.selectedIndex = 0;
		document.Form1.ChildAge3.value = "";
	}
	else
	{
		document.Form1.ddlRoomCount3.disabled = false;
	}
	
	if(document.Form1.ddlBedTypeCode1.options[document.Form1.ddlBedTypeCode1.selectedIndex].value == document.Form1.ddlBedTypeCode2.options[document.Form1.ddlBedTypeCode2.selectedIndex].value)
	{	
		if(document.Form1.ddlBedTypeCode2.options[document.Form1.ddlBedTypeCode2.selectedIndex].value !="")
		{			
			document.Form1.RoomCount1.value = parseInt(document.Form1.ddlRoomCount1.options[document.Form1.ddlRoomCount1.selectedIndex].value) + parseInt(document.Form1.ddlRoomCount2.options[document.Form1.ddlRoomCount2.selectedIndex].value);
				
			document.Form1.ddlRoomCount1.selectedIndex = parseInt(document.Form1.ddlRoomCount1.options[document.Form1.ddlRoomCount1.selectedIndex].value) + parseInt(document.Form1.ddlRoomCount2.options[document.Form1.ddlRoomCount2.selectedIndex].value);
			
			document.Form1.ddlBedTypeCode2.selectedIndex = 0;
			document.Form1.BedTypeCode2.value = "";
			document.Form1.ddlRoomCount2.selectedIndex = 0;	
			document.Form1.RoomCount2.value = "";
		}
	}
	
	ChangeddlRoomCount3();
	
	if(document.Form1.ddlBedTypeCode3.options[document.Form1.ddlBedTypeCode3.selectedIndex].value == document.Form1.ddlBedTypeCode1.options[document.Form1.ddlBedTypeCode1.selectedIndex].value)
	{	
		if(document.Form1.ddlBedTypeCode3.options[document.Form1.ddlBedTypeCode3.selectedIndex].value !="")
		{
			document.Form1.RoomCount1.value = parseInt(document.Form1.ddlRoomCount1.options[document.Form1.ddlRoomCount1.selectedIndex].value) + parseInt(document.Form1.ddlRoomCount3.options[document.Form1.ddlRoomCount3.selectedIndex].value);
				
			document.Form1.ddlRoomCount1.selectedIndex = parseInt(document.Form1.ddlRoomCount1.options[document.Form1.ddlRoomCount1.selectedIndex].value) + parseInt(document.Form1.ddlRoomCount3.options[document.Form1.ddlRoomCount3.selectedIndex].value);
			
			document.Form1.ddlBedTypeCode3.selectedIndex = 0;
			document.Form1.BedTypeCode3.value = "";
			document.Form1.ddlRoomCount3.selectedIndex = 0;	
			document.Form1.RoomCount3.value = "";
		}
	}
	if(document.Form1.ddlBedTypeCode3.options[document.Form1.ddlBedTypeCode3.selectedIndex].value == document.Form1.ddlBedTypeCode2.options[document.Form1.ddlBedTypeCode2.selectedIndex].value)
	{
		if(document.Form1.ddlBedTypeCode3.options[document.Form1.ddlBedTypeCode3.selectedIndex].value !="")
		{		
			document.Form1.BedTypeCode2.value = parseInt(document.Form1.ddlRoomCount2.options[document.Form1.ddlRoomCount2.selectedIndex].value) + parseInt(document.Form1.ddlRoomCount3.options[document.Form1.ddlRoomCount3.selectedIndex].value);
			
			document.Form1.ddlRoomCount2.selectedIndex = parseInt(document.Form1.ddlRoomCount2.options[document.Form1.ddlRoomCount2.selectedIndex].value) + parseInt(document.Form1.ddlRoomCount3.options[document.Form1.ddlRoomCount3.selectedIndex].value);		
			
			document.Form1.ddlBedTypeCode3.selectedIndex = 0;
			document.Form1.BedTypeCode3.value = "";
			document.Form1.ddlRoomCount3.selectedIndex = 0;	
			document.Form1.RoomCount3.value = "";
		}
	}
	
	
	document.Form1.BedTypeCode3.value = document.Form1.ddlBedTypeCode3.options[document.Form1.ddlBedTypeCode3.selectedIndex].value;
	document.Form1.txtClickType.value = 'A';
	
	
}
function ChangeddlRoomCount3()
{
	var FrontRoomCnt = document.Form1.RoomCount3.value;
			
	document.Form1.RoomCount3.value = document.Form1.ddlRoomCount3.options[document.Form1.ddlRoomCount3.selectedIndex].value;			
	var RoomCnt = parseInt(document.Form1.ddlRoomCount1.options[document.Form1.ddlRoomCount1.selectedIndex].value) + parseInt(document.Form1.ddlRoomCount2.options[document.Form1.ddlRoomCount2.selectedIndex].value) +parseInt(document.Form1.ddlRoomCount3.options[document.Form1.ddlRoomCount3.selectedIndex].value);
	
	var RoomCount =3;
	if( getCookie('GNB') == 'jp' || document.Form1.CountryCode.value == 'jp')
	{
		RoomCount = 10;
	}

	if( RoomCnt > RoomCount)
	{
		alert("객실 수는 모두 합하여 "+RoomCount+"개까지입니다. ");
		//Form1.ddlRoomCount3.value = FrontRoomCnt;		
		Form1.ddlRoomCount3.selectedIndex = 0;
		return false;
	}
	else
	{
		document.Form1.txtClickType.value = 'A';
	}
	
	
	
}
function ChangeddlChildAge3()
{		
	document.Form1.ChildAge3.value = document.Form1.ddlChildAge3.options[document.Form1.ddlChildAge3.selectedIndex].value;			
	document.Form1.txtClickType.value = 'A';

}

function ClickLeftSearch(CityCode, LocationCode)
{
	//document.Form1.txtClickType.value = 'B';	
	
	var Duration = document.Form1.Duration.value;
	var BedTypeCode1 = document.Form1.BedTypeCode1.value;
	var BedTypeCode2 = document.Form1.BedTypeCode2.value;
	var BedTypeCode3 = document.Form1.BedTypeCode3.value;
	var RoomCount1 = document.Form1.RoomCount1.value;
	var RoomCount2 = document.Form1.RoomCount2.value;
	var RoomCount3 = document.Form1.RoomCount3.value;
	var ChildAge1 = document.Form1.ChildAge1.value;
	var ChildAge2 = document.Form1.ChildAge2.value;
	var ChildAge3 = document.Form1.ChildAge3.value;
	//var CityCode = document.Form1.txtCityCode.value;
	var CheckInDate = document.Form1.CheckInDate.value;
	var CheckInDateShow = document.Form1.CheckInDateShow.value;
	var CheckOutDateShow = document.Form1.CheckOutDateShow.value;
	var CheckOutDate = document.Form1.CheckOutDate.value;
	var BookingCode = document.Form1.BookingCode.value;
	
	if(LocationCode != null)
		location.href = "/ASPX/Common/Loading.aspx?page="+"HotelProducts/HotelSearchResult.aspx&LoadingMsgID=HotelSearchMsg&CityCode="+CityCode+"&BedTypeCode1="+BedTypeCode1+"&RoomCount1="+RoomCount1+"&ChildAge1="+ChildAge1+"&BedTypeCode2="+BedTypeCode2+"&RoomCount2="+RoomCount2+"&ChildAge2="+ChildAge2+"&BedTypeCode3="+BedTypeCode3+"&RoomCount3="+RoomCount3+"&ChildAge3="+ChildAge3+"&Duration="+Duration+"&CheckInDate="+CheckInDate+"&CheckInDateShow="+escape(CheckInDateShow)+"&CheckOutDate="+CheckOutDate+"&CheckOutDateShow="+escape(CheckOutDateShow)+"&BookingCode="+BookingCode+"&LocationCode="+LocationCode;
	else
		location.href = "/ASPX/Common/Loading.aspx?page="+"HotelProducts/HotelSearchResult.aspx&LoadingMsgID=HotelSearchMsg&CityCode="+CityCode+"&BedTypeCode1="+BedTypeCode1+"&RoomCount1="+RoomCount1+"&ChildAge1="+ChildAge1+"&BedTypeCode2="+BedTypeCode2+"&RoomCount2="+RoomCount2+"&ChildAge2="+ChildAge2+"&BedTypeCode3="+BedTypeCode3+"&RoomCount3="+RoomCount3+"&ChildAge3="+ChildAge3+"&Duration="+Duration+"&CheckInDate="+CheckInDate+"&CheckInDateShow="+escape(CheckInDateShow)+"&CheckOutDate="+CheckOutDate+"&CheckOutDateShow="+escape(CheckOutDateShow)+"&BookingCode="+BookingCode;
}

function ClickLeftSearchL(CityCode,LocationCode)
{
	
	//document.Form1.txtClickType.value = 'B';	
	
	
	var Duration = document.Form1.Duration.value;
	var BedTypeCode1 = document.Form1.BedTypeCode1.value;
	var BedTypeCode2 = document.Form1.BedTypeCode2.value;
	var BedTypeCode3 = document.Form1.BedTypeCode3.value;
	var RoomCount1 = document.Form1.RoomCount1.value;
	var RoomCount2 = document.Form1.RoomCount2.value;
	var RoomCount3 = document.Form1.RoomCount3.value;
	var ChildAge1 = document.Form1.ChildAge1.value;
	var ChildAge2 = document.Form1.ChildAge2.value;
	var ChildAge3 = document.Form1.ChildAge3.value;
	//var CityCode = document.Form1.txtCityCode.value;
	var CheckInDate = document.Form1.CheckInDate.value;
	var CheckInDateShow = document.Form1.CheckInDateShow.value;
	var CheckOutDateShow = document.Form1.CheckOutDateShow.value;
	var CheckOutDate = document.Form1.CheckOutDate.value;
	var BookingCode = document.Form1.BookingCode.value;
	
	
	
		location.href = "/ASPX/Common/Loading.aspx?page="+"HotelProducts/HotelSearchResult.aspx&LoadingMsgID=HotelSearchMsg&CityCode="+CityCode+"&BedTypeCode1="+BedTypeCode1+"&RoomCount1="+RoomCount1+"&ChildAge1="+ChildAge1+"&BedTypeCode2="+BedTypeCode2+"&RoomCount2="+RoomCount2+"&ChildAge2="+ChildAge2+"&BedTypeCode3="+BedTypeCode3+"&RoomCount3="+RoomCount3+"&ChildAge3="+ChildAge3+"&Duration="+Duration+"&CheckInDate="+CheckInDate+"&CheckInDateShow="+escape(CheckInDateShow)+"&CheckOutDate="+CheckOutDate+"&CheckOutDateShow="+escape(CheckOutDateShow)+"&BookingCode="+BookingCode+"&LocationCode="+LocationCode;
}

function getCookie(name)
{
	var prefix = name + "=";
	var cookieStartIndex = document.cookie.indexOf(prefix);

	if (cookieStartIndex == -1)
	{
		return null;
	}

	var cookieEndIndex = document.cookie.indexOf("&", cookieStartIndex + prefix.length);

	if (cookieEndIndex == -1)
	{
		cookieEndIndex = document.cookie.length;
	}

	return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex));
	
}

//***********************************************  world.swf 추가 ***********************************************//
function mEmGET(arrayKey, arrayValue, Value) { 
    count = arrayKey.length; 
    for(i=0;i<count;i++) { 
        if(arrayKey[i]==Value) { 
            return arrayValue[i]; 
            break; 
        } 
    } 
} 
// ie ativeX 출력 변경 함수 
function mEmbed() { 
    var emtype; 
    var key = new Array(); 
    var value = new Array(); 
  // error_check=0; 
    for(i=0;i<mEmbed.arguments.length;i++) { 
        data = mEmbed.arguments[i].split('='); 
        key[i] = data[0]; 
        value[i] = data[1]; 
    } 

    contents = ''; 
    srcdata = mEmGET(key,value,'src').toLowerCase(); 

    classid = mEmGET(key,value,'classid'); 
    codebase = mEmGET(key,value,'codebase'); 
    
    if(/\.(swf)$/.test(srcdata)) { //flash 
        classid = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'; 
        codebase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.c-ab#version=8,0,22,0'; 
        emtype="flash"; 
    } else if(/\.(wmv|wma|asf|avi|wav|asx|mpeg|mp3|midi|aiff|au|wpl|wm|wmx|wmd|wmz)$/.test(srcdata)){//media 
        classid = 'CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95'; 
        codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'; 
        emtype="media"; 
    } 
    if(classid && codebase) { 
        contents += '<object'; 
        if(classid) { 
            contents += ' classid="' + classid + '"'; 
        } 
        if(codebase) { 
            contents += ' codebase="' + codebase + '"'; 
        } 
        count = key.length; 
        for(i=0;i<count;i++) { 
            if(value[i]!='') { 
                if(key[i]!='src') { 
                    contents += ' ' + key[i] + '="' + value[i] + '"'; 
                } 
            } 
        } 
        contents += '>'; 
        for(i=0;i<count;i++) { 
            if(value[i]!='') { 
                if(emtype=='flash' && key[i]=='src') { 
                    contents += '<param name="movie" value="' + value[i] + '" />'; 
                } else  if(emtype=='media' && key[i]=='src') { 
                    contents += '<param name="filename" value="' + value[i] + '" />'; 
                } else { 
                    contents += '<param name="' + key[i] + '" value="' + value[i] + '" />'; 
                } 
            } 
        } 
    } 
    contents += '<embed'; 
    for(i=0;i<count;i++) { 
        if(value[i]!='') { 
            contents += ' ' + key[i] + '="' + value[i] + '"'; 
        } 
    } 
    contents += '>'; 
    contents += '</embed>'; 
    if(classid && codebase) { 
        contents += '</object>'; 
    } 
    document.write(contents); 
    //return contents; 
}


function setFlashWidth(divid, newW) {
	document.all.mapIframe.style.width = newW+"px";
	document.getElementById(divid).style.width = newW+"px";
}
function setFlashHeight(divid, newH) {
	document.all.mapIframe.style.height = newH+"px";
	document.getElementById(divid).style.height = newH+"px";
}
function resizeLayer(divid, newW, newH) {
	setFlashWidth(divid, newW);
	setFlashHeight(divid, newH);
}


