// JavaScript Document

(function($) {
	/*----------------------------------------------------------------------------------------------
	[効能]
	<img>にマウスオーバーした際に、「_on」の付いた画像とスワップさせる。プリロード機能付。
	[設置]
	<img>タグにclass「imgSwap」を設定。
	----------------------------------------------------------------------------------------------*/
	$.fn.imgSwap = function() {
		/**
		* internal method
		*/
        var onMouseoverAction = function() { $(this).attr("src",$(this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_on$2")); };
        var onMouseoutAction = function() { $(this).attr("src",$(this).attr("src").replace(/^(.+)_on(\.[a-z]+)$/, "$1$2")); };
        var preloadAction = function() { $("<img>").attr("src",$(this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_on$2")); };
        /**
		*
		*/
        this.each(function() {
            $(this)
				.mouseover(onMouseoverAction)
				.mouseout(onMouseoutAction)
				.each(preloadAction);
        });
		//
		return this;
	}

})(jQuery);

$(function() {
	$("img.imgSwap").imgSwap();
});

//プルダウン


if(document.getElementById && document.all && navigator.userAgent.indexOf("Opera")<0){
	var obj = document.getElementById("g-navi");
	obj.innerHTML = obj.innerHTML.replace(/<dl>/gi,"<dl onmouseover='pull(this)' onmouseout='pull(this)'>");
}

function pull(obj){
	for(var i=0;i<obj.childNodes.length;i++)
		if(obj.childNodes[i].nodeName.toUpperCase()=="DD")
			obj.childNodes[i].style.display=obj.childNodes[i].style.display=="block"?"none":"block";
}


