if(!jss){
	var jss = new Object();
}
jss.dom = new Object();
jss.dom.core = new Object();
jss.dom.form = new Object();
jss.dom.event = new Object();

jss.dom.core.childNodes = function(node){
	var array = new Array();
	if(!node || !node.hasChildNodes()) {return array;}

	var children = node.childNodes;
	for(var i=0 ; i<children.length ; i++){
		var c = children.item(i);
		if(c.nodeType == 3){
			var text = c.nodeValue;
			if(!text.match("/[^\s\t\n\r]/")){
				continue;
			}
		}
		array.push(c);
	}
	
	array.item = function(n){
		if(array[n]){
			return array[n];
		}
		return null;
	}
	
	return array;
}

jss.dom.core.removeChildNodes = function(node){
	if(!node){return;}
	while(node.hasChildNodes()){
		node.removeChild(node.lastChild);
	}
}


jss.dom.form.getValue = function(name, formName){
	var elem = null;
	if(!formName){
		elem = document.getElementsByName(name);
	}else{
		elem = document.forms[formName].elements[name];
	}
	if(!elem){return null;}
	
	if(elem.type){
		if(elem.type == "select-one"){
			if(elem.selectedIndex && elem.selectedIndex >= 0 && elem[elem.selectedIndex]){
				return elem[elem.selectedIndex].value;
			}
		}else{
			return elem.value;
		}
	}else if(elem.length){
		if(elem[0].type == "select-one"){
			if(elem[0].selectedIndex && elem.selectedIndex >= 0 && elem[0][elem[0].selectedIndex]){
				return elem[0][elem[0].selectedIndex].value;
			}
		}else if(elem[0].type == "radio" || elem[0].type == "check"){
			alert(elem.length);
			for(var i=0 ; i<elem.length ; i++){
				if(elem[i].checked){
					return elem[i].value;
				}
			}
		}else{
			return elem[0].value;
		}
	}
	return null;
}

jss.dom.form.addSelectOption = function (targetSelect, val, text, selected){
	var opt = document.createElement("option");
	opt.setAttribute("value", val);
	if(selected){
		opt.setAttribute("selected", "selected");
	}
	var textNode = document.createTextNode(text);
	opt.appendChild(textNode);
	
	try{
	targetSelect.appendChild(opt);
	}catch(e){
		alert(e.message);
		alert(targetSelect);
		throw e;
	}
}

jss.dom.form.setSelectedByValue = function(selectElem, val){
	for(var i=0 ; i<selectElem.options.length ; i++){
		if(selectElem.options[i].value == val){
			selectElem.selectedIndex = i;
		}
	}
}

jss.dom.form.submitByAjax = function(formName, url, callback){
	if(!formName || !document.forms[formName]){ 
		alert("FORM is not exist.["+ formName +"]");
		return;
	}
	
	var nowMill = (new Date()).getTime();
	var url = url +"?uid="+ nowMill;
	var postData = Form.serialize($(formName));
	//alert(postData);
	var myAjax=new Ajax.Request(
		url, 
		{
			method: 'post', 
			postBody: postData,
			onComplete: callback
		});
}



jss.dom.event.setEventListener = function(elem, type, func, useCapture){
	if(!elem){ return false};
	if(!useCapture){
		useCapture = false;
	}
	
	if(elem.addEventListener){
		elem.addEventListener(type, func, useCapture);
	}else if(elem.attachEvent){
		elem.attachEvent('on'+ type, func);
	}else{
		return false;
	}
	return true;
}

jss.dom.event.removeEventListener = function(elem, type, func, useCapture){
	if(!elem){ return false};
	if(!useCapture){
		useCapture = false;
	}
	
	if(elem.removeEventListener){
		elem.removeEventListener(type, func, useCapture);
	}else if(elem.detachEvent){
		elem.detachEvent('on'+ type, func);
	}else{
		return false;
	}
	return true;
}



// JavaScript Document
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function index_preloadImages(){
  MM_preloadImages('http://www.sunroute-nara.co.jp/images/TOP02_ov.gif')//-->
}

function jump_detail(hotelCode){
	    window.document.vaca.HotelCode.value = hotelCode;
	    window.document.vaca.action = "http://www.sunroute.jp/VacantRoomInqSV";
	    window.document.vaca.method = "POST";
	    window.document.vaca.target="_blank";
	    window.document.vaca.submit();
}

