 $(function() {
	$(".ticker").each(function(){
		
		var ticker = $(this);
		  
		ticker.children().filter("dd").each(function() {
		  var data = $(this),
		  container = $("<div>");
		  //data.next().appendTo(container);
		  //data.prependTo(container);
		  //container.appendTo(ticker);
		});
				
		ticker.css("overflow", "hidden");
		
		function anim(currentItem) {
		  var distance = currentItem.height();
			duration = (distance + parseInt(currentItem.css("marginTop"))) / ticker.attr('rel');
			currentItem.animate({ marginTop: -distance }, duration, "linear", function() {
		    	currentItem.appendTo(currentItem.parent()).css("marginTop", 0);
				anim(currentItem.parent().children(":first"));
		  }); 
		};
		
		anim(ticker.children(":first"));
				
		ticker.mouseenter(function() {
		  ticker.children().stop();
		});
		
		ticker.mouseleave(function() {
		  anim(ticker.children(":first"));
		});
	  });
});
