﻿
//製品カテゴリナビゲーション
$(function(){
	$("#headerArea ul.globalNav li.hasSecondaryNav").hover(function(){ $(this).find("ul").stop().fadeTo(280,1); } , function(){ $(this).find("ul").stop().fadeTo(280,0).hide(); });
});


//製品検索フォーム
$(function(){
	var form = $("#productSearch");
	var keyword = $("#productSearch .keyword");
	var defaultWord = $(keyword).val();
	$(keyword).focus(function(){
		if (keyword.val() == defaultWord) {
			keyword.val("");
		}
		$(form).addClass("focus");
	});
	$(keyword).blur(function(){
		if (keyword.val() == "") {
			keyword.val(defaultWord);
		}
		$(form).removeClass("focus");
	});
});


function showVideo(vId, vWidth, vHeight, src, auto){
	var $olCont = $('<div id="overlayContainer" style="z-index: 10000; position: fixed; top: 0px; left: 0px;"></div>');
	var $olBg = $('<div id="popupOverlay" style="background-color: rgb(171, 159, 143);"></div>');
	$olBg.css('opacity', 0.8);
	$olBg.width($(window).width());
	$olBg.height($(window).height());

	$olBg.bind('click', function(){
		$olCont.remove();
	});
	$olin = $('<div id="'+vId+'" class="inner" style="position: absolute; top: 50%; left: 50%;"></div>');
	$olin.css('margin-top', -(vHeight/2)).css('margin-left', -(vWidth/2));
	$olCont.append($olBg);
	$olCont.append($olin);
	$('body').append($olCont);
	FFLVPlayer.addPlayer(vId,vWidth,vHeight,src, '', '', '', '', '', auto);
	$olCont.exFixed();
}

function openLargeImg(src){
	var $olCont = $('<div id="overlayContainer" style="z-index: 10000; position: fixed; top: 0px; left: 0px;"></div>');
	var $olBg = $('<div id="popupOverlay" style="background-color: rgb(171, 159, 143);"></div>');
	$olBg.css('opacity', 0.8);
	$olBg.width($(window).width());
	$olBg.height($(window).height());

	$olBg.bind('click', function(){
		$olCont.remove();
	});
	$olin = $('<div class="inner" style="position: absolute; top: 50%; left: 50%;"></div>');
	$oImg = $('<img src="'+src+'">');
	$olin.append($oImg);
	
	$olCont.append($olBg);
	$olCont.append($olin);
	$('body').append($olCont);
	$olCont.exFixed();
	
	$oImg.load(function(){
		$olin.css('margin-top', -($olin.height()/2)).css('margin-left', -($olin.width()/2));
	});
}
