//ticker plugin

$.fn.ticker = function(endColor) {
	return this.each(function() {
		$(this).append( '<div class="ticker fade_' + endColor + '"></div>' );
	
		$(this).bind('mouseover', function () {
			var length   = this.scrollWidth;
			var duration = 500 * length / 40;
			$('.ticker', this).hide();

			$(this).stop().animate({
				scrollLeft: length
				}, duration, 'linear');
		});
		$(this).bind('mouseleave', function () {
		    $('.ticker', this).show();
		    $(this).stop();
		    this.scrollLeft = 0;
		});
	});
}
