var preImages01 = [
"images/topTg/B_inn01-Spa01_w115h92.jpg","images/topTg/B_inn02-Spa01_w115h92.jpg","images/topTg/B_inn03-Spa01_w115h92.jpg","images/topTg/B_inn04-Spa01_w115h92.jpg","images/topTg/B_inn05-Spa01_w115h92.jpg","images/topTg/B_inn06-Spa01_w115h92.jpg","images/topTg/B_inn07-Spa01_w115h92.jpg","images/topTg/B_inn08-Spa01_w115h92.jpg","images/topTg/B_inn09-Spa01_w115h92.jpg","images/topTg/B_inn10-Spa01_w115h92.jpg","images/topTg/B_inn11-Spa01_w115h92.jpg","images/topTg/B_inn12-Spa01_w115h92.jpg","images/topTg/B_inn13-Spa01_w115h92.jpg","images/topTg/B_inn14-Spa01_w115h92.jpg","images/topTg/B_inn15-Spa01_w115h92.jpg","images/topTg/B_inn16-Spa01_w115h92.jpg","images/topTg/B_inn17-Spa01_w115h92.jpg","images/topTg/B_inn18-Spa01_w115h92.jpg","images/topTg/B_inn19-Spa01_w115h92.jpg","images/topTg/B_inn20-Spa01_w115h92.jpg","images/topTg/B_inn21-Spa01_w115h92.jpg","images/topTg/B_inn22-Spa01_w115h92.jpg","images/topTg/B_inn23-Spa01_w115h92.jpg","images/topTg/B_inn24-Spa01_w115h92.jpg","images/topTg/B_inn25-Spa01_w115h92.jpg","images/topTg/B_inn26-Spa01_w115h92.jpg","images/topTg/C_inn01-Room01_w115h92.jpg","images/topTg/C_inn02-Room01_w115h92.jpg","images/topTg/C_inn03-Room01_w115h92.jpg","images/topTg/C_inn04-Room01_w115h92.jpg","images/topTg/C_inn05-Room01_w115h92.jpg","images/topTg/C_inn06-Room01_w115h92.jpg","images/topTg/C_inn07-Room01_w115h92.jpg","images/topTg/C_inn08-Room01_w115h92.jpg","images/topTg/C_inn09-Room01_w115h92.jpg","images/topTg/C_inn10-Room01_w115h92.jpg","images/topTg/C_inn11-Room01_w115h92.jpg","images/topTg/C_inn12-Room01_w115h92.jpg","images/topTg/C_inn13-Room01_w115h92.jpg","images/topTg/C_inn14-Room01_w115h92.jpg","images/topTg/C_inn15-Room01_w115h92.jpg","images/topTg/C_inn16-Room01_w115h92.jpg","images/topTg/C_inn17-Room01_w115h92.jpg","images/topTg/C_inn18-Room01_w115h92.jpg","images/topTg/C_inn19-Room01_w115h92.jpg","images/topTg/C_inn20-Room01_w115h92.jpg","images/topTg/C_inn21-Room01_w115h92.jpg","images/topTg/C_inn22-Room01_w115h92.jpg","images/topTg/C_inn23-Room01_w115h92.jpg","images/topTg/C_inn24-Room01_w115h92.jpg","images/topTg/C_inn25-Room01_w115h92.jpg","images/topTg/C_inn26-Room01_w115h92.jpg","images/topTg/D_inn01-Food01_w115h92.jpg","images/topTg/D_inn02-Food01_w115h92.jpg","images/topTg/D_inn03-Food01_w115h92.jpg","images/topTg/D_inn04-Food01_w115h92.jpg","images/topTg/D_inn05-Food01_w115h92.jpg","images/topTg/D_inn06-Food01_w115h92.jpg","images/topTg/D_inn07-Food01_w115h92.jpg","images/topTg/D_inn08-Food01_w115h92.jpg","images/topTg/D_inn09-Food01_w115h92.jpg","images/topTg/D_inn10-Food01_w115h92.jpg","images/topTg/D_inn11-Food01_w115h92.jpg","images/topTg/D_inn12-Food01_w115h92.jpg","images/topTg/D_inn13-Food01_w115h92.jpg","images/topTg/D_inn14-Food01_w115h92.jpg","images/topTg/D_inn15-Food01_w115h92.jpg","images/topTg/D_inn16-Food01_w115h92.jpg","images/topTg/D_inn17-Food01_w115h92.jpg","images/topTg/D_inn18-Food01_w115h92.jpg","images/topTg/D_inn19-Food01_w115h92.jpg","images/topTg/D_inn20-Food01_w115h92.jpg","images/topTg/D_inn21-Food01_w115h92.jpg","images/topTg/D_inn22-Food01_w115h92.jpg","images/topTg/D_inn23-Food01_w115h92.jpg","images/topTg/D_inn24-Food01_w115h92.jpg","images/topTg/D_inn25-Food01_w115h92.jpg","images/topTg/D_inn26-Food01_w115h92.jpg","images/topTg/A_inn01-Facade01_w115h92.jpg","images/topTg/A_inn02-Facade01_w115h92.jpg","images/topTg/A_inn03-Facade01_w115h92.jpg","images/topTg/A_inn04-Facade01_w115h92.jpg","images/topTg/A_inn05-Facade01_w115h92.jpg","images/topTg/A_inn06-Facade01_w115h92.jpg","images/topTg/A_inn07-Facade01_w115h92.jpg","images/topTg/A_inn08-Facade01_w115h92.jpg","images/topTg/A_inn09-Facade01_w115h92.jpg","images/topTg/A_inn10-Facade01_w115h92.jpg","images/topTg/A_inn11-Facade01_w115h92.jpg","images/topTg/A_inn12-Facade01_w115h92.jpg","images/topTg/A_inn13-Facade01_w115h92.jpg","images/topTg/A_inn14-Facade01_w115h92.jpg","images/topTg/A_inn15-Facade01_w115h92.jpg","images/topTg/A_inn16-Facade01_w115h92.jpg","images/topTg/A_inn17-Facade01_w115h92.jpg","images/topTg/A_inn18-Facade01_w115h92.jpg","images/topTg/A_inn19-Facade01_w115h92.jpg","images/topTg/A_inn20-Facade01_w115h92.jpg","images/topTg/A_inn21-Facade01_w115h92.jpg","images/topTg/A_inn22-Facade01_w115h92.jpg","images/topTg/A_inn23-Facade01_w115h92.jpg","images/topTg/A_inn24-Facade01_w115h92.jpg","images/topTg/A_inn25-Facade01_w115h92.jpg","images/topTg/A_inn26-Facade01_w115h92.jpg"
];