function jump_detail2(hotelCode){
	    window.document.resv.HotelCode.value = hotelCode;
	    window.document.resv.action = "http://www.sunroute.jp/ReservationSV";
	    window.document.resv.method = "POST";
	    window.document.resv.target="_blank";
	    window.document.resv.submit();
}

function jump_detail3(hotelCode){
	    window.document.conf.HotelCode.value = hotelCode;
	    window.document.conf.action = "http://www.sunroute.jp/ResvConfirmLoginJS.jsp";
	    window.document.conf.method = "POST";
	    window.document.conf.target="_blank";
	    window.document.conf.submit();
}

function jump_detailEN(hotelCode){
	window.document.English_top.HotelCode.value = hotelCode;
	window.document.English_top.action = "http://www.sunroute.jp/HotelInfoSVE";
	window.document.English_top.method = "POST";
	window.document.English_top.target = "_blank";
	window.document.English_top.submit();
}
function jump_detailKO(hotelCode){
	window.document.Korea_top.HotelCode.value = hotelCode;
	window.document.Korea_top.action = "http://www.sunroute.jp/HotelInfoSVK";
	window.document.Korea_top.method = "POST";
	window.document.Korea_top.target = "_blank";
	window.document.Korea_top.submit();
}
function jump_detailCN(hotelCode){
	window.document.China_top.HotelCode.value = hotelCode;
	window.document.China_top.action = "http://www.sunroute.jp/HotelInfoSVC";
	window.document.China_top.method = "POST";
	window.document.China_top.target = "_blank";
	window.document.China_top.submit();
}



//---------------------------------------
//関数名：jump_vacant
//概　要：空室照会へ遷移
//引　数：code      ⇒ プランコード
//      ：droom     ⇒ 表示ルームタイプ
//      ：roomType  ⇒ 初期値ルームタイプ
//      ：dsmoke    ⇒ 表示禁煙/喫煙部屋
//      ：smoke     ⇒ 初期値禁煙/喫煙部屋
//      ：dpac      ⇒ 表示食事条件
//      ：pac       ⇒ 初期値食事条件
//      ：pfile     ⇒ 人数別料金表ファイル名
//      ：psym      ⇒ 販売開始月
//戻り値：なし
//---------------------------------------
function jump_vacant(code, droom, roomType, dsmoke, smoke, dpac, pac, pfile, psym){

    with(document.plan){
        PlanCode.value = code ;
        DRoomType.value = droom ;
        RoomType.value = roomType ;
        DSmoke.value = dsmoke ;
        Smoking.value = smoke ;
        DPac.value = dpac ;
        Pac.value = pac ;
        PFile.value = pfile ;
        InqYear.value = psym.substring(0, 4) ;
        InqMonth.value = psym.substring(4, 6) ;
        InqDay.value = "" ;
        target = "_self" ;
        action = "http://www.sunroute.jp/VacantRoomInqSV" ;
        submit() ;
    }
}

//---------------------------------------
//関数名：jump
//概　要：予約へ遷移
//引　数：code      ⇒ プランコード
//      ：droom     ⇒ 表示ルームタイプ
//      ：roomType  ⇒ 初期値ルームタイプ
//      ：dsmoke    ⇒ 表示禁煙/喫煙部屋
//      ：smoke     ⇒ 初期値禁煙/喫煙部屋
//      ：dpac      ⇒ 表示食事条件
//      ：pac       ⇒ 初期値食事条件
//戻り値：なし
//---------------------------------------
function jump(code, droom, roomType, dsmoke, smoke, dpac, pac){

    with(document.plan){
        PlanCode.value = code ;
        DRoomType.value = droom ;
        RoomType.value = roomType ;
        DSmoke.value = dsmoke ;
        Smoking.value = smoke ;
        DPac.value = dpac ;
        Pac.value = pac ;
        target = "_top" ;
        submit() ;
    }
}

//---------------------------------------
//関数名：jump_comfirm
//概　要：予約確認へ遷移
//引　数：なし
//戻り値：なし
//---------------------------------------
function jump_confirm(){

    with(document.plan){
        target = "_top" ;
        action = "http://www.sunroute.jp/ResvConfirmLoginJS.jsp" ;
        submit() ;
    }
}

/**
 * 日付・人数からボタン
 */
function jump_reserve() {
	window.document.dispform.MethodNo.value = "00";
	window.document.dispform.action="http://www.sunroute.jp/ReservationSV";
	window.document.dispform.method = "POST";
	window.document.dispform.target="_top";
	window.document.dispform.submit();		
}

