
$(document).ready(function(){
  var winHeight = $(window).height();
	if(winHeight < 752) $("body").addClass("scroll");
});


/*	ロールオーバー
-------------------------------------------------------- */
jQuery(function($) {
	var suffix = '_on';
	$('.over').each(function() {
		var img  = $(this);
		var src  = img.attr('src');
		var name = src.substr(0, src.lastIndexOf('.'));
		var ext  = src.substring(src.lastIndexOf('.'));
		if (name.match(suffix + '$')) return;
		var src_on = name + suffix + ext;
		$('<img>').attr('src', src_on);
		img.hover(
			function() { img.attr('src', src_on); },
			function() { img.attr('src', src); }
			);
	});
});


/*	ロールオーバーで半透明
-------------------------------------------------------- */
$(function() {
	$("#navi a img").hover(function(){ 
		$(this).stop(true).fadeTo(100,0.85);
	},function() {
		$(this).fadeTo(500,1); 
	});
	$(".s_coupon a img").hover(function(){ 
		$(this).stop(true).fadeTo(100,0.80);
	},function() {
		$(this).fadeTo(500,1); 
	});
	
});

/*	flatHeights
-------------------------------------------------------- */
$(function(){
  var winWidth = $(window).width();
	if(winWidth > 360) {

		var sets = [], temp = [];
		$('#shops .s_comment').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 span = 1000;
var effect = 'easeOutQuint';

$(function() {
	var ua = $.browser;
	$("#menu a, #submenu a, .pagetop a, #logo a").click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
			$(this).blur();
			var t = navigator.appName.match(/Opera/) ? "html" : "html,body";
			$(t).queue([]).stop();
			var $targetElement = $(this.hash);
			var scrollTo = $targetElement.offset().top;
			if (window.scrollMaxY) {
				var maxScroll = window.scrollMaxY;
			} else {
				var maxScroll = document.documentElement.scrollHeight - document.documentElement.clientHeight;
			}
			if (scrollTo > maxScroll){
				scrollTo = maxScroll;
			}
			$(t).animate({ scrollTop: scrollTo }, span, effect);
			return false;
		}
	});
});



/*	class操作
-------------------------------------------------------- */
$(document).ready(function(){
  $("#menu ul li:last-child").addClass("last-child");
  $("#shops li:odd").addClass("right");
  $("#about tr:odd").addClass("odd");
});

