/*
	version  : 2010-06-02_002
	requires : jquery.js(ver1.4.2)
*/

	/*
			ポップアップ
	-----------------------------------------------*/
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
$(function(){

	/*
	  
	-------------------------------------------*/
	var commonDirPath = (function(){
		var dirName = arguments.length? arguments[0] : 'shared';
		var jsFile  = "js\/jquery\.js";
		var scriptTag = document.getElementsByTagName('SCRIPT');
		var reg = new RegExp( "(.*\/?" + dirName + "\/)" + jsFile + "$" );
		if( scriptTag ){
			for( var i=0; i<scriptTag.length; i++ ){
				if( scriptTag[i].src.match(reg) ){
					return RegExp.$1;

				}
			}
		}
		return '/'+ dirName +'/';
	})();


	/*
	  通常のrollover処理
	-----------------------------------------------*/
	new RolloverImages( 'rollover', 'on' );




	/*
	  製品一覧
	-------------------------------------------*/
	var plist_btn = [
		{
			"src" : "images/common_bt09.gif",
			"alt" : "閉じる"
		},
		{
			"src" : "images/common_bt09open.gif",
			"alt" : "開く"
		}
	];

	$("#product-list-button").click(function(event){
		event.preventDefault();
		$(".product-list-row").each(function(){
			$(this).toggle();
		});
		togglePListButton();
	});

	function togglePListButton(){
		var btn = ($(".product-list-row:first").css("display")=="none")? plist_btn[1] : plist_btn[0];
		$("#product-list-button").attr({
			"src" : commonDirPath + btn.src,
			"alt" : btn.alt
		});
	}

	togglePListButton();
	
	/*
	  製品案内右ナビ
	-------------------------------------------*/
	var rnavi_btn = [
		{
			"src" : "images/common_ic13.gif",
			"alt" : ""
		},
		{
			"src" : "images/common_ic13on.gif",
			"alt" : ""
		}
	];

	$("#local-navi02 .btn").click(function(event){
		event.preventDefault();
		$(this).parent().next().toggle();
		
		var btn = ($(this).parent().next().css("display")=="none")? rnavi_btn[1] : rnavi_btn[0];
		$(this).find("img").attr({
			"src" : commonDirPath + btn.src,
			"alt" : btn.alt
		});
	});

	function toggleRnaviButton(){
		$("#local-navi02 li.on").each(function(){
				$(this).find("ul.second-navi").css("display","block");
		});
	}

	toggleRnaviButton();
	// ver1.4.2upのためclass前の@を削除	
	$("#local-navi02 li").not("[class*='on']").hover(
		function(){
		$(this).addClass("on");	
		},
		function(){
		$(this).removeClass("on");	
		}
		);
	/*
	  print
	-------------------------------------------*/
	$('#print-btn').click(function(){ window.print();});
	
});



/*
  製品リストは最初は非表示
-------------------------------------------*/
document.write('<style type="text/css">.product-list-row {display: none;}</style>');




/*
  最初から製品リストを表示させたい場合は
  こちらをhead要素内で実行。
-------------------------------------------*/
function showProductList(){
	//var val = ( jQuery.browser.msie )? "block" : "table-row";
	val = "block";
	//var val = ( jQuery.browser.msie && parseInt(jQuery.browser.version) < 8 )? "block" : "table-row";
	document.write('<style type="text/css">.product-list-row {display: '+ val +';}</style>');
}



/*
  製品案内右ナビは最初は非表示
-------------------------------------------*/
document.write('<style type="text/css">ul.second-navi {display: none;}</style>');