var vacantDefaultPac = '';
var vacantDefaultRoomType = '';
var vacantDefaultDRoomType = '';
var vacantDefaultDPac = '';
var vacantMethodNo = '';
var vacantInqYear = '';
var vacantInqMonth = '';
var vacantInqDay = '';

/**
 * ダイレクト予約のチェックイン日付の初期化処理
 */
function initDirectResvCheckInDate(){
	var today = new Date();
	// 年
	jss.suns.util.setYear($('year'), 2, jss.dom.form.getValue('bk_year', 'ResvInput1'));
	// 月
	jss.suns.util.setMonth($('year'), $('month'), jss.dom.form.getValue('bk_month', 'ResvInput1'));
	// 日
	jss.suns.util.setDay($('year'), $('month'), $('day'), jss.dom.form.getValue('bk_day', 'ResvInput1'));
}

/**
 * 初期処理
 */
function initDocument(){
	// ダイレクト予約のチェックイン日にイベント追加
	initDirectResvCheckInDate();
	jss.dom.event.setEventListener($('year'), 'change', onChangeYear);
	jss.dom.event.setEventListener($('month'), 'change', onChangeMonth);
	jss.dom.event.setEventListener($('day'), 'change', onChangeDay);
}

// ロードイベントにinitDocument処理を追加
jss.dom.event.setEventListener(window, 'load', initDocument);

function navi(obj) {
	alert("navi");
	var hotelCode = obj.options[obj.selectedIndex].value;
	if(hotelCode != "-1") {
		document.ToHotelDetailFromSearch.submit();
	}
}

function showhidedb(id,id2){
	if(document.getElementById){
		if(document.getElementById(id).style.display == "block")
			document.getElementById(id).style.display = "none";
		else
			document.getElementById(id).style.display = "block";

   	 }
	if(document.getElementById){
			document.getElementById(id2).style.display = "none";
   	 }

}


if(!jss){
	var jss = new Object();
}
jss.suns = new Object();
jss.suns.util = new Object();
jss.suns.app = new Object();

// SorryMsg 2008/11/12 add start ueno 
// browser close event
window.onbeforeunload = function(e){
	if(((event.clientX>document.body.clientWidth) && (event.clientY<0)) || event.altKey){
		jss.suns.util.sesInvalidate();
	}
}
	
jss.suns.util.sesInvalidate = function () {
	// Servlet Url
	var url = "../SessionInvalidateSV";
	// Updater Enter
	var a = new Ajax.Request( url,  { 
	            "method": "post", 
                // Is Success
	            onSuccess: function(request) { 
					//alert(request.getSession());
	            }, 
                // isComplete
	            onComplete: function(request) { 
	            	//alert('Is Complete');
	            }, 
	            // isFailure
	            onFailure: function(request) { 
	                alert('Is failure Load'); 
	            }, 
	            // do Exception
	            onException: function (request) { 
	                alert('Do Exception sesInvalidate'); 
	            } 
	        } 
	    );
}
// SorryMsg 2008/11/12 add end ueno 
jss.suns.util.setYear = function(yObj, count, selectedVal){
	jss.dom.core.removeChildNodes(yObj);
	var today = new Date();
	for(var i=today.getFullYear() ; i<today.getFullYear()+count ; i++){
		var selected = (selectedVal == i);
		jss.dom.form.addSelectOption(yObj, i, i, selected);
	}
}


jss.suns.util.setMonth = function(yObj, mObj, selectedVal){
	var y = yObj.value;
	var today = new Date();
	var nowYear = today.getFullYear();
	var minMonth = 1;
	if(y == nowYear){
		minMonth = today.getMonth() + 1;
	}
	
	jss.dom.core.removeChildNodes(mObj);
	for(var i=minMonth ; i<=12 ; i++){
		var date = i;
		if(i<10){ date = "0"+i; }
		var selected = (selectedVal == date);
		jss.dom.form.addSelectOption(mObj, date, date, selected);
	}
}

jss.suns.util.setDay = function(yObj, mObj, dObj, selectedVal){
	var y = yObj.value;
	var m = mObj.value;
	var limit = jss.suns.util.getLimitDayOfMonth(y, m);
	
	var today = new Date();
	var nowYear = today.getFullYear();
	var nowMonth = today.getMonth() + 1;
	var minDate = 1;
	if(y == nowYear && m == nowMonth){
		minDate = today.getDate();
	}
	jss.dom.core.removeChildNodes(dObj);
	for(var i=minDate ; i<=limit ; i++){
		var date = i;
		if(i<10){ date = "0"+i; }
		var selected = false;
		var selected = (selectedVal == date);
		jss.dom.form.addSelectOption(dObj, date, date, selected);
	}
}

