$(function(){
	// マックの基準サイズの変更
	if(navigator.appVersion.indexOf("Mac") !=-1) {
		$('body').css('font-size', '12px');
		$('.faq #article #answer p').css({'text-indent':'-2em','margin-left':'2em'});
	}
		
	// header
	$('#header ul#nav img').hover(
		function(){
			$(this).stop().animate({'opacity':'0'}, 10);
		},
		function(){
			$(this).stop().animate({'opacity':'1'}, 1000);
		}
	);
	
	// aside search
	$('.searchBtn').hover(
		function(){
			$(this).attr('src', $(this).attr('src').replace('_off.', '_on.'));
		},
		function(){
				$(this).attr('src', $(this).attr('src').replace('_on.', '_off.'));
		}
	);
	
	// Datepicker
	var dt = new Date();
	var y = dt.getFullYear();
	var m = dt.getMonth()+1;
	m = (m<10)?'0'+m:m;
	var d = dt.getDate();
	d = (d<10)?'0'+d:d;
	$('#datepicker').val(y+'年'+m+'月'+d+'日');
	$('#dt_yyyymm').val(y+'/'+m+'/'+d);
	$('#dt_dd').val(d);
	
	$('#datepicker').datepicker({
		dateFormat: 'yy年mm月dd日',
		maxDate: '+6m',
		minDate: '0',
		onSelect: function(dateText, inst) {
			$('#dt_yyyymm').val(dateText.substr(0,4)+'/'+dateText.substr(5,2)+'/01');
			$('#dt_dd').val(dateText.substr(-3,2));
		}
	});
	
	// plan
	$('body.plans #article .box .img a').hover(
		function(){
			$(this).find('img').parent().parent().css('background','none');
			$(this).find('img').stop().animate({'opacity':'0.7'}, 300);
		},
		function(){
			$(this).find('img').stop().animate({'opacity':'1'}, 1000);
		}
	);
	
	// gallery
	$('.gallery#index #article .row .box a').hover(
		function(){
			$(this).find('img').stop().animate({'opacity':'0.7'}, 300);
		},
		function(){
			$(this).find('img').stop().animate({'opacity':'1'}, 1000);
		}
	);
	
	// footer
  $("#footerInformation .clearfix ul").tile();
});


// お気に入りに追加
function addFavorite() {
	var a=location.href,b=document.title,s=window.sidebar;
	if(/*@cc_on!@*/false){
		external.AddFavorite(a,b)
	} else if(s){
		s.addPanel(b,a,'')
	} else {
		alert('非対応です')
	};
}	
