//SMDE@komura.Yukihiro need jQuery1.5.1
(function($) {
$(document).ready(function(){

/*+++++++++++++++++++++++++++++++++++++
	バナーカルーセル
+++++++++++++++++++++++++++++++++++++++*/
	var nowAnimated1 = false;
	//左+++++++++++++++++++++++++++++++++++++++++++++++++
		$('#lotation_bnrs .btn_left').click(tokusetuLeftMove);
		
		function tokusetuLeftMove(){
			if(nowAnimated1 == false){
				nowAnimated1 = true; //ロック
				var tgt = $('#lotation_main a:first');
				var nowMpx = tgt.css('margin-left');
				var nowM = nowMpx.slice(0,nowMpx.length-2) - 175;
				$('#lotation_main a:first').animate({
					marginLeft:nowM
				},'slow',function(){
					$(tgt).css('margin-left','0').appendTo($('#lotation_main'));
					nowAnimated1 = false; //ロック解除
				});
			}
		};
	
	//右+++++++++++++++++++++++++++++++++++++++++++++++++
		$('#lotation_bnrs .btn_right').click( tokusetuRightMove );
		
		function tokusetuRightMove(){
			if(nowAnimated1 == false){
				nowAnimated1 = true; //ロック
				$('#lotation_main a:first').before($('#lotation_main a:last'));
				$('#lotation_main a:first').css('margin-left','-175px');
				$('#lotation_main a:first').animate({
					marginLeft:0
				},'slow',function(){
					nowAnimated1 = false; //ロック解除
				});
			}
		};
		
		var tokusetuTimer;
		function start_tokusetuTimer() {
			clearInterval(tokusetuTimer);
			tokusetuTimer = setInterval(loop_tokusetuTimer,7000);
		}
		function stop_tokusetuTimer() {
			clearInterval(tokusetuTimer);
		}
		function loop_tokusetuTimer() {
			tokusetuLeftMove();
		}
		// #tokusetu内にいるときはタイマー停止
		start_tokusetuTimer();
		$('#lotation_bnrs').mouseenter( 
			function(){
				stop_tokusetuTimer()
			});
		$('#lotation_bnrs').mouseleave( 
			function(){
				start_tokusetuTimer()
			});
});
})(jQuery);

