jQuery.extend({
	
	duration	: 	null,
	direction	: 	null,
	widthTotal	: 	0,
	
	initMarquee:function() {
		//remove js-disabled class
		$.mcoords = new Array()
		$("#viewer").removeClass("js-disabled");
		
	  	//create new container for images
		var w = 0;
		var wrappers = $(".wrapper");
		$.shiftTotal = wrappers.length;
		for (var i=0;i<wrappers.length;i++) {
			$(wrappers[i]).css('left',w+'px');
			w += $(wrappers[i]).find("img").attr('width') + 30;
		}
		$.widthTotal = w;
		$("<div>").attr("id", "container").css({ position:"absolute"}).width(w).height(12).appendTo("div#viewer");

		//add images to container
		wrappers.each(function() {	$(this).appendTo("div#container");	});
		wrappers.everyTime(30, function() {
			var t = $(this);
			var l = parseInt(t.css('left').split("px")[0]);
			t.css('left',l-2+'px');
			if (l < 0-t.width()) {
				t.css('left', parseInt(l+$.widthTotal)+"px");
			}
		})
		
	}
		
});
