﻿function onload_Eve()
{
    var checkInDate = document.getElementsByName("checkInDate")[0]; 
    var now_date   = new Date();
    var s_year     = now_date.getYear();
    if( s_year<1900) s_year=s_year+1900;
    var s_month    = return0(now_date.getMonth()+1);
    var s_day      = return0(now_date.getDate()+7);
    now_date = new Date(s_year, s_month, s_day)
    s_year     = now_date.getYear();
    if( s_year<1900) s_year=s_year+1900;
    s_month    = return0(now_date.getMonth());
    s_day      = return0(now_date.getDate()+1);
    
	var room_2 = document.all["location1"];         
	    if(checkInDate.value=="")
	    {
       		checkInDate.value = s_year + "-" + s_month + "-" + s_day;
            ValofcheckOutDate();
            room_2.selectedIndex = 1;	                
	    }	  
                  		    
}

function Room_add() {
        var count = 0;
        for(i=1;i<4;i++) {
                name = 'pro'+(i+1);
                if(document.all[name].style.display == "") count++;                    
        }            
        
        if(count == 0) {
                //var room_1 = document.all["r_type1"];       
                //var room_2 = document.all["r_type2"];                                  
                name = 'pro2';
                var pro2 = document.all[name];
                /*
                   var tempHtml = "";
                   if(room_1.selectedIndex == 1)
                   {                        
                        tempHtml +=  "<OPTION value='DBL'>===DOUBLE(2人)===</OPTION> ";  
                        tempHtml +=  "<OPTION value='TRP'>===TWIN(2人)===</OPTION> "  
                        tempHtml +=  "<OPTION value='ETC'>===ETC(4人以上)===</OPTION>";                         
                   }
                   if(room_1.selectedIndex == 2)
                   {  
                        tempHtml +=  "<OPTION value=SGL>===SINGLE(1人)===</OPTION> ";
                        tempHtml +=  "<OPTION value=TRP>===TRIPLE(3人)===</OPTION> "  
                        tempHtml +=  "<OPTION value=ETC>===ETC(4人以上)===</OPTION>";                          
                   }
                   if(room_1.selectedIndex == 3)
                   {  
                        tempHtml +=  "<OPTION value=SGL>===SINGLE(1人)===</OPTION> ";
                        tempHtml +=  "<OPTION value=DBL>===DOUBLE(2人)===</OPTION> "; 
                        tempHtml +=  "<OPTION value=ETC>===ETC(4人以上)===</OPTION>";                            
                   }  
                   if(room_1.selectedIndex == 4)
                   {  
                        tempHtml +=  "<OPTION value=SGL>===SINGLE(1人)===</OPTION> ";
                        tempHtml +=  "<OPTION value=DBL>===DOUBLE(2人)===</OPTION> ";  
                        tempHtml +=  "<OPTION value=TRP>===TRIPLE(3人)===</OPTION> "; 
                  
                   }                                              
                //깨짐 나중에 해결
                //room_2.innerHTML = tempHtml;
                */
                pro2.style.display="";
                
        }
        else if(count == 1) {
                name = 'pro3';
                document.all[name].style.display = "";
        }
        else if(count == 2) {
                name = 'pro4';
                document.all[name].style.display = "";
        }
        else if(count == 3) {
                alert('Not Add Room Type.'); //더이상 룸타입을 추가 하실수 없습니다.');
                return;
        }
}
    
function selNum(param){
	var targetForm = document.form1;
	var r_num = "r_num"+param;
	var r_type = "r_type"+param;
	if(targetForm.elements[r_type].value == '') 
		targetForm.elements[r_num].selectedIndex = 0;
	else 
		targetForm.elements[r_num].selectedIndex = 1;
}
    
function addRoom() {
	var count = 0;
	for(i=1;i<4;i++) {
		name = 'pro'+(i+1);
		if(document.all[name].style.display == "") count++;
	}
	if(count == 0) {
		name = 'pro2'
		document.all[name].style.display = "";
	}
	else if(count == 1) {
		name = 'pro3'
		document.all[name].style.display = "";
	}
	else if(count == 2) {
		name = 'pro4'
		document.all[name].style.display = "";
	}
	else if(count == 3) {
        alert(document.getElementById("hidalert_addroom").value);
        return;
	}
}    


function agent_addRoom() {
	var count = 0;
	for(i=5;i<8;i++) {
		name = 'pro'+(i+1);
		if(document.all[name].style.display == "") count++;
	}
	if(count == 0) {
		name = 'pro6'
		document.all[name].style.display = "";
	}
	else if(count == 1) {
		name = 'pro7'
		document.all[name].style.display = "";
	}
	else if(count == 2) {
		name = 'pro8'
		document.all[name].style.display = "";
	}
	else if(count == 3) {
        alert(document.getElementById("hidalert_addroom").value);
        return;
	}
}    

