/*

Last UpDate 2010-01-06

*/

$(function(){
	//現在居るファイル名	   
	var currentFile = location.href.split('/').pop();
	
	//ua取得
	var ua = navigator.userAgent;
	
	/*
	//classが、'nav'で終わるulの、最後のliに、'last'クラスを付ける
	$('ul[class$="nav"]').each(function(){
		$('li:last',this).addClass('last');
	});
	*/
	
	$("div.access div.section4-1 th:odd").css('background','#fff');
	$("div.access div.section4-1 th:even").css('background','#EEEAE6');
	$("div.access div.section4-1 td:odd").css('background','#fff');
	$("div.access div.section4-1 td:even").css('background','#EEEAE6');
	
	//thエレメントを取得
	/*var bg=document.getElementsByTagName("th");
	//値処理
	/*for(i=0; i<bg.length; i++){
			if(i%2==0){
					$("div.news").css('background','#221100');	
				}else{
					$("div.news").css('background','#2D1D0D');
			}
		}	*/
	
	//classが、'news'で終わるdivの、偶数dlに、'even'クラスを付ける
	$('div[class$="news"] dl:nth-child(even)').addClass('even');
	
	//classが、'calTbl'で終わるtableの、2/7のtrに、'off'クラスを付ける
	$('table[class$="calTbl"] td:nth-child(7n+2)').addClass('off');
	
	//rollover
	$('a img').each(function(){
		var imgSrc = $(this).attr('src');
		//smartRollover
		if(imgSrc.match(/(.*)_off(\..*)/)){
			var repSrc = RegExp.$1+'_on'+RegExp.$2;
			$('<img />').attr('src',repSrc);
			$(this).hover(function(){
				$(this).attr('src',repSrc);
				$(this).css({opacity: '1',filter: 'alpha(opacity=100)'});
			},function(){
				$(this).attr('src',imgSrc);
			});
		//ウィンク効果

		}else if(!$(this).hasClass('not')){
			$(this).hover(function(){
				if((imgSrc.indexOf('_off') == -1) && (imgSrc.indexOf('_on') == -1)){
					$(this).css({
						opacity: '0.2',
						filter: 'alpha(opacity=20)'
					});
					$(this).fadeTo('slow',1.0);
				}else{
					$(this).css({opacity: '1',filter: 'alpha(opacity=100)'});
				}
			});

		}
		
	});
	
	
	//#footerコピーライトの年を動的に書き換え
	/*var year = new Date().getFullYear();
	var copyTxt = $('#footer address').html();
	if(copyTxt.match(/([0-9]{4}-)?([0-9]{4})/) != null){
		var repTxt = copyTxt.replace(RegExp.$2,year);
		$('#footer address').html(repTxt);
	}*/
	
	if(ua.indexOf('IE 6') > -1 || ua.indexOf('IE 7') > -1){

		//サムネールを内包する、.table-cell内で、display:table-cell;vertical-align:middle;のように表示する
		$('.table-cell').each(function(){
			var x = $('img',this).width();
			var y = $('img',this).height();

			var flag = this.nodeName.match(/a/i); //対象ノードがaかどうか判断
			if(flag){
				x += 4; //何故かieはaに内包されている時4px少なく算出する為+4
				y += 4; //何故かieはaに内包されている時4px少なく算出する為+4
			}
			
			if(x > y){
				$(this).css({display:'block'});
				var boxY = $(this).height();
				if(boxY != y){
					var rePadding = Math.floor((boxY - y) / 2);
					var reHeight = boxY - rePadding;
					$(this).css({paddingTop:rePadding+'px',height:reHeight+'px'});
				}else if(flag){
					$(this).css({display:'inline'});
				}
			}
		});
	}
	
	//透過条件設定
	/*if(ua.indexOf('IE 6') > -1){
		DD_belatedPNG.fix('.pngfix');
	}*/
	
	/*div.foreign div.section1-4 div.room dl
	div.foreign div.section1-5 dl
	div.foreign div.section1-7 dl*/
	//flatHeights設定
		var sets = [], temp = [];
		$('div.foreign div.section1-4 div.room dl').each(function(i) {
			temp.push(this);
			if (i % 2 == 1) {
				sets.push(temp);
				temp = [];
			}
		});
		
		if (temp.length) sets.push(temp);
		$.each(sets, function() {
			$(this).flatHeights();
		});

		
		var sets2 = [], temp2 = [];
				$('div.foreign div.section1-5 dl').each(function(i) {
			temp2.push(this);
			if (i % 2 == 1) {
				sets2.push(temp2);
				temp2 = [];
			}
		});
				
		if (temp2.length) sets2.push(temp2);
		$.each(sets2, function() {
			$(this).flatHeights();
		});
		
		var sets3 = [], temp3 = [];
				$('div.foreign div.section1-7 dl').each(function(i) {
			temp3.push(this);
			if (i % 2 == 1) {
				sets3.push(temp3);
				temp3 = [];
			}
		});
		if (temp3.length) sets3.push(temp3);
		$.each(sets3, function() {
			$(this).flatHeights();
		});
		
				var sets4 = [], temp4 = [];
				$('div.dish_box p').each(function(i) {
			temp4.push(this);
			if (i % 2 == 1) {
				sets4.push(temp4);
				temp4 = [];
			}
		});
		if (temp4.length) sets4.push(temp4);
		$.each(sets4, function() {
			$(this).flatHeights();
		});
		
	
	
		/* 各組ごとに高さ揃え */
		/*$.each(sets, function() {
			$(this).flatHeights();
		});
		
		var sets1 = [], temp1 = [];
		$('div.category div.itembox dl>dt').each(function(i) {
			temp1.push(this);
			if (i % 3 == 2) {
				sets1.push(temp1);
				temp1 = [];
			}
		});
		if (temp1.length) sets.push(temp1);
	
		/* 各組ごとに高さ揃え */
		/*$.each(sets1, function() {
			$(this).flatHeights();
		});*/
		
	
	//submit押した感 & ウィンクorsmartrollover
	//$('form p.send input').mousedown(function(){
	/*	$(this).css({position:'relative',top:'1px',left:'1px'});
	}).mouseup(function(){
		$(this).css({position:'static'});
	}).mouseout(function(){
		$(this).css({position:'static'});
	})
	  /* ウィンク版 */
	  	$('form p.send input').hover(function(){
	  /* smartrollover版　*/
		$(this).attr('src',$(this).attr('src').replace(/^(.*)_off.(.*)$/,'$1_on.$2'));
	},function(){
		$(this).attr('src',$(this).attr('src').replace(/^(.*)_on.(.*)$/,'$1_off.$2'));
	});
	
	//lightBox
	/*try{
		$('.lb a[href$=".jpg"],.lb a[href$=".png"],.lb a[href$=".gif"]').lightBox({
			overlayBgColor: '#000',
			overlayOpacity: 0.8,
			imageLoading:   'js/images/lightbox-ico-loading.gif',
			imageBtnPrev:   'js/images/lightbox-btn-prev.gif',
			imageBtnNext:   'js/images/lightbox-btn-next.gif',
			imageBtnClose:  'js/images/lightbox-btn-close.gif',
			imageBlank:     'js/images/lightbox-blank.gif'
		});
	}catch(error){
	}*/
/*$('p.btn').each(function(i){					 

	$(this).toggle(function(){
							
			jQuery(function ($) {
	$('a.basic').click(function (e) {
		e.preventDefault();
		
		$('#map0').modal();
		
	});
});
			

		/*var a=$("#map"+i).css("display","block");
		$("#map"+i).css("display","block");
		$("#map"+i).addClass('hover');
		if(a){
				initialize();*/
		
		
/*	},function(){
		$("#map"+i).css("display","none");
		$("#map"+i).removeClass('hover');
		
	});

	$("#map"+i).css("display","none");

});*/
$("#ja").click(function () {
       $.get("/map/ja.html",function(data){
          $("#result").html(data);
         });
    });
  
    $("#en").click(function () {
       $.get("/map/en.html", function(data){
          $("#result").html(data);
         });
    });
	
	  $("#chu").click(function () {
       $.get("/map/chu.html", function(data){
          $("#result").html(data);
         });
    });
	  
	    $("#chuk").click(function () {
       $.get("/map/chuk.html", function(data){
          $("#result").html(data);
         });
    });
		
		  $("#kan").click(function () {
       $.get("/map/kan.html", function(data){
          $("#result").html(data);
         });
    });

});


//jQuery(function($){

  
     
//});
