jQuery.fn.ticker = function(settings) {
		settings = jQuery.extend({
		travelocity: 0.07
		}, settings);		
		return this.each(function(){
				var $strip = jQuery(this);

				$strip.addClass("newsticker")
				var stripWidth = 0;
				var containerWidth = $strip.parent().parent().width();	//a.k.a. 'mask' width
				//$('div#scroll_vars').html("");
				//DEBUG$('div#latest_news').html("containerWidth = "+containerWidth+"<br>");
				//$strip.find("li").each(function(i){
				$strip.find(".ticker_list").each(function(i){
					//DEBUG$('div#latest_news').append("stripWidth += jQuery(this, i).width() => "+stripWidth+"+="+jQuery(this, i).width()+"<br>");
					stripWidth += jQuery(this, i).width();
				});
				//DEBUG$('div#latest_news').append("stripWidth="+stripWidth+"<br>");
				$strip.width(stripWidth);
				
				var defTiming = stripWidth/settings.travelocity;
				//DEBUG$('div#latest_news').append("defTiming = stripWidth/settings.travelocity => "+defTiming+"="+stripWidth+"/"+settings.travelocity+"<br>");
				
				var totalTravel = stripWidth+containerWidth;
				//DEBUG$('div#latest_news').append("totalTravel = stripWidth+containerWidth => "+totalTravel+"="+stripWidth+"+"+containerWidth+"<br>");
				
				function scrollnews(spazio, tempo){

					tempo=(spazio/pixels_per_second)*1000;
					//DEBUG$('#latest_news').append("<br>Function called: scrollnews("+spazio+", "+tempo+")<br>");

					if(ticker_running == 1){
						//$('#latest_news').append("Restarting Ticker<br>");
						//DEBUG$('#latest_news').append("Ticker Status: Restart<br>");
					}else{
						//$('#latest_news').append("New Ticker<br>");
						//DEBUG$('#latest_news').append("Ticker Status: New<br>");
					}
					
					//DEBUG$('#latest_news').append("Update Flag (need_ticker_update)="+need_ticker_update+" and update_complete="+update_complete+"<br>");
					if(need_ticker_update == 1 && update_complete == 1){
						//Need to update the ticker
						//$('#latest_news').append("Need to update ticker<br>");
						ticker_running=0;
						
						//update_ticker_html();
						$('ul#news_ticker').html(updated_html);
						intervalId=setInterval("update_need_ticker(1)",update_seconds);
						stripWidth = 0;
						
						
						$strip.find(".ticker_list").each(function(i){
							//DEBUG$('#latest_news').append("stripWidth += jQuery(this, i).width(); => "+stripWidth+" += "+jQuery(this, i).width()+"<br>");
							stripWidth += jQuery(this, i).width();
						});
						
						//DEBUG$('#latest_news').append("IN $strip.width("+stripWidth+")<br>");
						$strip.width(stripWidth);
						//$('#latest_news').append("2IN $strip.width("+stripWidth+")<br>");
						//DEBUG$('div#latest_news').append("stripWidth="+stripWidth+"<br>");

						defTiming = stripWidth/settings.travelocity;
						//DEBUG$('div#latest_news').append("defTiming = stripWidth/settings.travelocity => "+defTiming+"="+stripWidth+"/"+settings.travelocity+"<br>");
						totalTravel = stripWidth+containerWidth;
						//DEBUG$('div#latest_news').append("totalTravel = stripWidth+containerWidth => "+totalTravel+"="+stripWidth+"+"+containerWidth+"<br>");
						need_ticker_update=0;
						//DEBUG$('#latest_news').append("Ticker has been updated<br>");
						//scrollnews(totalTravel, defTiming);
						//DEBUG$('#latest_news').append("POST-Ticker has been updated<br>");

						need_ticker_update=0;
						update_complete=0;
						
					}
					else{
						//$('#latest_news').append("Do not need to update ticker-1<br>");
						if(need_ticker_update == 1){
							update_ticker_html();
						}
					}
					
					//DEBUG$('#latest_news').append("Right before animate<br>");
					$strip.animate(
					  {left: '-='+ spazio},
					  tempo,
					  "linear",
					  function(){
					  	$strip.css("left", containerWidth);
					  	//$('#latest_news').append("Do not need to update ticker-2 containerWidth="+containerWidth+"<br>");
					  	scrollnews(totalTravel, defTiming);
					  }
					);
					trip_count++;
					ticker_running=1;
				}
				
				
				scrollnews(totalTravel, defTiming);
				$strip.hover(function(){
				jQuery(this).stop();
				},
				function(){
				var offset = jQuery(this).position();
				var residualSpace = offset.left + stripWidth;
				var residualTime = residualSpace/settings.travelocity;
				residualTime=(residualSpace/totalTravel)*defTiming;

				scrollnews(residualSpace, residualTime);
			
				});			
		});	
};