///////////////////////////////// 호텔검색 유효성 체크 ///////////////////////////////
function hotel_search(no_room, hidSi_Type, page, Type) {

    if(Type != null && (Type == "china" || Type == "world"))
    {
        if(document.getElementById("location1").value == '') 
        {
            //alert('Select City!\n'); //도시를 선택해 주세요!\n');
            alert(document.getElementById("hidalert_selectcity").value); //도시를 선택해 주세요!\n');
            
            if(document.getElementById("type") != null && document.getElementById("type").value != "china" && document.getElementById("type").value != "world")
                document.getElementById("location1").focus();
            return;
        }    
    }

    else if(document.getElementById("category") != null) {      
        if(document.getElementById("category").value == '')
        {
            if((document.getElementById("h_name").value).length <1) 
            {
                if(document.getElementById("location1").value == '') {
                        //alert('Select City!\n'); //도시를 선택해 주세요!\n');
                        alert(document.getElementById("hidalert_selectcity").value); //도시를 선택해 주세요!\n');
                        
                        if(document.getElementById("type") != null && document.getElementById("type").value != "china" && document.getElementById("type").value != "world")
                            document.getElementById("location1").focus();
                            
                        return;
                }
            }
        }	
    }
    else
    {
        if((document.getElementById("h_name").value).length <1) 
        {
            if(document.getElementById("location1").value == '') {
                    //alert('Select City!\n'); //도시를 선택해 주세요!\n');
                    alert(document.getElementById("hidalert_selectcity").value); //도시를 선택해 주세요!\n');
                    
                    if(document.getElementById("type") != null && document.getElementById("type").value != "china" && document.getElementById("type").value != "world")
                        document.getElementById("location1").focus();
                    return;
            }
        }	    
    }
//	 if((document.getElementById("h_name").value).length <1) 
//	{	
//		if(document.getElementById("category") && document.getElementsByName("category"))
//		{		
//			if(document.getElementById("category").id == "category") //호텔재팬 메인
//			{
//				if(document.getElementById("dis_category1").style.display == "") //호텔재팬메인페이지중 호텔 과 료칸 구분
//				{
//					if(document.getElementById("location1").value == "")
//					{
//						alert(document.getElementById("hidalert_selectcity").value); //도시를 선택해 주세요!\n'); 	
//						document.getElementById("location1").focus();
//						 return;
//					}
//				}	
//				else
//				{
//					if(document.getElementById("location11").value == "")
//					{
//						 alert(document.getElementById("hidalert_selectcity").value); //도시를 선택해 주세요!\n'); 
//						 document.getElementById("location11").focus();
//						 return;
//					}
//				}
//			}
//			else //bbc
//			{				
//				if(document.getElementById("location1").value == "")
//				{
//					alert(document.getElementById("hidalert_selectcity").value); //도시를 선택해 주세요!\n'); 
//					document.getElementById("location1").focus();
//					 return;
//				}
//			}
//		}
//		else //그외
//		{			
//			if(document.getElementById("location1").value == "")
//			{
//				alert(document.getElementById("hidalert_selectcity").value); //도시를 선택해 주세요!\n');	
//				document.getElementById("location1").focus();
//				 return;
//			}
//		}
//	}  09-09-14 주석처리

    if(document.getElementById("checkInDate").value == '') {
            alert('Select Checkin!\n'); //체크인 일자를 선택해 주세요!\n');
            document.getElementById("checkInDate").focus();
            return;
    }
    if(document.getElementById("night").value == '') {
            //alert('Select Night!\n'); //박수를 선택해 주세요!\n');
            alert(document.getElementById("hidalert_selectcity").value);
            document.getElementById("night").focus();
            return;
    }
    
    if(no_room == '')
    {
    
        if(document.getElementById("r_type1").value == '' && document.getElementById("r_type2").value == '' && document.getElementById("r_type3").value == '' && document.getElementById("r_type4").value == '') {
                //alert('Select Rooms!\n'); //객실을 적어도 하나는 선택해 주세요\n!');
                alert(document.getElementById("hidalert_selectroom").value); 
                return;
        }
        if(document.getElementById("r_type1").value != '' && document.getElementById("r_num1").value == '0') {
                //alert('Select number of rooms!\n'); //객실수를 선택해 주세요!\n');
                alert(document.getElementById("hidalert_selectroomnum").value); 
                document.getElementsByName("r_num1").focus();
                return;
        }
        if(document.getElementById("r_type2").value != '' && document.getElementById("r_num2").value == '0') {
                //alert('Select number of rooms!\n'); //객실수를 선택해 주세요!\n');
                alert(document.getElementById("hidalert_selectroomnum").value); 
                document.getElementsByName("r_num2").focus();
                return;
        }
        if(document.getElementById("r_type3").value != '' && document.getElementById("r_num3").value == '0') {
                //alert('Select number of rooms!\n'); //객실수를 선택해 주세요!\n');
                alert(document.getElementById("hidalert_selectroomnum").value); 
                document.getElementsByName("r_num3").focus();
                return;
        }
        if(document.getElementById("r_type4").value != '' && document.getElementById("r_num4").value == '0') {
                //alert('Select number of rooms!\n'); //객실수를 선택해 주세요!\n');
                alert(document.getElementById("hidalert_selectroomnum").value); 
                document.getElementsByName("r_num4").focus();
                return;
        }
    }
    
    if(document.form1.location3 != null)
        document.form1.location3.value = "";
    
    if(document.form1.location4 != null)    
        document.form1.location4.value = "";
    
    if(document.form1.location5 != null)        
        document.form1.location5.value = "";
    
    if(document.form1.location6 != null)            
        document.form1.location6.value = "";
    
    //호텔인포 저팬 구분
    var arg1 = '', arg2 = '';    
    if(hidSi_Type != '')
    {
        arg1 = '?hidSi_Type=' + hidSi_Type 
        arg2 = '&hidSi_Type=' + hidSi_Type 
    }
    
    if(document.getElementById("OnlyBlock") != null && document.getElementById("OnlyBlock").value == "1")
    {
        if(arg1 != "")
        {
            arg1 = arg1 + "&OnlyBlock=1";
            arg2 = arg2 + "&OnlyBlock=1";
        }
        else if(arg1 == "")
        {
            arg1 = "?OnlyBlock=1";
            arg2 = "&OnlyBlock=1";
        }
    }
    
    if(document.getElementById("location1")[1] != null && document.getElementById("location1")[1].na_code != null && document.getElementById("location1")[1].na_code == "3") // && document.getElementById("ddlNation") != null)
    {
        var _strLocation = document.getElementById("location1")[document.getElementById("location1").selectedIndex].na_code;

        if(document.getElementById("ddlNation") != null && document.getElementById("ddlNation").value == "" && _strLocation == null)
        {
            alert("国を入力してください");
            document.getElementById("ddlNation").focus();
            return;
        }
        
        else if(document.getElementById("ddlNation") != null && document.getElementById("ddlNation").value != "")
        {
            if(arg1 != "")
            {
                arg1 = arg1 + "&na_code=" + document.getElementById("ddlNation").value;
                arg2 = arg2 + "&na_code=" + document.getElementById("ddlNation").value;
            }
            else if(arg1 == "")
            {
                arg1 = "?na_code=" + document.getElementById("ddlNation").value;
                arg2 = "&na_code=" + document.getElementById("ddlNation").value;
            }
        }
        
        else if(_strLocation != "")
        {
            if(arg1 != "")
            {
                arg1 = arg1 + "&na_code=" + _strLocation;
                arg2 = arg2 + "&na_code=" + _strLocation;
            }
            else if(arg1 == "")
            {
                arg1 = "?na_code=" + _strLocation;
                arg2 = "&na_code=" + _strLocation;
            }
        }

    }
    
    if(page != null)
    {
        if(arg1 != "")
        {
            arg1 = arg1 + "&page=" + page;
            arg2 = arg2 + "&page=" + page;
        }
        else if(arg1 == "")
        {
            arg1 = "?page=" + page;
            arg2 = "&page=" + page;
        }
    }
    
    if(Type != null && Type != "map")
    {
        if(arg1 != "")
        {
            arg1 = arg1 + "&type=" + Type;
            arg2 = arg2 + "&type=" + Type;
        }
        else if(arg1 == "")
        {
            arg1 = "?type=" + Type;
            arg2 = "&type=" + Type;
        }
    }
    
    if(Type != null && Type == "map")
        document.form1.action = "../reservation/hotel_search_map.aspx"+arg1;
    else if(no_room == '')
        document.form1.action = "../reservation/hotel_search_list.aspx"+arg1;
    else if(document.form1.r_type1.value != '' && document.form1.r_num1.value != '0')
        document.form1.action = "../reservation/hotel_search_list.aspx"+arg1;
    else    
        document.form1.action = "../reservation/hotel_search_list.aspx?no_room_type=" + no_room + arg2;
    
    if(document.getElementById('divMain') != null)
        document.getElementById('divMain').style.display='none';
        
    if(document.getElementById('all') != null)
        document.getElementById('all').style.display='none';
        
    if(document.getElementById('loading') != null)
		InsertScriptToHead();

	document.form1.submit();
}

