// JavaScript Document

$(function(){
//  $(document).pngFix();
	
//	$("#sitemap #contents .left_block").height($("#sitemap #contents").height());
//	$("#sitemap #contents .center_block").height($("#sitemap #contents").height());
//	$("#sitemap #contents .right_block").height($("#sitemap #contents").height());

//ロールオーバー処理
	//a.btnの中にあるimgに_onを付けたものをa.btnに先読み
	$("a.btn").each(function(){
		if($(this).find('img')){
			$img =$(this).find('img');
			$src = $img.attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_on$2");
			$src = $src.replace("_cr_on", "_cr");
			$width = $img.css("width");
			$height = $img.css("height");
			$(this).css({ width:$width, height:$height,display:"block",background:"url("+$src+")"});
		}
	});
	//a.btnにカーソルが重なればimgをフェードアウト、外れればフェードイン
	$("a.btn").hover(function(){
		$(this).find('img').stop().fadeTo(250, 0.0);
	}, function () {
		$(this).find('img').stop().fadeTo(250, 1.0);
	});


//フォームメール
	if($("#contact .formbutton li")){
		$num   = $("#contact .formbutton li").length;
		$width = 120;
		$shim  = 20;
		if($num==1){
			$width = $width;
		}else{
			$width = $width*$num+($shim*($num-1));
		}
		$("#contact .formbutton").width($width);
	}
	$("#frm .delete").focus(function(){
		if(this.value == this.defaultValue){
			$(this).val("");
		}
			$(this).removeClass("delete");
　});
	
});



//==================================================
//====ムービーの再生
//==================================================
function playSwfMp4($filePath){
	$("*").css({ padding:"0",margin:"0",overflow:"hidden",lineHeight:"0",margin:"0",});

	if ($.browser.mozilla){
		$replaceString = $.browser.version.replace(/\./g, "");
		$replaceString = $replaceString.replace(/^(..).*/,"$1");
//		alert($replaceString+"="+$.browser.version);
		if($replaceString == 18 || $replaceString == 17 ){//Mozillaのバージョンが1.8か1.7なら
			document.write('<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="800" height="532"> <param name="src" value="'+$filePath+'" /> <param name="controller" value="true" /> <object type="video/quicktime" data="'+$filePath+'" width="800" height="532" class="mov">  <param name="controller" value="true" /> </object></object>');
			document.close();
			$("#FlashID").css({ display:"none"});
			$("*").css({ lineHeight:"1.6"});
		}else{
			swfobject.registerObject("FlashID");
		}
	}else{
		swfobject.registerObject("FlashID");
	}
}
//==================================================
//====フォームメール
//==================================================

function send(){
	if($("#name_s") && $("#name_s").val()==""){
		alert("担当者名が未入力です。");
		$("#name_s").focus();
	}else if($("#tel_s") && $("#tel_s").val()==""){
		alert("TELが未入力です。");
		$("#tel_s").focus();
	}else if($("#email_s") && $("#email_s").val()==""){
		alert("メールアドレスが未入力です。");
		$("#email_s").focus();
	}else{
	document.frm.submit();
		
	}
}
//==================================================
//====ブランクウィンドウで開く
//==================================================
function wOpen(URL){//標準
	URL = window.open(URL, 'pop', 'width=700, height=700, menubar=no, toolbar=no, scrollbars=yes,resizable=yes'); 
	URL.focus();
}
function wOpenL(URL){//サイズ違い
	URL = window.open(URL, 'popL', 'width=840, height=700, menubar=no, toolbar=no, scrollbars=yes,resizable=yes'); 
	URL.focus();
}

//==================================================
//====親ウィンドウで開く
//==================================================
function wOpener(url){
	if(!window.opener || window.opener.closed){
		location.href=url;
	}
	else{
		window.opener.location.href = url;
	}
}



