/*  BaseJQ JavaScript framework, version 3
 *  要jquery.js version 1.3.2
 *--------------------------------------------------------------------------*/ 

overImageClass= "overimage"; //ロールオーパー対象class
overImageClassFoot= "_over"; //ロールオーパーイメージ付加文字列
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 openwin(theURL,winName,features) {
	window.open(theURL,winName,features);
};

/*楽しみ方検索ポップアップエンジン*/
function pop2ASearch(p){
	var path = (p) ? p : "/otanoshimi/index.html" ;
	var PopWidth  = ",width=" + 950;
	var PopHeight = ",height=" + 680;
	var PopWinName= "pop";
	var PopDetail = "scrollbars=1,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0" + PopWidth + PopHeight;
	PopWin = window.open(path,PopWinName,PopDetail);
	PopWin.focus();
}

/*faqタブエンジン*/
$(document).ready(function(){
	$('#tabs .tab_contents').hide();
	$('#tabs .tab_contents:first').show();
	$('#tabs .tabs_list li:first-child').addClass('active');
	
	$('#tabs .tabs_list li').click(function(){
											  
		var index = $('#tabs .tabs_list li').index(this);
		
		$('#tabs .tabs_list li').removeClass('active');
		
		$(this).addClass('active');
		$('#tabs .tabs_list li').eq(index-5).addClass('active');
		$('#tabs .tabs_list li').eq(index+5).addClass('active');
		
		var currentTab = $(this).find('a').attr('href');
		$('#tabs .tab_contents').hide();
		if($.browser.msie)
			$(currentTab).fadeIn("slow",function(){ this.style.removeAttribute("filter"); });
		else
			$(currentTab).fadeIn("slow");
		
		return false;
	});
});

	