$.each(preImages01,function(){$("<img>").attr("src",this);});

globalModal = 0;

function modalInn(){
	
	$("a.modal").click(function(){
		globalModal = $(this).attr("rel");
	});
	
	//ColorBox
	$("a.modal").colorbox(
		{
			innerWidth: "700px",
			innerHeight: "440px",
			close: "閉じる",
			previous: "&laquo;前の宿",
			next: "次の宿&raquo;",
			current: false
		},
		// コールバック関数
		function(){
	
			$("a.tabsInnNav").click(function(){
				globalModal = $(this).attr("rel");
			});
	
			//jQuery Ui Tabs
			$("#tabsInn").tabs({
				selected: globalModal,
				fx: {
					opacity: 'toggle',
					duration: 500
				},
				select: function(event, ui){
					var url = $.data(ui.tab, 'load.tabs');
					if( url ) {
						location.href = url;
						return false;
					}
					return true;
				},
				show: function(event, ui){
					$('ul.photosNav li:first-child a').addClass('navActive');
					$('#tabsInn01 ul.photosNav a').click(function(){
						$('#tabsInn01 ul.photosNav a').removeClass('navActive');
						$(this).addClass('navActive');
						$('#tabsInn01 div.photosMain img').attr('src',$(this).attr('href'));
						return false;
					});
					$('#tabsInn02 ul.photosNav a').click(function(){
						$('#tabsInn02 ul.photosNav a').removeClass('navActive');
						$(this).addClass('navActive');
						$('#tabsInn02 div.photosMain img').attr('src',$(this).attr('href'));
						return false;
					});
					$('#tabsInn03 ul.photosNav a').click(function(){
						$('#tabsInn03 ul.photosNav a').removeClass('navActive');
						$(this).addClass('navActive');
						$('#tabsInn03 div.photosMain img').attr('src',$(this).attr('href'));
						return false;
					});
					$('#tabsInn04 ul.photosNav a').click(function(){
						$('#tabsInn04 ul.photosNav a').removeClass('navActive');
						$(this).addClass('navActive');
						$('#tabsInn04 div.photosMain img').attr('src',$(this).attr('href'));
						return false;
					});
					$('#tabsInn05 ul.photosNav a').click(function(){
						$('#tabsInn05 ul.photosNav a').removeClass('navActive');
						$(this).addClass('navActive');
						$('#tabsInn05 div.photosMain img').attr('src',$(this).attr('href'));
						return false;
					});
				}
			}); //End jQuery Ui Tabs
	
		} //End コールバック関数
	);//End ColorBox

}

