/* #############################################################
#WEB_SITES_JS {
	--------------------------------------------
	#filename	: base.js
	#version    : 1.0;

	サイト内JavaScriptの管理ファイル
	--------------------------------------------
}

#CONTENT {
	--------------------------------------------
	+ 1: rollover function
	+ 2: stripe function
	+ 3: accordion function

	+ 999: CSS set
	--------------------------------------------
}

############################################################# */


$(function(){
/* ==============================================================
	
	[+1:]
	rollover function
	for jQuery

============================================================== */
$('img.hov')
	.mouseover(function () {
		this.src = this.src.replace(/^(.+)(\.[a-z]+)$/, "$1_hov$2");
	})
	.mouseout(function () {
		this.src = this.src.replace(/^(.+)_hov(\.[a-z]+)$/, "$1$2");
	})
	.each(function () {
		this.preloaded = new Image;
		this.preloaded.src = this.src.replace(/^(.+)(\.[a-z]+)$/, "$1_hov$2");
});
$("input.hov")
	.mouseover(function () {
		this.src = this.src.replace(/^(.+)(\.[a-z]+)$/, "$1_hov$2");
	})
	.mouseout(function () {
		this.src = this.src.replace(/^(.+)_hov(\.[a-z]+)$/, "$1$2");
	})
	.each(function () {
		this.preloaded = new Image;
		this.preloaded.src = this.src.replace(/^(.+)(\.[a-z]+)$/, "$1_hov$2");
});


$('img.on')
	.each(function () {
	this.src = this.src.replace(/^(.+)(\.[a-z]+)$/, "$1_hov$2");
});
	


/*
※jQuery is necessary. 
■ボタンのロールオーバー用ファンクション(jQuery版)

【操作手順】
[1]ロールオーバー前用の画像を適当なファイル名で用意します。 例：btn.gif
[2]ロールオーバー時用の画像のファイル名末端に"_hov"と付けます。 例：btn_hov.gif
[3]設置するimg要素に class="hov" を指定します。
---------------------------------------------------------------
<img class="hov" src="../../common/js/img/btn.gif" alt="test" />
---------------------------------------------------------------
*/

/* ==============================================================
	
	[+3:]
	accordion function
	for jQuery

============================================================== */
$(".accordion").each(function(){
	$("dd", this).each(function(){
		var $this = $(this);
		if(!$this.hasClass("open")){
			$this.find("ul").hide();
		}
	});
});
$(".accordion span").css("cursor", "pointer"); 
$(".accordion span").click(function(){
	if($(this).next().is(":visible")){
		$(this).next().slideUp("slow");
	}else{
		$(this).next().slideDown("slow");
		$(this).parent().siblings().children("ul:visible").slideUp("slow");
	}
	return false;
});



});
//END "$(function()"




