var now =  new Date();
var nYear = now.getFullYear();
var nMonth = now.getMonth()+1;
var nDay = now.getDate();

var action = 'https://asp.hotel-story.ne.jp/ver3d/planlist.asp';
//parameters
var hcod1 = '40020';
var hcod2 = '001';
var mode = 'seek';
var hidmode = 'select';
var hidselectmaxprice = '9999999';
var KasyoCode = 'LSAP'; 
var hchannel = 'SAP';

function quickResevationStby(){
	var yR = '';
	var mR = '';
	var dR = '';
	yR += '<option value="'+nYear+'" selected="selected">'+nYear+'</option>';
	yR += '<option value="'+(nYear+1)+'">'+(nYear+1)+'</option>';

	for(m=1;m<13;m++){
		if(nMonth == m){
			mR += '<option value="'+m+'" selected="selected">'+m+'</option>';
		}else{
			mR += '<option value="'+m+'">'+m+'</option>';
		}
	}

	for(d=1;d<32;d++){
		if(nDay == d){
			dR += '<option value="'+d+'" selected="selected">'+d+'</option>';
		}else{
			dR += '<option value="'+d+'">'+d+'</option>';
		}
	}
/*
	document.getElementById('year').innerHTML = yR;
	document.getElementById('month').innerHTML = mR;
	document.getElementById('day').innerHTML = dR;
*/
	$("#year").html(yR);
	$("#month").html(mR);
	$("#day").html(dR);
}

function qRPost(){
	var pYear = document.qR.year.options[document.qR.year.options.selectedIndex].value;
	var pMonth = document.qR.month.options[document.qR.month.options.selectedIndex].value;
	var pDate = document.qR.day.options[document.qR.day.options.selectedIndex].value;
	var pStay = document.qR.stay.options[document.qR.stay.options.selectedIndex].value;
	var pPerson = document.qR.person.options[document.qR.person.options.selectedIndex].value;
	var pRoom = document.qR.room.options[document.qR.room.options.selectedIndex].value;
	var pSunc = (document.qR.club.checked) ? 1:0;
	var pYMD = pYear+'/'+pMonth+'/'+pDate;

	var param = 'hcod1='+hcod1+'&hcod2='+hcod2+'&mode='+mode+'&hidmode='+hidmode+'&hidSELECTARRYMD='+encodeURI(pYMD)+'&hidSELECTHAKUSU='+pStay+'&hidSELECTadult='+pPerson+'&room='+pRoom+'&sunc='+pSunc+'&hchannel='+hchannel+'&kasho='+KasyoCode;
	var option = '';
	option += 'width=860, height=1000, resizable=yes, menubar=yes, toolbar=yes, scrollbars=yes';
	window.open(action+'?'+param,'vacant',option);
}

if(window.addEventListener) {
	window.addEventListener("load", quickResevationStby, false);
}else if(window.attachEvent) {
	window.attachEvent("onload", quickResevationStby);
}

function subWinOpen(href,width,height){
	var option = '';
	option = 'width='+width+', height='+height+', resizable=yes, menubar=no, toolbar=no, scrollbars=yes';
	window.open(href,'new',option);
}