function InsertScriptToHead()
{
	var head= document.getElementsByTagName('head')[0];		
	var script= document.createElement('script');
	script.type= 'text/javascript';		
	script.charset = "euc-kr";
	script.src = "../../javascript/activex.js";
	head.appendChild(script);       
	var loaded = false;	
	if(navigator.appName == "Microsoft Internet Explorer"){
		script.onreadystatechange= function () {
			if (this.readyState == 'loaded' || this.readyState == 'complete') {
				if (loaded) {
					return;
				}
				loaded = true;
				document.getElementById("loading").style.display = "";
				if(document.getElementById("scrollBar") != null)
					document.getElementById("scrollBar").style.display = "";
			}
		}
	}
	else if(navigator.appName == "Netscape"){
		//script.onload = function () {			
			document.getElementById("loading").style.display = "";
			if(document.getElementById("scrollBar") != null)
					document.getElementById("scrollBar").style.display = "";
		//}
	}

}

function agent_hotel_search(no_room, hidSi_Type) {
    
    if(document.form1.category1 != null) {        
        if(document.form1.category1.value == '')
        {
            if((document.form1.h_name1.value).length <1) 
            {
                if(document.form1.location3.value == '') {
                        //alert('Select City!\n'); //도시를 선택해 주세요!\n');
                        alert(document.getElementById("hidalert_selectcity").value); //도시를 선택해 주세요!\n');
                        document.form1.location3.focus();
                        return;
                }
            }
        }	
    }
    else
    {
        if((document.form1.h_name1.value).length <1) 
        {
            if(document.form1.location3.value == '') {
                    //alert('Select City!\n'); //도시를 선택해 주세요!\n');
                    alert(document.getElementById("hidalert_selectcity").value); //도시를 선택해 주세요!\n');
                    document.form1.location3.focus();
                    return;
            }
        }	    
    }

    if(document.form1.checkInDate1.value == '') {
            alert('Select Checkin!\n'); //체크인 일자를 선택해 주세요!\n');
            document.form1.checkInDate1.focus();
            return;
    }
    if(document.form1.night1.value == '') {
            alert('Select Night!\n'); //박수를 선택해 주세요!\n');
            document.form1.night1.focus();
            return;
    }
    if(no_room == '')
    {
    
        if(document.form1.r_type5.value == '' && document.form1.r_type6.value == '' && document.form1.r_type7.value == '' && document.form1.r_type8.value == '') {
                //alert('Select Rooms!\n'); //객실을 적어도 하나는 선택해 주세요\n!');
                alert(document.getElementById("hidalert_selectroom").value); 
                return;
        }
        if(document.form1.r_type5.value != '' && document.form1.r_num5.value == '0') {
                //alert('Select number of rooms!\n'); //객실수를 선택해 주세요!\n');
                alert(document.getElementById("hidalert_selectroomnum").value); 
                document.form1.r_num1.focus();
                return;
        }
        if(document.form1.r_type6.value != '' && document.form1.r_num6.value == '0') {
                //alert('Select number of rooms!\n'); //객실수를 선택해 주세요!\n');
                alert(document.getElementById("hidalert_selectroomnum").value); 
                document.form1.r_num2.focus();
                return;
        }
        if(document.form1.r_type7.value != '' && document.form1.r_num7.value == '0') {
                //alert('Select number of rooms!\n'); //객실수를 선택해 주세요!\n');
                alert(document.getElementById("hidalert_selectroomnum").value); 
                document.form1.r_num3.focus();
                return;
        }
        if(document.form1.r_type8.value != '' && document.form1.r_num8.value == '0') {
                //alert('Select number of rooms!\n'); //객실수를 선택해 주세요!\n');
                alert(document.getElementById("hidalert_selectroomnum").value); 
                document.form1.r_num4.focus();
                return;
        }
    }
        
    document.form1.h_name.value = document.form1.h_name1.value;
    document.form1.location1.value = "";
    document.form1.location2.value = "";
    
    if(document.form1.location5 != null)
        document.form1.location5.value = "";
    
    if(document.form1.location6 != null)    
        document.form1.location6.value = "";
        
    document.form1.checkInDate.value = document.form1.checkInDate1.value;
    document.form1.checkOutDate.value = document.form1.checkOutDate1.value;
    document.form1.night.value = document.form1.night1.value;
    document.form1.r_type1.value = document.form1.r_type5.value;
    document.form1.r_type2.value = document.form1.r_type6.value;
    document.form1.r_type3.value = document.form1.r_type7.value;
    document.form1.r_type4.value = document.form1.r_type8.value;
    document.form1.r_num1.value = document.form1.r_num5.value;
    document.form1.r_num2.value = document.form1.r_num6.value;
    document.form1.r_num3.value = document.form1.r_num7.value;
    document.form1.r_num4.value = document.form1.r_num8.value;
    
    
    //호텔인포 저팬 구분
    var arg1 = '', arg2 = '';    
    if(hidSi_Type != '')
    {
        arg1 = '?hidSi_Type=' + hidSi_Type 
        arg2 = '&hidSi_Type=' + hidSi_Type 
    }
    
    if(no_room == '')
        document.form1.action = "../reservation/hotel_search_list.aspx"+arg1;
    else if(document.form1.r_type5.value != '' && document.form1.r_num5.value != '0')
        document.form1.action = "../reservation/hotel_search_list.aspx"+arg1;
    else    
        document.form1.action = "../reservation/hotel_search_list.aspx?no_room_type=" + no_room + arg2;
        
    if(document.getElementById('divMain') != null)
        document.getElementById('divMain').style.display='none';
        
    if(document.getElementById('body_bg') != null)
        document.getElementById('body_bg').style.display='none';
        
    if(document.getElementById('loading') != null)
        document.getElementById('loading').style.display='';

	document.form1.submit();
}

