// jQuery

$(function(){
/////////////////////////////////////////////////////////////////////////////////////////////


// Swap Image
$('img.hov').each(function(i){
	var before = $(this).attr('src');
	var after = (before.indexOf('gif') != -1) ? before.replace('.gif', '_hov.gif') : before.replace('.jpg', '_hov.jpg');
	
	var preload = new Image();
	preload.src = after;
	
	$(this).hover(function(){
		$(this).attr('src', after);
	},function(){
		$(this).attr('src', before);
	});
});		   

// Page Top
$('.pagetop').click(function(){
	$.scrollTo('body',1000);
	return false;
});

$("a.gshock-win").click(function() {
	var href = $(this).attr('href');																																	
	var gWin = window.open(href,'gshockwin','status=yes, toolbar=yes, location=yes, menubar=yes, scrollbars=yes, resizable=yes');
	gWin.focus();
	return false;
 });

$("a.win-lovers").click(function() {
	var href = $(this).attr('href');																																	
	var lWin = window.open(href,'loverswin','width=800,height=580,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes');
	lWin.focus();
	return false;
 });

/////////////////////////////////////////////////////////////////////////////////////////////	   
});

function closeupWindow(n, w, h) {
	var newwin = window.open(n,"CLOSEUP","width="+w+",height="+h+"toolbar=no,location=no,status=no,menubar=no,scrollbars=1,resizable=yes");
	newwin.focus();
}

$(document).ready(function(){

	// 現在のパス取得
	var path_arr = document.URL.split('/');
	if(path_arr.length == 5) return;
	path_arr.shift();
	path_arr.shift();
	path_arr.shift();

// 現在地表示
	var link_lineup;
	while(path_arr.length){
		link_lineup=$('#menu-lineup').find('a[href^=/'+path_arr.join('/')+']');
		if(link_lineup.length){
			link_lineup.addClass('active');
			break;
		}
		path_arr.pop();
	}
});