jss.suns.util.getLimitDayOfMonth = function(y, m){
	if(!y || !m){return null;}
	if(m==1 || m==3 || m==5 || m==7 || m==8 || m==10 || m==12){
		return 31;
	}else if(m == 4 || m==6 || m==9 || m==11){
		return 30;
	}
	
	if(m == 2){
		if(y % 400 == 0){
			return 29;
		}else if(y % 100 == 0){
			return 28;
		}else if(y % 4 == 0){
			return 29;
		}
		return 28;
	}
	return null;
}

jss.suns.util.getUID = function(){
	var date = new Date();
	return date.getTime();
}


jss.suns.app.toHotelInfoBySelect = function(selectObj, resvEnterprise){
	var hotelCode = selectObj.options[selectObj.selectedIndex].value.substr(0, 4);
	
	if(hotelCode == ""){return;}
	
	var url = "/HotelInfoSV?HotelCode="+ hotelCode;
	if(resvEnterprise && resvEnterprise.length > 0){
		url = url + "&ResvEnterprise="+ resvEnterprise;
	}
	document.location.href = url;
}

jss.suns.app.showAccommodationTax = function(){
	var win = window.open('/win_accommodationTax.html', 'accommodationTax', 
	'width=560px, height=500px, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes');
	win.focus();
}

jss.suns.app.showCancelCharge = function(){
	var win = window.open('/win_cancel.html', 'cancel', 
	'width=520px, height=200px, toolbar=no, location=no, directories=no, status=no, menubar=no');
	win.focus();
}

jss.suns.app.showAssessment = function(){
	var win = window.open('/win_assessment.html', 'assessment', 
	'width=310px, height=250px, toolbar=no, location=no, directories=no, status=no, menubar=no');
	win.focus();
}

jss.suns.app.showThreeCategory = function(){
	var win = window.open('/win_threeCategory.html', 'threeCategory', 
	'width=310px, height=430px, toolbar=no, location=no, directories=no, status=no, menubar=no');
	win.focus();
}

//DirectIn URL H-00275 tmiwa
jss.suns.app.getDirectInURL = function(){
	var url = "https://asp.hotel-story.ne.jp";
	return url;
}

//DirectIn URL_SSL H-00275 tmiwa
//DirectIn URL H-00275 azuma 2009/08/17(DirectInTest NoSSL)
jss.suns.app.getDirectInURLSSL = function(){
	var url = "https://asp.hotel-story.ne.jp";
	return url;
}

/**
 * トップ画面の初期化、イベントに関する処理
 * ・地域Select初期化
 * ・ホテルSelect初期化
 * ・地域空室照会のチェックイン日付Select初期化
 * ・ダイレクト予約のチェックイン日付Select初期化
 * ・地域空室照会のチェックイン日付にイベント追加（年、月が変更になったときのイベント）
 * ・ダイレクト予約のチェックイン日付にイベント追加（年、月が変更になったときのイベント）
 */

/**
 * loadAreaList処理で実行したAjaxのコールバック処理
 * Ajaxの結果XML（地域の一覧）を地域Selectに設定する。
 */
function callBackLoadAreaList(request){
	jss.dom.core.removeChildNodes($('area'));
	
	//alert(request.responseText);
	//return;
	var xml = request.responseXML;
	var result = xml.getElementsByTagName('result')[0].firstChild.nodeValue;
	try{
		if(result == 'success'){
			var opts = xml.getElementsByTagName('option');
			//alert(opts.length);
			jss.dom.form.addSelectOption($('area'), '', '----お選びください----', false);
			
			for(var i=0 ; i<opts.length ; i++){
				var val = opts[i].getAttribute('value');
				var text = opts[i].getAttribute('text');
				var selected = false;
				if(val == $('bk_area').value){
					selected = true;
				}
				jss.dom.form.addSelectOption($('area'), val, text, selected);
			}
		}else{
	        var errNo = xml.getElementsByTagName('errorMsg')[0].firstChild.nodeValue;
	        errNo = errNo.substring(0,3);
			if(errNo == 400){
				location.href='../WWWSorryMsgJS.jsp';
			} else {
				alert(xml.getElementsByTagName('errorMsg')[0].firstChild.nodeValue);
			}
		}
	}catch(exp){
		alert(exp.message);
//	}finally{
//		loadHotel();
	}
}