function agent_hotel_search_china(no_room, hidSi_Type) {
    
    if((document.form1.h_name2.value).length <1) 
    {
        if(document.form1.location5.value == '') {
                //alert('Select City!\n'); //도시를 선택해 주세요!\n');
                alert(document.getElementById("hidalert_selectcity").value); //도시를 선택해 주세요!\n');
                document.form1.location5.focus();
                return;
        }
    }	

    if(document.form1.checkInDate2.value == '') {
            alert('Select Checkin!\n'); //체크인 일자를 선택해 주세요!\n');
            document.form1.checkInDate2.focus();
            return;
    }
    if(document.form1.night2.value == '') {
            alert('Select Night!\n'); //박수를 선택해 주세요!\n');
            document.form1.night2.focus();
            return;
    }
    if(no_room == '')
    {
        if(document.form1.r_type9.value != '' && document.form1.r_num9.value == '0') {
                //alert('Select number of rooms!\n'); //객실수를 선택해 주세요!\n');
                alert(document.getElementById("hidalert_selectroomnum").value); 
                document.form1.r_num1.focus();
                return;
        }
    }
        
    document.form1.h_name.value = document.form1.h_name2.value;
    document.form1.location1.value = "";
    document.form1.location2.value = "";
    document.form1.location3.value = "";
    document.form1.location4.value = "";
    document.form1.checkInDate.value = document.form1.checkInDate2.value;
    document.form1.checkOutDate.value = document.form1.checkOutDate2.value;
    document.form1.night.value = document.form1.night2.value;
    document.form1.r_type1.value = document.form1.r_type9.value;
    document.form1.r_num1.value = document.form1.r_num9.value;

    //호텔인포 저팬 구분
    var arg1 = '', arg2 = '';    
    if(hidSi_Type != '')
    {
        arg1 = '?hidSi_Type=' + hidSi_Type 
        arg2 = '&hidSi_Type=' + hidSi_Type 
    }

    if(document.getElementById("location5")[1].na_code != null && document.getElementById("location5")[1].na_code == "3") // && document.getElementById("ddlNation") != null)
    {
        var _strLocation = document.getElementById("location5")[document.getElementById("location5").selectedIndex].na_code;

        if(document.getElementById("ddlNation") != null && document.getElementById("ddlNation").value == "" && _strLocation == null)
        {
            alert("国を入力してください");
            document.getElementById("ddlNation").focus();
            return;
        }
        
        else if(document.getElementById("ddlNation") != null && document.getElementById("ddlNation").value != "")
        {
            if(arg1 != "")
            {
                arg1 = arg1 + "&na_code=" + document.getElementById("ddlNation").value;
                arg2 = arg2 + "&na_code=" + document.getElementById("ddlNation").value;
            }
            else if(arg1 == "")
            {
                arg1 = "?na_code=" + document.getElementById("ddlNation").value;
                arg2 = "&na_code=" + document.getElementById("ddlNation").value;
            }
        }
        
        else if(_strLocation != "")
        {
            if(arg1 != "")
            {
                arg1 = arg1 + "&na_code=" + _strLocation;
                arg2 = arg2 + "&na_code=" + _strLocation;
            }
            else if(arg1 == "")
            {
                arg1 = "?na_code=" + _strLocation;
                arg2 = "&na_code=" + _strLocation;
            }
        }

    }
    
    if(no_room == '')
        document.form1.action = "../reservation/hotel_search_list.aspx"+arg1;
    else if(document.form1.r_type5.value != '' && document.form1.r_num5.value != '0')
        document.form1.action = "../reservation/hotel_search_list.aspx"+arg1;
    else    
        document.form1.action = "../reservation/hotel_search_list.aspx?no_room_type=" + no_room + arg2;
        
    if(document.getElementById('divMain') != null)
        document.getElementById('divMain').style.display='none';
        
    if(document.getElementById('body_bg') != null)
        document.getElementById('body_bg').style.display='none';
        
    if(document.getElementById('loading') != null)
        document.getElementById('loading').style.display='';

	document.form1.submit();
}


///////////////////////////////// 호텔검색 submit 데이터 재설정///////////////////////////////
function SetIndex(ctr, text)
{	
	var boxLength = ctr.length;
	if (boxLength != 0) {
		for (i = 0; i < boxLength; i++) {
			thisitem = ctr[i].value;
			if (thisitem == text) {
				ctr.selectedIndex = i;
				return false;
			}
	   }
	} 
}

function PostDataBind(args)
{	
    var ctr = document.form1;
    
    if(arguments[16] != null && arguments[16] != "" && arguments[16] != "State" && arguments[16] != "None")
    {
        SetIndex(ctr.ddlNation, arguments[17]);
        SetNationIndex();
    }
  
    ctr.h_name.value = arguments[0];
    
    if(ctr.h_name.value != "")
        ctr.h_name.style.backgroundImage="";
    
    SetIndex(ctr.night, arguments[1]);
//    if(arguments[4] == "l_Onsen")
//	{ 		
//		SetIndex(ctr.location11, arguments[2]);
//		changeGroupRyokan();
//		SetIndex(ctr.location22, arguments[3]);
//	}
//	else
//	{	
		SetIndex(ctr.location1, arguments[2]);
		
		if(arguments[16] != null && arguments[16] == "State")  
		{
		    ctr.location1.value = arguments[2];
		    changeLocation("State","0", arguments[3]);
		}
        
		SetIndex(ctr.location2, arguments[3]);
//	}
	
    SetIndex(ctr.h_level, arguments[4]);
    ctr.checkInDate.value = arguments[5];    
    ctr.checkOutDate.value = arguments[6];  
    SetIndex(ctr.r_num1, arguments[7]);
    
    if(ctr.r_num2)
        SetIndex(ctr.r_num2, arguments[8]);
        
    if(ctr.r_num3)
        SetIndex(ctr.r_num3, arguments[9]);
        
    if(ctr.r_num4)
        SetIndex(ctr.r_num4, arguments[10]);
        
    SetIndex(ctr.r_type1, arguments[11]);
    
    if(ctr.r_type2)
        SetIndex(ctr.r_type2, arguments[12]);
        
    if(ctr.r_type3)
        SetIndex(ctr.r_type3, arguments[13]);
        
    if(ctr.r_type4)
        SetIndex(ctr.r_type4, arguments[14]);
        
    if(ctr.days)
        ctr.days.value = arguments[15];	
    
    if(arguments[12] != "")  
        document.all["pro2"].style.display = "";
        
    if(arguments[13] != "")  
        document.all["pro3"].style.display = "";

    if(arguments[14] != "")  
        document.all["pro4"].style.display = "";
        
    if(arguments[17] != null && arguments[17] != "")  
        SetIndex(ctr.Na_code, arguments[17]);
    
}
///////////////////////////////// 식사 제공 여부 ///////////////////////////////

