var switchImage = function(){
	A = {
		//タイマーオブジェクト
		timer : null,
		//表示中のindex
		showIndex : 0,
		//オプション
		option : {
			parentNode : "#index_keyvisual",
			targetNode : "#index_keyvisual > div",
			jumpNode : "#index_keyvisual > #scene_jump > li",
			interval : 5000,
			effectsSpeed : 1500
		},
		
		//初期化処理
		init : function(){
			$(A.option.parentNode).mouseover(A.stop) ;
			$(A.option.parentNode).mouseout(A.start) ;
			$(A.option.jumpNode).click(A.jump) ;
			
			//IEで新規登録ボタンの表示が遅れるので対応
			//新規登録ボタンのz-indexは99
			$(A.option.targetNode).css("z-index", 150) ;

			A.showIndex = 0 ;
			$(A.option.targetNode+":eq("+A.showIndex+")").fadeIn(A.option.effectsSpeed) ;
			$(A.option.jumpNode+":eq("+A.showIndex+") img" ).attr("src", $(A.option.jumpNode+":eq("+A.showIndex+") img" ).attr("src").replace("_off.", "_ov.")) ;
			A.timer = setInterval(A.change, A.option.interval) ;
		},
		
		//切り替え処理
		change : function(){
			$(A.option.targetNode+":eq("+A.showIndex+")").fadeOut(A.option.effectsSpeed) ;
			A.showIndex++ ;
			var nodeNum = $(A.option.targetNode).length ;
			if(A.showIndex >= nodeNum){
				A.showIndex = 0 ;
			}
			$(A.option.targetNode+":eq("+A.showIndex+")").fadeIn(A.option.effectsSpeed) ;
			$(A.option.jumpNode+" img" ).each(function(){
					$(this).attr("src", $(this).attr("src").replace("_ov.", "_off.")) ;
				}) ;
			$(A.option.jumpNode+":eq("+A.showIndex+") img" ).attr("src", $(A.option.jumpNode+":eq("+A.showIndex+") img" ).attr("src").replace("_off.", "_ov.")) ;
		},
		
		start : function(){
			if(A.timer === null){
				A.timer = setInterval(A.change, A.option.interval) ;
			}
		},

		stop : function(){
			if(A.timer !== null){
				clearInterval(A.timer) ;
			}
			A.timer = null ;
		},

		jump : function(){
			if(A.timer !== null){
				clearInterval(A.timer) ;
			}
			$(A.option.targetNode+":eq("+A.showIndex+")").fadeOut(A.option.effectsSpeed)

			var index = $(A.option.jumpNode).index(this);
			A.showIndex = index ;
			var nodeNum = $(A.option.targetNode).length ;
			if(A.showIndex >= nodeNum){
				A.showIndex = 0 ;
			}
			$(A.option.targetNode+":eq("+A.showIndex+")").fadeIn(A.option.effectsSpeed) ;
			$(A.option.jumpNode+" img" ).each(function(){
					$(this).attr("src", $(this).attr("src").replace("_ov.", "_off.")) ;
				}) ;
			$(A.option.jumpNode+":eq("+A.showIndex+") img" ).attr("src", $(A.option.jumpNode+":eq("+A.showIndex+") img" ).attr("src").replace("_off.", "_ov.")) ;
		}
		
	}
	return A ;
}();
