/*
 * newsticker.js 0.9
 * Copyright (c) 2007 C.M.A. Co.,Ltd.
 *
 * Last Added: 2007-01-15
 *
 */

$(function(){
	// ticker 
	var	tickerLen = new Array();
	$.newsticker = function(len,num){
		if(len > tickerLen[num]-1)len=0;
		$('#ticker'+num+' li:eq('+len+')').each(function(){
			$(this).css('left',800)
				.animate({left:1000},{duration:1000,easing:'linear'})
				.animate({left:0},{duration:20000,easing:'easeOutExpo'})
				.animate({left:0},{duration:2000,easing:'linear'})
				.animate({left:-this.liWidth},{duration:2000,easing:'easeInOutExpo',complete:function(){$.newsticker(++len,num)}});
		});
	}
	// ファイルの読み込み 
	$('#ticker1').load('http://www.egg-jp.com/ticker.html',function(){
		tickerLen[1] = $('#ticker1 li').length;
		$('.ticker li').each(function(){
			this.liWidth = $(this).width();
			$(this).css('left',800);
		});
		$.newsticker(0,1);
	});

});