//xslt sort
//검색 결과 리스트 SORT
function sort_xslt(code, hidSi_Type, page)    
{    
        var h_sort_1 = document.getElementsByName("h_sort_1")[0]; 
	    var h_sort_2 = document.getElementsByName("h_sort_2")[0]; 
	    var h_sort_3 = document.getElementsByName("h_sort_3")[0]; 
	    var h_sort_4 = document.getElementsByName("h_sort_4")[0]; 
	    var h_sort = document.getElementsByName("h_sort")[0]; 	    
        
        //즉시예약 + 낮은 가격순
        if(code=="1")
        {
            if(h_sort_1.value=="DOWN"||h_sort_1.value=="")
            {
                h_sort_1.value = "UP";       
            }
            else if(h_sort_1.value=="UP")
            {
                h_sort_1.value = "DOWN";     
            }
        }    
        else if(code =="2")
        {
            if(h_sort_2.value=="UP" || h_sort_2.value=="")
            {
                h_sort_2.value = "DOWN";       
            }
            else if(h_sort_2.value=="DOWN")
            {
                h_sort_2.value = "UP";     
            }
        } 	
        else if(code =="3")
        {
            if(h_sort_3.value=="UP"||h_sort_3.value=="")
            {
                h_sort_3.value = "DOWN";       
            }
            else if(h_sort_3.value=="DOWN")
            {
                h_sort_3.value = "UP";     
            }
        } 		          	       		    
   		else if(code =="4")
        {
            if(h_sort_4.value=="UP"||h_sort_4.value=="")
            {
                h_sort_4.value = "DOWN";       
            }
            else if(h_sort_4.value=="DOWN")
            {
                h_sort_4.value = "UP";     
            }
        } 		 
        
        h_sort.value = code;

        if(page != null)
            hotel_search('',hidSi_Type,page);
            
        else
            hotel_search('',hidSi_Type);      		       		       		    
}

//xslt sort
//검색 결과 리스트 SORT(호텔재팬 DDL용)
function sort_xslt_ddl(code, hidSi_Type)    
{    
        var h_sort_1 = document.getElementsByName("h_sort_1")[0]; 
	    var h_sort_2 = document.getElementsByName("h_sort_2")[0]; 
	    var h_sort_3 = document.getElementsByName("h_sort_3")[0]; 
	    var h_sort_4 = document.getElementsByName("h_sort_4")[0]; 
	    var h_sort = document.getElementsByName("h_sort")[0]; 	    
        
        //즉시예약 + 낮은 가격순
        if(code=="1")
        {
            h_sort_1.value = "DOWN"
        } 
        else if(code=="2")
        {
            h_sort_1.value = "UP";
            code="1"
        }   
        else if(code =="3")
        {
            h_sort_2.value = "DOWN";       
            code="2"
        } 	
        else if(code =="4")
        {
            h_sort_2.value = "UP";
            code="2"
        } 
        else if(code =="5")
        {
            if(h_sort_3.value=="UP"||h_sort_3.value=="")
            {
                h_sort_3.value = "DOWN";       
            }
            else if(h_sort_3.value=="DOWN")
            {
                h_sort_3.value = "UP";     
            }
            code="3"
        } 		          	       		    
   		else if(code =="6")
        {
            if(h_sort_4.value=="UP"||h_sort_4.value=="")
            {
                h_sort_4.value = "DOWN";       
            }
            else if(h_sort_4.value=="DOWN")
            {
                h_sort_4.value = "UP";     
            }
            code="4"
        } 		 
        
        h_sort.value = code;	
        
        hotel_search('',hidSi_Type);  	       		       		    
}

//xslt sort
//검색 결과 리스트 SORT 세팅(호텔재팬 DDL용)
function sort_xslt_ddl_set()    
{    
        var h_sort_1 = document.getElementsByName("h_sort_1")[0]; 
	    var h_sort_2 = document.getElementsByName("h_sort_2")[0]; 
	    var h_sort_3 = document.getElementsByName("h_sort_3")[0]; 
	    var h_sort_4 = document.getElementsByName("h_sort_4")[0]; 
	    var h_sort = document.getElementsByName("h_sort")[0]; 	    
        
        //즉시예약 + 낮은 가격순
        if(h_sort_1.value == "DOWN" && h_sort.value == "1")
           document.getElementById("ddlsort").options[1].selected = true;
           
        else if(h_sort_1.value == "UP" && h_sort.value == "1")
            document.getElementById("ddlsort").options[2].selected = true;
            
        else if(h_sort_2.value == "DOWN" && h_sort.value == "2")
            document.getElementById("ddlsort").options[3].selected = true;
            
        else if(h_sort_2.value == "UP" && h_sort.value == "2")
            document.getElementById("ddlsort").options[4].selected = true;
            
        else if(h_sort.value == "3")
            document.getElementById("ddlsort").options[5].selected = true;
            
   		else if(h_sort.value == "4")
            document.getElementById("ddlsort").options[6].selected = true;       		       		    
}

//식사 상태 정보
function Break_Food(request_breack_use, request_breack_inc, request_dinner_use, request_dinner_inc, i)
{
    if(request_breack_use == 1)
        request_breack_use = 1;
    else
        request_breack_use = 0;
        
    if(request_breack_inc == 1)
        request_breack_inc = 1;
    else
        request_breack_inc = 0;
        
    if(request_dinner_use == 1)    
        request_dinner_use = 1;
    else
        request_dinner_use = 0;
        
    if(request_dinner_inc == 1)    
        request_dinner_inc = 1;
    else        
        request_dinner_inc = 0;

     
    if(arguments[5] != null)
    {
        if(arguments[5] == 1)
        {
            var spanfood = document.getElementsByName("spanfood["+i+"]")[0];
            Set_Room_Food(request_breack_use, request_breack_inc, request_dinner_use, request_dinner_inc, spanfood, '1');
        }
    } 
    else
    {
        var spanfood = document.getElementsByName("spanfood["+i+"]")[0];
        Set_Room_Food(request_breack_use, request_breack_inc, request_dinner_use, request_dinner_inc, spanfood, '1');
    }  
}

//룸별 식사 상태 정보
function Break_Room_Food(request_breack_use, request_breack_inc, request_dinner_use, request_dinner_inc, i, j)
{
    if(request_breack_use == 1)
        request_breack_use = 1;
    else
        request_breack_use = 0;
        
    if(request_breack_inc == 1)
        request_breack_inc = 1;
    else
        request_breack_inc = 0;
        
    if(request_dinner_use == 1)    
        request_dinner_use = 1;
    else
        request_dinner_use = 0;
        
    if(request_dinner_inc == 1)    
        request_dinner_inc = 1;
    else        
        request_dinner_inc = 0;

    if(j == 1)
    {
        var spanfood = document.getElementsByName("spanfood["+i+"]["+j+"]")[0];
        Set_Room_Food(request_breack_use, request_breack_inc, request_dinner_use, request_dinner_inc, spanfood, '2');
    }
}

