// JavaScript Document
var target='.roomTypeUnit';
var switchTarget='.setType';
var switchTargetLists='.roomTypeUnit p';

$(document).ready(function() {
$(target).hide();

$(switchTarget).click(function(){
	$(target).toggle();
});
	$(switchTargetLists).each(function(){
		$(this).css('padding','0 0 0 25px');
		$(this).css('border-bottom','solid 1px #000');
		/*$(this).css('width','235px');*/
		$(this).mouseover(function(){
			$(this).css('border-left','solid 3px #635236');
		})
		$(this).mouseout(function(){
			$(this).css('border-left','none');
		})

		$(this).click(function(){
			allCheckOff();
			$(this).css('background-color','#DBD5BC');
			$(this).css('background-image','url(01module/images/index_reserve_icon.gif)');
			$(target).hide();
			$('#roomin').html('<input type="hidden" name="'+$(this).attr('title')+'" value="1">')
			$('.settext').text($(this).text())
	   });
	});
$(switchTargetLists+':last-child').css('border-bottom','solid 0px #000');
$(switchTargetLists+':first-child').css('background-color','#DBD5BC');
$(switchTargetLists+':first-child').css('background-image','url(01module/images/index_reserve_icon.gif)');
});

function allCheckOff(){
	$(target+' p').each(function(){
	$(this).css('background-color','#FFF');
	$(this).css('background-image','url(01module/images/index_reserve_icon0.gif)');
	});
}

function setToday2() {
	theDate = new Date();
	var notfound=new Boolean(true);
	var years = document.reserve1.stayYear.options;
	var cnt = years.length;
	//
	for (var i = 0 ; i < cnt ; i ++ ) {
		if ( years[i].text == theDate.getFullYear() ) {
			years.selectedIndex = i;
			notfound = false;
			break;
		}
	}
	if ( notfound ) {
		if ( theDate.getFullYear() > Number(document.reserve1.stayYear.options[cnt-1].text) ) {
			var newOptArray = new Array();
			newcnt = theDate.getFullYear() - Number(document.reserve1.stayYear.options[cnt-1].text);
			for ( var i = 1 ; i <= newcnt ; i ++ ) {
				newOptArray.push(Number(document.reserve1.stayYear.options[cnt-1].text)+i);
			}
			for ( var i = cnt, optCnt = cnt+newOptArray.length ; i < optCnt ; i ++ ) {
				years[i] = new Option(newOptArray[i-cnt],"");
			}
			years.selectedIndex =  years.length-1;
		} else {
			alert('a');
			years.selectedIndex = 0;
		}
	}
	//
	document.reserve1.stayMonth.selectedIndex = theDate.getMonth();
	document.reserve1.stayDay.selectedIndex = theDate.getDate()-1;
}
