﻿$(function(){

	//製品カテゴリナビゲーション
	$("#headerArea ul.globalNav li.hasSecondaryNav").hover(function(){ $(this).find("ul").stop().fadeTo(280,1); } , function(){ $(this).find("ul").stop().fadeTo(280,0).hide(); });


	//製品検索フォーム
	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");
	});


	//メルマガ登録フォーム
	var mailSubscribe = $("#mailSubscribe");
	var subscribeInput = $("#subscribeInput");
	var defaultMessage = $(subscribeInput).val();
	$(subscribeInput).focus(function(){
		if (subscribeInput.val() == defaultMessage) {
			subscribeInput.val("");
		}
		$(mailSubscribe).addClass("focus");
	});

	$(subscribeInput).blur(function(){
		if (subscribeInput.val() == "") {
			subscribeInput.val(defaultMessage);
		}
		$(mailSubscribe).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 showYoutube(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));
	$olYoutube = $('<iframe src="" frameborder="0" allowfullscreen></iframe>');
	$olYoutube.css("width",vWidth).css("height",vHeight).attr("src",src+"?autoplay=1");
	$olCont.append($olBg);
	$olCont.append($olin);
	$olin.append($olYoutube);
	$('body').append($olCont);
	$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());

	$olCont.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));
	});
}