$(function(){
		   
	modalInn();

	//jQuery Ui Tabs
	$("#topTg").tabs({
		fx: { opacity: 'toggle'},
//		cookie: { expires: 1 },

		load: function(event, ui){
			
			//opacity-rollover2.1.js
			$("img.imgFade").hover(
				function(){   // over (ms,opacity)
					$(this).fadeTo(50, 0.2);
				},
				function(){   // out
					$(this).fadeTo(100, 1);
				}
			);
			
			modalInn();

		}
	});

});

//宿泊プラン検索

$(function() {

	//ページ読み込み時に、日付入力フィールドに翌日の日付を入力
	//要閏年の判定を追加予定
	var tommorow = new Date();
	tommorow.setDate(tommorow.getDate()+2);
	var tommorowY = tommorow.getFullYear();
	var tommorowM = tommorow.getMonth()+1;
	var tommorowD = tommorow.getDate();
	
	var sidp = $("input.sidp");
	var sidpYear = $("input.sidpYear");
	var sidpMonth = $("input.sidpMonth");
	var sidpDate = $("input.sidpDate");
	
	if(tommorowM<10){tommorowM='0'+tommorowM;}
	if(tommorowD<10){tommorowD='0'+tommorowD;}
	sidp.attr({"value": tommorowY+'/'+tommorowM+'/'+tommorowD});
	sidpYear.attr({"value": tommorowY});
	sidpMonth.attr({"value": tommorowM});
	sidpDate.attr({"value": tommorowD});

	//jQuery Ui Datepicker
	$.datepicker.regional['ja'] = {
		closeText: '閉じる',
		prevText: '&#x3c;前',
		nextText: '次&#x3e;',
		currentText: '今日',
		monthNames: ['1月','2月','3月','4月','5月','6月',
		'7月','8月','9月','10月','11月','12月'],
		monthNamesShort: ['1月','2月','3月','4月','5月','6月',
		'7月','8月','9月','10月','11月','12月'],
		dayNames: ['日曜日','月曜日','火曜日','水曜日','木曜日','金曜日','土曜日'],
		dayNamesShort: ['日','月','火','水','木','金','土'],
		dayNamesMin: ['日','月','火','水','木','金','土'],
		weekHeader: '週',
		dateFormat: 'yy/mm/dd',
		firstDay: 0,
		isRTL: false,
		showMonthAfterYear: true,
		yearSuffix: '年'};

	$.datepicker.setDefaults($.datepicker.regional['ja']);

	$( "#dp01" ).datepicker({
		defaultDate: +1,
		minDate: 0,
		onSelect: function(dateText, inst) {
			sidpYear.attr({"value": $( this ).val().substr(0,4)});
			sidpMonth.attr({"value": $( this ).val().substr(5,2)});
			sidpDate.attr({"value": $( this ).val().substr(8,2)});
			$("#dp02").attr({"value": $( this ).val()});
		}
	});
	
	$( "#dp02" ).datepicker({
		defaultDate: +1,
		minDate: 0,
		onSelect: function(dateText, inst) {
			sidpYear.attr({"value": $( this ).val().substr(0,4)});
			sidpMonth.attr({"value": $( this ).val().substr(5,2)});
			sidpDate.attr({"value": $( this ).val().substr(8,2)});
			$("#dp01").attr({"value": $( this ).val()});
		}
	});
});

