(function(jQuery) {
	
	jQuery.fn.ticker = function (options) {
 		
		var opts = jQuery.extend({}, jQuery.fn.ticker.defaults, options);
		var theTicker = jQuery(this);
		var status = 0;
		
		this.children().each(function() {
			jQuery(this).mouseover(onOver);
			jQuery(this).mouseout(onOut);
		});
		
		function onOver() {
			status = 1;
			clearTimeout(theTickerTimer);
		}
				
		function onOut() {
			status = 0;
			animator();
		}
		
		function animator(){
			
			var childCount = theTicker.find('li').length;
			if(childCount >= 5){
			
				theTickerTimer = setTimeout(function(){ 
					var offset = 180;
					theTicker.animate({
						marginLeft: "-"+offset
					}, 2000, function(){
						var temp = "<li>" + theTicker.children(":first").html() + "</li>";
						theTicker.append(temp);
						theTicker.children(":first").remove();
						theTicker.css('marginLeft',0);
						if(status == 0)
						{
							animator();	
						}
					});
				},3500);
			
			}
			
		}
		
		animator();

 	}
	
})(jQuery);