///식사 설정
function Set_Room_Food(request_breack_use, request_breack_inc, request_dinner_use, request_dinner_inc, spanfood, div)
{
    var doc = document.form1;

    if(document.getElementById("si_currency") != null)
    {
        if(document.getElementById("si_currency").value == "KRW")
        {
            var si_currency = "<img src='http://image.bico.jp/Site/100002/ko/mark_won_03.gif'/>";
        }
        
        if(document.getElementById("si_lang").value == "ko")
        {
            var beack_lang = " 조식요금 :";
            var diner_lang = " 석식요금 :";
        }
        
        if(document.getElementById("si_currency").value == "JPY")
        {
            var si_currency = "<img src='http://image.bico.jp/Site/100002/ko/mark_yen_03.gif'/>";
        }
        
        if(document.getElementById("si_lang").value == "ja")
        {
            var beack_lang = " 朝食料金 :";
            var diner_lang = " 夕食料金 :";
        }
        
        if(document.getElementById("si_currency").value == "USD")
        {
            var si_currency = "<img src='http://image.bico.jp/Site/100002/ko/mark_dol_03.gif'/>";
        }
        
        if(document.getElementById("si_lang").value == "en")
        {
            var beack_lang = " Breakfast Price :";
            var diner_lang = " Diner Price :";
        }
        
        if(document.getElementById("si_lang").value == "zh")
        {
            var beack_lang = " 早餐费用 :";
            var diner_lang = " 晚餐價格 :";
        }

        var TempHtml = "";
        if(request_breack_use == "1")
        {
	        if(request_breack_inc == "1")
	        {			
	        //조식제공 (선택사항)
                TempHtml += document.getElementById("txt_breack_o_inc").value + beack_lang + si_currency + formatCurrency((document.getElementById("h_break").value * document.getElementById("Exchange").value),0) + " ";				
	        }
	        else
	        {
	        //조식 불포함 (추가선택가능)
                TempHtml += document.getElementById("txt_breack_x_inc").value + beack_lang + si_currency + formatCurrency((document.getElementById("h_break").value * document.getElementById("Exchange").value),0) +  " ";				                
	        }			
        }
        if(request_breack_use == "0")
        {
	        if(request_breack_inc == "1")
	        {			
	        //조식제공
                TempHtml += document.getElementById("txt_breack_o").value +" ";	
	        }
	        else
	        {
	        //조식불포함
                TempHtml += document.getElementById("txt_breack_x").value + " ";				
	        }			
        }		

        if(request_dinner_use == "1")
        {
	        if(request_dinner_inc == "1")
	        {					
	        //석식 제공 (선택가능)
                TempHtml += document.getElementById("txt_dinner_o_inc").value + diner_lang + si_currency + formatCurrency((document.getElementById("h_dinner").value * document.getElementById("Exchange").value),0);					
	        }
	        else
	        {
	        //석식불포함 (추가선택가능)
		        TempHtml += document.getElementById("txt_dinner_x_inc").value + diner_lang + si_currency + formatCurrency((document.getElementById("h_dinner").value * document.getElementById("Exchange").value),0);
	        }
        	
        }
        if(request_dinner_use == "0")
        {
	        if(request_dinner_inc == "1")
	        {	
	        //석식제공
		        TempHtml += document.getElementById("txt_dinner_o").value;					
	        }
	        else
	        {
	        //석식불포함
		        //TempHtml += doc.txt_dinner_x.value;					
	        }					
        }
    }

    else
    {
    var TempHtml = "";
	if(request_breack_use == "1")
	{
		if(request_breack_inc == "1")
		{			
		//조식제공 (선택사항)
            TempHtml += document.getElementById("txt_breack_o_inc").value + "  ";				
		}
		else
		{
		//조식 불포함 (추가선택가능)
            TempHtml += document.getElementById("txt_breack_x_inc").value + "  ";				
		}			
	}
	if(request_breack_use == "0")
	{
		if(request_breack_inc == "1")
		{			
		//조식제공
            TempHtml += document.getElementById("txt_breack_o").value +"  ";	
		}
		else
		{
		//조식불포함
            TempHtml += document.getElementById("txt_breack_x").value + "  ";				
		}			
	}		
	
    if(request_dinner_use == "1")
    {
		if(request_dinner_inc == "1")
		{					
		//석식 제공 (선택가능)
            TempHtml += document.getElementById("txt_dinner_o_inc").value;					
		}
		else
		{
		//석식불포함 (추가선택가능)
			TempHtml += document.getElementById("txt_dinner_x_inc").value;						
		}
		
	}
	if(request_dinner_use == "0")
	{
		if(request_dinner_inc == "1")
		{	
		//석식제공
			TempHtml += document.getElementById("txt_dinner_o").value;					
		}
		else
		{
		//석식불포함
			//TempHtml += doc.txt_dinner_x.value;					
		}					
	}	
	}

    //if(div == '2')
    //    TempHtml = TempHtml.replaceAll("<br>","&nbsp;");
    //TempHtml = TempHtml.substr(0, TempHtml.length-2);
    //TempHtml = TempHtml.replaceAll(",","&nbsp;");
    spanfood.innerHTML	= TempHtml;	
}

//원하는 문자열 전부 replace 하기
String.prototype.replaceAll = function(from, to) { 
return this.replace(new RegExp(from, "g"), to); 
} 

/////////////////////////////////////// 금액 재계산 하기
function round (n, d) {
	n = n - 0;
	d = d || 2;

	var f = Math.pow(10, d);
	n = Math.ceil(n * f) / f;
	n += Math.pow(10, - (d + 1));
	n += '';

	return d == 0 ? n.substring(0, n.indexOf('.')) : n.substring(0, n.indexOf('.') + d + 1);
}

///통화형으로 변환
function formatCurrency (n, d) {
	n = round (n, d);

	for (var i = n.indexOf('.') - 3; i > 0; i -= 3) {
		n = n.substring(0, i) + ',' + n.substring (i);
	}
	n = n.substring(0, n.indexOf('.'));
	return n;
}

