$(function(){
	
	function newsTicker(){
		
		if($("li","div#newsCol ul").length<=1) return false;
		
		$("li","div#newsCol ul").each(function(i){
			
			$(this).attr("id","item_"+(i+1));
				$(this).show()
				
			})
		
	};
		
	newsTicker();

	var now=0;
	var next=0;
	
	var limit = $("#newsCol li").length;
	var width = $("#newsCol li").width();
	var height = $("#newsCol li").height();
	


	$("#newsCol ul li:not(:first)").css({"margin-left": width + "px"});
	

	var fromPx =width ;
	var dur = 400;
	


	setInterval(function(){
		now++;
		next=now+1
		
		if(now==limit) next=1
		 
		 
		//window.console.log($("#item_"+now)); //trace
		
		

      $("#item_"+now).animate({ marginLeft: -fromPx}, {duration:dur,easing:"easeOutBack"}).animate({ marginLeft: fromPx}, 0);
		$("#item_"+next).animate({ marginLeft: 0 }, {duration:dur,easing:"easeOutBack"});
		
		if(now==limit) now = 0;//now初期化}
		
		
	},newsTimer)














	
 /* 	$.timer(retime, function (timer) {
		if (i_04 == limit) {
			$("#newsCol ul li.item_" + i_04).animate({"left": "-=" + width + "px"}, animate_speed,
				function(){
					$("#newsCol li.item_" + limit).css({"left": width + "px"});	
				}												 
			);
			$("#newsCol ul li.item_1").animate({"left": "-=" + width + "px"}, animate_speed);
			i_04 = 1;
  			timer.reset(retime);
  		}
		else {
			$("#newsCol ul li.item_" + i_04).animate({"left": "-=" + width + "px"}, animate_speed,
				function(){
					$(this).css({"left": width + "px"});	
				}												 
			);
			$("#newsCol ul li.item_" + (i_04 + 1)).animate({"left": "-=" + width + "px"}, animate_speed);
  			i_04++;
  			timer.reset(retime);
		}
  	});*/
});