/**
 * ホテルをSelectにロードする。
 */
function loadHotel(areaVal){
	if(areaVal == null){
		areaVal = 'all';
	}
	$('bk_area').value = areaVal;
	var url = "GetAreaHotelsSV?groupCode="+ areaVal +'&uid='+ jss.suns.util.getUID();
	//var url = "GetAreaHotelsSV?area="+ $F('area');
	var myAjax=new Ajax.Request(
		url, 
		{
			method: 'get', 
			onComplete: setHotel
		});
}

/**
 * loadHotel処理で実行したAjaxのコールバック処理
 * Ajaxの結果XML（ホテルの一覧）をホテルSelectに設定する。
 */
function setHotel(request){
	try{
		
		//alert(request.responseText);
		//return;
		jss.dom.core.removeChildNodes($('HotelCode'));
		
		var xml = request.responseXML;
		var result = xml.getElementsByTagName('result')[0].firstChild.nodeValue;
		if(result == 'success'){
			var opts = xml.getElementsByTagName('option');
			//alert(opts.length);
			jss.dom.form.addSelectOption($('HotelCode'), '', '----お選びください----', false);
			
			for(var i=0 ; i<opts.length ; i++){
				var val = opts[i].getAttribute('value');
				var text = opts[i].getAttribute('text');
				var selected = false;
				if(val != "" && val == $('bk_HotelCode').value){
					selected = true;
				}
				jss.dom.form.addSelectOption($('HotelCode'), val, text, selected);
			}
		}else{
		/* 2008/11/21 add start ueno */
			var errNo = xml.getElementsByTagName('errorMsg')[0].firstChild.nodeValue;
			errNo = errNo.substring(0,3);
			if(errNo == 400){
				location.href='../WWWSorryMsgJS.jsp';
			} else {
				alert(xml.getElementsByTagName('errorMsg')[0].firstChild.nodeValue);
			}
		/* 2008/11/21 add end ueno */
		}
	}catch(e){
		alert(e.message);
	}
}

/**
 * ダイレクト予約のホテルコードの値が変更になったときの処理
 */
function onChangeHotelCode(){
	$('bk_HotelCode').value = jss.dom.form.getValue('HotelCode', 'ResvInput1');
	//alert($('bk_HotelCode').value);
}
/**
 * ダイレクト予約のチェックイン(年)の値が変更になったときの処理
 */
function onChangeYear(){
	$('bk_year').value = jss.dom.form.getValue('year', 'ResvInput1');
	jss.suns.util.setMonth($('year'), $('month'));
	jss.suns.util.setDay($('year'), $('month'), $('day'), $F('day'));
}

/**
 * ダイレクト予約のチェックイン(月)の値が変更になったときの処理
 */
function onChangeMonth(){
	$('bk_month').value = jss.dom.form.getValue('month', 'ResvInput1');
	jss.suns.util.setDay($('year'), $('month'), $('day'), $F('day'));
}

/**
 * ダイレクト予約のチェックイン(日)の値が変更になったときの処理
 */
function onChangeDay(){
	$('bk_day').value = jss.dom.form.getValue('day', 'ResvInput1');
}

/**
 * 地域空室照会のチェックイン日付の初期化処理
 */
function initAreaCheckInDate(){
	var today = new Date();
	// 年
	jss.suns.util.setYear($('areaCiYear'), 2, jss.dom.form.getValue('bk_areaCiYear', 'AreaRoomSearch'));
	// 月
	jss.suns.util.setMonth($('areaCiYear'), $('areaCiMonth'), jss.dom.form.getValue('bk_areaCiMonth', 'AreaRoomSearch'));
	// 日
	jss.suns.util.setDay($('areaCiYear'), $('areaCiMonth'), $('areaCiDay'), jss.dom.form.getValue('bk_areaCiDay', 'AreaRoomSearch'));
}

/**
 * ダイレクト予約のチェックイン日付の初期化処理
 */
function initDirectResvCheckInDate(){
	var today = new Date();
	// 年
	jss.suns.util.setYear($('year'), 2, jss.dom.form.getValue('bk_year', 'ResvInput1'));
	// 月
	jss.suns.util.setMonth($('year'), $('month'), jss.dom.form.getValue('bk_month', 'ResvInput1'));
	// 日
	jss.suns.util.setDay($('year'), $('month'), $('day'), jss.dom.form.getValue('bk_day', 'ResvInput1'));
}