function Check_Price_M(param,param1,price_currency,site_currency,flgCurrencyDisplay)
{
     var ROOM_TYPE_CNT = document.getElementsByName("ROOM_TYPE_CNT["+param+"]")[0];          
     var span_price = document.getElementsByName("span_price["+param+"]")[0]; 
     //var addnight = document.getElementsByName("addnight["+param+"]")[0];                    

     var total_price=0;
     var total_price_r = 0;         
     var ntemp = 0;
     
     for(var i=0;i<ROOM_TYPE_CNT.value;i++)
     {
         var t = i+1;
         var room_type = document.getElementsByName("room_type["+param+"]["+t+"]")[0];            
         
         if(room_type.checked==true)
         {
            var room_price = document.getElementsByName("room_price["+param+"]["+t+"]")[0];
            var room_priceW = document.getElementsByName("room_priceW["+param+"]["+t+"]")[0]; 
            
            //total_price = parseInt(total_price) + parseInt(room_price.value);
            //total_price_r = parseInt(total_price_r) + parseInt(room_priceW.value);   
            total_price = total_price + Math.ceil(room_price.value);
            total_price_r = total_price_r + Math.ceil(room_priceW.value);   
                         
         }  
     }     
     
    var room_priceStr  = formatCurrency(total_price,0);
	var room_price2Str = formatCurrency(total_price_r,0);     

    var p_currency = GetCurrencyFlg(price_currency);

    if(flgCurrencyDisplay == "A")
    {
        if(price_currency != site_currency)
        {        
            span_price.innerHTML  = '<b>'+p_currency+'<FONT class=jp_tx_cost>' + room_priceStr + '</FONT> <FONT class=jp_tx_cost3>(' + GetCurrencyFlg(site_currency) +	room_price2Str  + ')</FONT></b>&nbsp;&nbsp;';
        }
        else
        {
            span_price.innerHTML  = '<b>'+p_currency+'<FONT class=jp_tx_cost>' + room_priceStr + '</FONT> </b>&nbsp;&nbsp;';
        }
    } 
    
    if(flgCurrencyDisplay == "H")
    {
        span_price.innerHTML  = '<b>'+p_currency+'<FONT class=jp_tx_cost>' + room_priceStr + '</FONT> </b>;';
    }
    
    if(flgCurrencyDisplay == "S")
    {
        span_price.innerHTML  = '<b>'+GetCurrencyFlg(site_currency)+'<FONT class=jp_tx_cost3>' + room_price2Str + '</FONT> </b>';
        
        if(site_currency == "USD")
             span_price.innerHTML  = span_price.innerHTML + '(<b>'+p_currency+'<font style="font-size:14px;font-weight:bold;">' + room_priceStr + '</font> </b>)';
    }   
                              
}

function search() {
	if(form1.location1.value == 0) {
		alert('Not Selected CityName.');
		form1.location1.focus();
		return;
	}

	form1.action = 'hotel_search_list.aspx';
	form1.submit();
}

//예약 페이지로 이동
function goHotel(h_code, hidSi_Type)
{
    if(hidSi_Type == null)
        document.location.href="../reservation/reservation_input.aspx?h_code="+h_code;
    else
        document.location.href="../reservation/reservation_input.aspx?h_code="+h_code+"&hidSi_Type="+hidSi_Type;
    
    //parent.document.location.href="../reservation/reservation_input.aspx?h_code="+h_code;
}

function go_RecomHotel(h_code, location1)
{  
	var locationUrl;

    if(location1 == null)
        locationUrl="../reservation/reservation_input.aspx?h_code="+h_code;
    else
        locationUrl="../reservation/reservation_input.aspx?h_code="+h_code+"&location1="+location1;    
    
	document.location.href =  locationUrl;
    
    //parent.document.location.href="../reservation/reservation_input.aspx?h_code="+h_code;
}

function go_AgentRecomHotel(h_code, location1, hidSi_Type)
{
    if(location1 == null)
        document.location.href="../reservation/reservation_input.aspx?h_code="+h_code+"&hidSi_Type="+hidSi_Type;
    else
        document.location.href="../reservation/reservation_input.aspx?h_code="+h_code+"&location1="+location1+"&hidSi_Type="+hidSi_Type;
    
    //parent.document.location.href="../reservation/reservation_input.aspx?h_code="+h_code;
}

function delRoom() {
        var count = 0;
        for(i=1;i<4;i++) {
                name = 'pro'+(i+1);
                if(document.all[name].style.display == "") count++;
        }
		if(count == 3) {
                name = 'pro4'
				document.getElementById("r_type4").selectedIndex = 0;
                document.all[name].style.display = "none";
        }
		else if(count == 2) {
                name = 'pro3'
				document.getElementById("r_type3").selectedIndex = 0;
                document.all[name].style.display = "none";
        }
        else if(count == 1) {
                name = 'pro2'                
				document.getElementById("r_type2").selectedIndex = 0;
                document.all[name].style.display = "none";
        }
        else if(count == 0) {
                //alert('Not Delete Room Type.'); //더이상 룸타입을 삭제 하실수 없습니다.');
                alert(document.getElementById("hidalert_delroom").value);
                return;
        }
}


function agent_delRoom() {
        var count = 0;
        for(i=5;i<8;i++) {
                name = 'pro'+(i+1);
                if(document.all[name].style.display == "") count++;
        }
		if(count == 3) {
                name = 'pro8'
				document.form1.r_type4.selectedIndex = 0;
                document.all[name].style.display = "none";
        }
		else if(count == 2) {
                name = 'pro7'
				document.form1.r_type3.selectedIndex = 0;
                document.all[name].style.display = "none";
        }
        else if(count == 1) {
                name = 'pro6'
				document.form1.r_type2.selectedIndex = 0;
                document.all[name].style.display = "none";
        }
        else if(count == 0) {
                //alert('Not Delete Room Type.'); //더이상 룸타입을 삭제 하실수 없습니다.');
                alert(document.getElementById("hidalert_delroom").value);
                return;
        }
}

function cancellation() { 
    window.open('../hoteljapan/etc/cancellation.html','cancellation','left=50, top=50, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=730, height=552"'); 
}
/*
function delRoom() {
        var count = 0;
        for(i=1;i<4;i++) {
                name = 'pro'+(i+1);
                if(document.all[name].style.display == "") count++;
        }
		if(count == 3) {
                name = 'pro4'
				document.form1.r_type4.selectedIndex = 0;
                document.all[name].style.display = "none";
        }
		else if(count == 2) {
                name = 'pro3'
				document.form1.r_type3.selectedIndex = 0;
                document.all[name].style.display = "none";
        }
        else if(count == 1) {
                name = 'pro2'
				document.form1.r_type2.selectedIndex = 0;
                document.all[name].style.display = "none";
        }
        else if(count == 0) {
                alert('Not Delete Room Type.'); //더이상 룸타입을 삭제 하실수 없습니다.');
                return;
        }
}
*/
function an(param) 
{ 
	window.open('../etc/an.aspx?lang='+param,'','left=50, top=50, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=600, height=550"'); 
}

var C_FLAG = "up";

