//Sweets
$(document).ready(function(){
	$.fn.exScrollTop = function(){
		return this.attr('tagName')=='HTML' ? $(window).scrollTop() : this.scrollTop();
	}
	$("#collection > li:not(:first)").css("display","none");
	$("#subMenu a:first").addClass("now").blur();
	$showBlock='';
	$target='';
	$targetM='';
	$index=0;
	$(function(){scrtop();});
	//$showBlockStr,$lSearch,$arrSearch,$lhash,$showBlock,$cake,$target,$targetM;
	if(window.location.search.length>0){
	    var arrSearch = window.location.search.split('&');
	    for(x=0;x<arrSearch.length;x++) {
	    	//alert(x.substring(1,3));
		if(arrSearch[x].substring(1,3)=="c_"){
		    $showBlock=arrSearch[x].substring(1,arrSearch[x].length);
		    $target = "#collection li" + "#" + $showBlock;
		    //alert($target);
		    $targetM =  "#subMenu a" + "#m_" + $showBlock.substring(2);
		}
	    }
	    if ($($target).length) {
		$index = $("#subMenu a").index($($targetM));
		$(function(){show();});
	    }
	}
	$("#subMenu li:not(.otherpage) a").click(function () {
	    $index = $("#subMenu a").index(this);
	    $target = $("#collection > li").eq($index);
	    $targetM =  $(this);
	    $(this).blur();
	    $(function(){show();});
	    $(function(){scrtop();});
	    return false;
	});
	$("#bottomMenu li a").click(function () {
	    $index = $("#bottomMenu a").index(this);
	    $target = $("#collection > li").eq($index);
	    $targetM =  $(this);
	    $(this).blur();
	    $(function(){show();});
	    $(function(){scrtop();});
	    return false;
	});
	$(".special #saiji li a").click(function () {
	    var index = $("#saiji a").index(this);
	    $("#saiji a").removeClass("now");
	    $(this).addClass("now");
	    $("#collection > li:not(index)").css("display","none");
	    $("#collection > li").eq(index).css("display","block");
	    $(this).blur();
	    $(function(){scrtop();});
	    return false;
	});

    $("dl.topic:last").css("border-bottom", "none");
    jQuery.easing.quart = function (x, t, b, c, d) {
    return -c * ((t=t/d-1)*t*t*t - 1) + b;
    };
    /*みせる*/
    function show() {
	$("#collection > li:visible").css("display","none");
	$($target).css("display","block");
	$("#subMenu a").removeClass("now");
	$($targetM).addClass("now").blur();
    }
    /*スクロールトップ*/
    function scrtop() {
	$('html,body').scrollTop(0);
	//$('html').exScrollTop(0);
		/*
	if(!jQuery.support.checkOn){
		//mac Safari5.0.2でスクロール後に商品画像の一部が残像の様に残る現象を回避
		$('body').scrollTop(0)
		.fadeOut(0,function(){
			$('body').fadeIn(0)
			.addClass("isWebkit");
		});
	}else{
		$('html').scrollTop(0).addClass("notWebkit");
	}
	*/
    }
    
});

    
