// 商品一覧 設定
$(function(){
	/* div要素を4つずつの組に分ける */
	var sets = [], temp = [];
	$('.itemList > dl').each(function(i) {
		temp.push(this);
		if (i % 4 == 3) {
			sets.push(temp);
			temp = [];
		}
	});
	if (temp.length) sets.push(temp);
	/* 各組ごとに高さ揃え */
	$.each(sets, function() {
		$(this).flatHeights();
	});
});

// ご利用ガイド 設定
$(function(){
	/* div要素を2つずつの組に分ける */
	var sets = [], temp = [];
	$('#guideMenu .section').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();
	});
});

// イージング 設定
/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Copyright (C) 2008 George McGinley Smith
 * All rights reserved.
*/
jQuery.easing.outExpo = function (x, t, b, c, d) {
	return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
};

// スムーズスクロール 設定
/*
 * jQuery SmoothScroll
 * Copyright (C) 2009 Hidemaro Mukai(http://www.maro-z.com).
*/
$(function() {
	var ua = $.browser;
	$('a[href*=#]').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 }, 1000, 'outExpo');
			return false;
		}
	});
});

// 画像切り替え 設定
$(function(){
	var tnAnchor = $('ul#photoSwitcher li a');
	var tn = $('ul#photoSwitcher li img');
	tnAnchor.hover(function(){
		$("#itemPhoto").attr("src",$(this).attr('href'))
	});
	tnAnchor.click(function(){
		return false
	});
	tn.hover(function(){
		tn.removeClass('current')
		$(this).addClass('current')
	});
});