function hotelsearch_Control(divname) 
{
 
    switch(parseInt(divname)) 
    {  
   
        case 1 : 
            document.getElementById("hotel_title_01").src = "http://image.bico.jp/Site/100002/ko/v6/img/hotel_search2_btn1.gif";
            document.getElementById("hotel_title_02").src = "http://image.bico.jp/Site/100002/ko/v6/img/hotel_search2_btn2_off.gif";
            document.getElementById("r_type1").options[1].selected = true;
            document.getElementById("h_level").options[0].selected = true;
            document.getElementById("dis_category1").style.display = "";
			document.getElementById("location1").selectedIndex = 0;
			document.getElementById("location2").selectedIndex = 0;
            document.getElementById("dis_category2").style.display = "none";
        break;
        case 2 : 
            document.getElementById("hotel_title_01").src = "http://image.bico.jp/Site/100002/ko/v6/img/hotel_search2_btn1_off.gif";
            document.getElementById("hotel_title_02").src = "http://image.bico.jp/Site/100002/ko/v6/img/hotel_search2_btn2.gif";
            document.getElementById("r_type1").options[3].selected = true;
            document.getElementById("h_level").options[10].selected = true;
            document.getElementById("dis_category1").style.display = "none"; 
            document.getElementById("location1").selectedIndex = 0;
			document.getElementById("location2").selectedIndex = 0;
            document.getElementById("dis_category2").style.display = "";
        break; 
        case 3 : 
            document.getElementById("hotel_title_01").src = "http://image.bico.jp/Site/100010/ko/v2/img/japan/but_hotel_o.gif";
            document.getElementById("hotel_title_02").src = "http://image.bico.jp/Site/100010/ko/v2/img/japan/but_ryokan.gif";
            document.getElementById("r_type1").options[1].selected = true;
            document.getElementById("h_level").options[0].selected = true;
            document.getElementById("dis_category1").style.display = "";
			document.getElementById("location1").selectedIndex = 0;
			document.getElementById("location2").selectedIndex = 0;	
			
			if(document.getElementById("s_price") && document.getElementById("s_price"))
			{
				if(C_FLAG == "down")
				{
					document.getElementById("s_price").style.top = document.getElementById("s_price").offsetTop + 30 + "px";
					document.getElementById("e_price").style.top = document.getElementById("e_price").offsetTop + 30 + "px";				
					document.getElementById("priceScope").style.top = document.getElementById("priceScope").offsetTop + 30 + "px";
					C_FLAG = "up";
				}
			}
        break;
        case 4 : 
            document.getElementById("hotel_title_01").src = "http://image.bico.jp/Site/100010/ko/v2/img/japan/but_hotel.gif";
            document.getElementById("hotel_title_02").src = "http://image.bico.jp/Site/100010/ko/v2/img/japan/but_ryokan_o.gif";
            document.getElementById("r_type1").options[3].selected = true;
            document.getElementById("h_level").options[10].selected = true;
            document.getElementById("dis_category1").style.display = "none"; 
            document.getElementById("location1").selectedIndex = 0;
			document.getElementById("location2").selectedIndex = 0;
			
			if(document.getElementById("s_price") && document.getElementById("s_price"))
			{
				if(C_FLAG == "up")
				{
					document.getElementById("s_price").style.top = document.getElementById("s_price").offsetTop - 30 + "px";
					document.getElementById("e_price").style.top = document.getElementById("e_price").offsetTop - 30 + "px";			
					document.getElementById("priceScope").style.top = document.getElementById("priceScope").offsetTop - 30 + "px";
					C_FLAG = "down";
				}	
			}
        break;                                      
    }
}
  
function Search_Enter(NoRoom,SiType) 
{   
	if(event.keyCode ==13)    //엔터키가 눌려지면,
		hotel_search(NoRoom,SiType)    //검색 함수 호출
}



function Agent_Search_Enter(NoRoom,SiType) 
{   
	if(event.keyCode ==13)    //엔터키가 눌려지면,
		agent_hotel_search(NoRoom,SiType)    //검색 함수 호출
}

function Click_Room(i,j) 
{   
    for(var k = 0; document.getElementsByName("ROOM_TYPE_CNT[" + i + "]")[0].value > k; k++)
    {
        document.getElementsByName("room_type[" + i + "][" + (k + 1) + "]")[0].checked = false;
    }
    
	document.getElementsByName("room_type[" + i + "][" + j + "]")[0].checked = true;
}

function ChangeCity(SeleteValue)
{
	if(SeleteValue == "")
	{
		document.getElementById("location1").selectedIndex = 1;
		var nextData = document.getElementById("location1")[1].value;
		 document.getElementById("div_st_" + nextData).style.display = "";
		 return; 
	}

    for(var i = 0; i < document.getElementById("location1").length; i++)
    {
        if(document.getElementById("location1")[i].value == SeleteValue)
            document.getElementById("location1")[i].selected = true;            
    }
    
    for(var i = 0; i < 999; i++)
    {
        if(document.getElementById("div_st_" + i) != null)
            document.getElementById("div_st_" + i).style.display = "none";
    }
    
    document.getElementById("div_st_" + SeleteValue).style.display = "";
}

function Click_St_name(st_name, st_code)
{
    var State_Name = escape(st_name);
    
    if (navigator.appName.indexOf("Microsoft") == -1)
        document.getElementById("spn_SelectSt").innerHTML = st_name
        
    else
        document.getElementById("spn_SelectSt").innerHTML = decodeURI(State_Name);
        
    document.getElementById("location2").value = st_code;
}

function ChangeLevel(SeleteValue)
{
    var SpnValue = "";
    
    if (SeleteValue == "l_Deluxe3")
        SpnValue = "★★★★★☆ Deluxe";
        
    else if (SeleteValue == "l_Deluxe")
        SpnValue = "★★★★★ Deluxe";
        
    else if (SeleteValue == "l_Deluxe2")
        SpnValue = "★★★★☆ Deluxe";
        
    else if (SeleteValue == "l_Superior")  
	    SpnValue = "★★★★ Superior";
	    
	else if (SeleteValue == "l_Superior2")
	    SpnValue = "★★★☆ Superior";
	    
	else if (SeleteValue == "l_Standard")
	    SpnValue = "★★★ Standard";
	    
	else if (SeleteValue == "l_Standard2")
	    SpnValue = "★★☆ Standard";
	    
	else if (SeleteValue == "l_Business")
	    SpnValue = "★★ Business";
	    
	else if (SeleteValue == "I_Economy")
	    SpnValue = "★ Economy";
	    
	else if (SeleteValue == "l_Onsen")
	    SpnValue = "(♨)Onsen/Ryokan ";
	    
	else if (SeleteValue == "l_Condo")
	    SpnValue = "Residence";
	    
	else if (SeleteValue == "I_Low")
	    SpnValue = "Low Price";
	    
    else
        SpnValue = "all class";
	
    document.getElementById("spn_SelectClass").innerHTML = SpnValue;
}