/* Simple List item marquee for jQuery
- http://www.doubleclique.com
- 2009 Kyle Beattie

Minimum CSS:
ul.resources li	{
	overflow:hidden;
}

ul.resources li a	{
	display:block;
	padding:0 0 0 1px;
	width:200px;
}

ul.resources li a span	{
	display:inline-block;
}

Ideal markup example:
<ul>
	<li>
		<a href="http://yourlinkhere.com"><span>Text</span></a>
	</li>
</ul>

You should also add a noscript option to top of page - e.g.:
<noscript>
	<style>
		label {
			position:static;
		}
	</style>
</noscript>
 */

(function($){
	$.fn.marquee = function(options) {
		var settings = $.extend(
			{
				
			},
			options
		);
		return this.each(function(index, el) {			
			var containerWidth = $(this).width()-parseInt($(this).find('a').css('padding-left'));
			var childWidth = $(this).find('span').outerWidth();

			if(childWidth > containerWidth){
				var offset = childWidth-containerWidth;
				$(this).find('a').hover(function(){
					$(this).parent().css('position','relative');
					$(this).css('background-position','left -25px');
					jQuery(this).find('span').css({
						'position':'absolute',
						'top':0,
						'right':-offset+'px'
					}).animate({
						'right':0+'px'
					},500,"linear");

				},function(){
					jQuery(this).find('span').animate({
						'right':-offset+'px'
					},500,"linear",function(){
						$(this).parent().css('position','static');
						$(this).find('span').css({
							'position':'static'
						});
						$(this).parent().css('background-position','left 4px');
					});
				});
			}
			
		});
	};
})(jQuery);