(function($){

	$.fn.mscroll = function(p){

		return this.each(function(){

			var p = $.extend({
				speed:   3,  //Specify the marquee's marquee speed (larger is faster 1-10)
				pause:   1   //Pause marquee onMousever (0=no. 1=yes)?
			}, p);

			var obj = $(this);

			////NO NEED TO EDIT BELOW THIS LINE
			p.speed = obj.attr('speed') ? obj.attr('speed') : p.speed;
			p.speed = (document.all) ? p.speed : Math.max(1, p.speed - 1);
			//slow speed down by 1 for NS

			var width =  obj.width();
			var height = obj.height();

			var speed = p.speed;
			var pausespeed = p.pause == 0 ? speed : 0;

			var container = $('<div></div>').css({
				position: 'relative',
				overflow: 'hidden',
				width: 	  width,
				height:   $.browser.msie?44:height
			});

			container.append('<div style="position:relative;left:0;top:0"><nobr></nobr></div>');

			var scroll = container
				.mouseover(function(){
					speed = pausespeed;
				}).mouseout(function(){
					speed = p.speed;
				}).find('>div');

			scroll.css('left', width + 8)
				  .find('nobr').html(obj.html());

			obj.empty().append(container);
				  
			var actualwidth = scroll.find('nobr').width();

			function scrollmarquee(){
				var left = parseInt(scroll.css('left'));
		
				if (left > (actualwidth * (-1) + 8)){
					scroll.css('left', left - speed);
				}
				else {
					scroll.css('left', width + 8);
				}
			}

			lefttime = setInterval(scrollmarquee, $.browser.opera ? 15 : 20);
		});
	}
})(jQuery);