/*  BaseJQ JavaScript framework, version 4
 *  要jquery.js version 1.4.2
 *--------------------------------------------------------------------------*/ 

overImageClass= "overimage"; //ロールオーパー対象class
overImageClassFoot= "_on"; //ロールオーパーイメージ付加文字列
IMGTGLFOOT= "_off"
toggleImageFoot = "_on"; //トグル機能で現在のページを示す画像イメージ付加文字列

/*ロールオーバー・トグル*/

$(function(){
	var conf = {
		className : "." + overImageClass,
		overNode : overImageClassFoot,
		toggleNode : toggleImageFoot
	};
	//トグルエンジン実行

	if(typeof(PAGEID) != "undefined" ){	
		for(var i = 0; i < PAGEID.length; i++){
		var TGTID = PAGEID[i]
		var NODEID = "#" + TGTID
		$(NODEID).each(function(){
		this.oriSrc = this.src;
		this.cngSrc = this.oriSrc.replace(/(\.gif|\.jpg|\.png)/, conf.toggleNode+"$1");
		this.src = this.cngSrc;
		$(NODEID).removeClass(overImageClass);
		});
		};		
	};

	//ロールオーバーエンジン実行
$(conf.className).each(function(){
		this.originalSrc = this.src;
		this.rolloverSrc = this.originalSrc.replace(/(\.gif|\.jpg|\.png)/, conf.overNode+"$1");
		
		preloadImage(this.rolloverSrc);

		}).hover(function(){
			this.src = this.rolloverSrc;
		},function(){
			this.src = this.originalSrc;
		}).click(function(){
			this.src = this.originalSrc;
		});
	
});

/*汎用スクリプトここから*/


/*イメージプリロードエンジン*/

preloadedImages = [];
function preloadImage(url){
	var p = preloadedImages;
	var l = p.length;
	p[l] = new Image();
	p[l].src = url;
};


/*サブグループ用　アコーディオンエンジン*/
$(function(){
	$(".memberProfile").css("display","none");
	$(".open img.rollover").click(function(){
		if($(this).next(".memberProfile").css("display")=="none"){
			$(this).next(".memberProfile").slideDown("fast");	
			$(this).attr("src",$(this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_on$2"));
		}else{
			$(this).next(".memberProfile").slideUp("fast");
			$(this).attr("src",$(this).attr("src").replace(/^(.+)_on(\.[a-z]+)$/, "$1$2"));
		}
	});
});


/*サイエンスアウトリーチ用　アコーディオンエンジン*/
$(function(){
	$(".switch").css("display","none");
	$(".btnOpen").click(function(){
		if($(this).prevAll(".switch").css("display")=="none"){
			$(this).prevAll(".switch").slideDown("fast");	
			$(this).attr("src",$(this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_on$2"));
		}else{
			$(this).prevAll(".switch").slideUp("fast");
			$(this).attr("src",$(this).attr("src").replace(/^(.+)_on(\.[a-z]+)$/, "$1$2"));
		}
	});
});