$(function(){

	//jQuery Ui Dialog
	//子供の人数を設定
	$("#setNumChild").dialog({
		autoOpen: false,
		closeText: 'X',
		title: '子供の人数を設定（1室あたり）',
		buttons: [{
				text: "設定する",
				click: function() { $(this).dialog("close"); }
		}] 
	});
	$("#openNumChild").click(function() {
			$( "#setNumChild" ).dialog( "open" );
			return false;
	});
});

$(function(){

	var nc01 = $("#nc01");
	var nc02 = $("#nc02");
	var nc03 = $("#nc03");
	var nc04 = $("#nc04");
	var nc05 = $("#nc05");
	var valNc01 = $("#valNc01");
	var valNc02 = $("#valNc02");
	var valNc03 = $("#valNc03");
	var valNc04 = $("#valNc04");
	var valNc05 = $("#valNc05");
		
	function totalNumChild(){
		var numChild = parseInt(nc01.val())+parseInt(nc02.val())+parseInt(nc03.val())+parseInt(nc04.val())+parseInt(nc05.val());
		$("#totalNumChild").text(numChild);
	}
	
	totalNumChild();
	
	$("#setNumChild select").change(function(){
		totalNumChild();
		valNc01.attr({"value": nc01.val()});
		valNc02.attr({"value": nc02.val()});
		valNc03.attr({"value": nc03.val()});
		valNc04.attr({"value": nc04.val()});
		valNc05.attr({"value": nc05.val()});
	});

});

//jquery.jfeedmixer.min.js
$(function() {
	$('#rssNewsContent').jFeedMixer({
		feeds: [
				'http://www.arima-onsen.com/newslist1.xml'
		],
		countPerFeed: 10,
		countLimit: 10,
		dateFormat: 'yyyy年mm月dd日'
//		categorySeparator: ' | '
//		nocache: true
	});
	$('#rssNeighborhoodContent').jFeedMixer({
		feeds: [
//			'http://www.arima-onsen.com/newslist4.xml',
//			'http://alimali.jp/docsdocs/backend/alimali.rss',
			'http://tourism.sasayama.jp/atom.xml'
//			'http://www.shukugawa-m.com/blog/atom.xml',
//			'http://www.shukugawa-navi.com/atom.xml',
//			'http://myrss.jp/rdf/r4d4d4acf180c94107.rdf',
//			'http://myrss.jp/rdf/r4d4d4af2d999d5749.rdf',
//			'http://myrss.jp/rdf/r4d4d4b62c5a3b5227.rdf',
//			'http://myrss.jp/rdf/r4d4d4be03e9339352.rdf',
//			'http://myrss.jp/rdf/r4d4d568bc940a9868.rdf',
//			'http://myrss.jp/rdf/r4d4d576aa82b92767.rdf',
//			'http://myrss.jp/rdf/r4d4d593c8228d9592.rdf',
//			'http://myrss.jp/rdf/r4d4d596415ae03607.rdf',
//			'http://myrss.jp/rdf/r4d4d5b0f8bfe49762.rdf'
		],
		countPerFeed: 10,
		countLimit: 10,
		dateFormat: 'yyyy年mm月dd日'
//		categorySeparator: ' | '
//		nocache: true
	});
});
