$(function(){

//現在地
	$("#localNav li a").each(function() {
		var url = document.URL.split("/");
		crtdir = url[4]; //第3階層
		if(crtdir) {
			$('#localNav li a[href*='+ crtdir +']').parent().addClass("current");
		}
	});
	$("#localNav li.current a img").each(function() {
		this.src = this.src.replace('.jpg', '_over.jpg');
	});

// external links
	$("a[rel$=external]").click(function(){
		this.target = "_blank";
	});

// popup
	$("a[rel$=popup]").click(function(){
		var newWin =window.open(this.href,"popwin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=650,height=600").focus();
		return false;
	});

// ロールオーバー
	var aPreLoad = new Object();
	$("img.imgover, .btn input, .btn a img, #header ul a img, #footer ul a img, #localNav ul a img, ul.pageNav a img")
	.not(".current img").each(function(i) {
		var tsrc = this.src;
		var ftype = this.src.lastIndexOf('.');
		var hsrc = this.src.substr(0, ftype) + '_over' + this.src.substr(ftype, 4);

		aPreLoad[this.src] = new Image();
		aPreLoad[this.src].src = hsrc;

		$(this).hover(
			function() { this.src = hsrc; },
			function() { this.src = tsrc; }
		);
	});

// ===== onlineshop ===================================
// external links
	$("#subNav .btn a[rel$=external], .pArchive .detail form").click(function(){
		this.target = "shopcart";
	});

// 一覧
	$(".pList .itemlist li dd").hide();
	$(".pList .itemlist li dt").hover(
		function () {
			$(this).parent().children("dd").show();
			$(this).parent().parent("li").addClass("over");
		}, 
		function () {
			$(this).parent().children("dd").hide();
			$(this).parent().parent("li").removeClass("over");
	});

});