/**
 * 初期処理
 */
function initDocument(){
	// ホテル取得
	
;
	// ダイレクト予約のホテル選択にイベント追加
	jss.dom.event.setEventListener($('HotelCode'), 'change', onChangeHotelCode);
	// ダイレクト予約のチェックイン日にイベント追加
	initDirectResvCheckInDate();
	jss.dom.event.setEventListener($('year'), 'change', onChangeYear);
	jss.dom.event.setEventListener($('month'), 'change', onChangeMonth);
	jss.dom.event.setEventListener($('day'), 'change', onChangeDay);
	
	// 読み込み画像の初期化
	MM_preloadImages('images/btn_user_ov.gif','images/club_btn01ov.gif','images/club_btn02ov.gif');
}

// ロードイベントにinitDocument処理を追加
jss.dom.event.setEventListener(window, 'load', initDocument);



function toPlanList(){

	//alert("in sendSubmit");
	//if($('HotelCode').value == ""){
	//	alert("ホテルを選択してください。");
	//	return;
	//}
	document.DirectInResv.action=jss.suns.app.getDirectInURLSSL() + "/ver3d/planlist.asp";
	document.DirectInResv.hcod1.value = document.ResvInput1.HotelCode.value;
	document.DirectInResv.hidSELECTHAKSU.value = document.ResvInput1.Stay.value;
	document.DirectInResv.hidSELECTadult.value = document.ResvInput1.RoomPax.value;
	document.DirectInResv.room.value = document.ResvInput1.Room.value;
	document.DirectInResv.kasho.value = document.ResvInput1.KasyoCode.value;

	if(document.ResvInput1.SunClub.checked){
		document.DirectInResv.sunc.value = "1";
	}else{
		document.DirectInResv.sunc.value = "0";
	}

	// チェックイン日をhiddenにyyyy/MM/dd形式でまとめる
	number = document.ResvInput1.year.selectedIndex;
	document.ResvInput1.CheckIn.value=document.ResvInput1.year.options[number].value;
	document.ResvInput1.CheckIn.value+="/";
	number = document.ResvInput1.month.selectedIndex;
	document.ResvInput1.CheckIn.value+=document.ResvInput1.month.options[number].value;
	number = document.ResvInput1.day.selectedIndex;
	document.ResvInput1.CheckIn.value+="/";
	document.ResvInput1.CheckIn.value+=document.ResvInput1.day.options[number].value;
	document.DirectInResv.hidSELECTARRYMD.value = document.ResvInput1.CheckIn.value;

	// 実行	
	document.DirectInResv.submit();
}
/**
 * 部屋一覧選択ボタンを押されたとき
 */
function toRoomList(){
	//alert("in toRoomList");
	// アプリケーション指定
	document.ResvInput1.appId.value="ResvInput1toViewApp";
	// 次画面指定
	document.ResvInput1.nextDispId.value="ResvRoomViewJS.jsp";
	// サンルートクラブ会員の値を移動
	document.ResvInput1.Club.value = document.ResvInput1.SunClub.value;	
	document.ResvInput1.DispFlg.value="";
	document.ResvInput1.action="http://www.sunroute.jp/ReceptSV";

	sendSubmit();
}
/**
 * ダイレクト予約(部屋自動検索)が押されたとき
 */
function autoSearch(){
	//alert("in autoSearch");
	// アプリケーション指定
	document.ResvInput1.appId.value="ReservationSV";
	// 次画面指定
	document.ResvInput1.nextDispId.value="ResvLoginJS.jsp";
	document.ResvInput1.DispFlg.value="Y";
	document.ResvInput1.action="http://www.sunroute.jp/ReservationSV";

	sendSubmit();
}

/**
 * 送信処理
 */
function sendSubmit() {
	// チェックイン日をhiddenにyyyy-MM-dd形式でまとめる
	number = document.ResvInput1.year.selectedIndex;
	document.ResvInput1.CheckIn.value=document.ResvInput1.year.options[number].value;
	document.ResvInput1.CheckIn.value+="-";
	number = document.ResvInput1.month.selectedIndex;
	document.ResvInput1.CheckIn.value+=document.ResvInput1.month.options[number].value;
	number = document.ResvInput1.day.selectedIndex;
	document.ResvInput1.CheckIn.value+="-";
	document.ResvInput1.CheckIn.value+=document.ResvInput1.day.options[number].value;

	// 実行	
	document.ResvInput1.submit();
}
 

