jQuery.fn.scrollingList = function(options) {
	var tid = $(this).attr("id");
	var $this = $(this);
	var defaults = {
		SLheight:"90px",SLwidth:"200px"
		};
	options = $.extend(defaults, options);
	
	$(this).children("li").css({"display":"inline","list-style-type":"none","margin-left":"10px","padding":"0px","float":"left","height":"80px","cursor":"pointer","vertical-align":"middle"});


$(this).wrap("<div id='outerWrapper'><div class='innerWrapper'></div></div>");
	
	
	$(this).parents("#outerWrapper").css({"height":options.SLheight,"width":options.SLwidth,"overflow":"hidden"});		
	
	
	var newWidth = 0;
	$(this).children("li").each(function(){
			//alert($(this).children("img").width());
		newWidth = newWidth+parseInt($(this).children("img").width());
        
        var iH = parseInt($(this).children("img").height());
        
        if(iH<"80"){
            var diff = 80-iH;
            var mTop = diff/2;
            $(this).children("img").css({"margin-top":mTop+"px"});
        }
        
	});
	newWidth = newWidth + 200;
	$(this).parent(".innerWrapper").css("width",newWidth);

	

var myInt = setInterval(scrollMeLeft,2000);


	function scrollMeLeft(){
			var widd =$this.children("li:first").children("img").width(); 
			var nWidd = widd*2;
			$this.children("li:first").animate(
			{"marginLeft":"-"+nWidd+"px",opacity:"hide"},600,function(){
				 $this.children('li:first').appendTo($this).css('marginLeft', 0).fadeIn(300);   
			}
			)
	
	
	//	clearInterval(myInt);
	}


$this.children("li").children("img").hover(function(){
	$(this).parent("li").siblings("li").children("img").fadeTo("fast", 0.50);
	clearInterval(myInt);	
},function(){
	myInt= setInterval(scrollMeLeft,2000);
		$(this).parent("li").siblings("li").children("img").fadeTo("fast", 1);
});


$this.children("li").children("img").click(function(){
	window.location = "/brand_name/"+$(this).attr("alt")+"/";	
});
	
//	function()
	
	
	if(navigator.userAgent.search(/msie/i)== -1) { 
	$("#outerWrapper").css("position","relative")
$("#outerWrapper").prepend("<div style='background-image:url(images/brands_gradleft.png); width:160px; height:90px; position:absolute; z-index:2000;'></div>");

$("#outerWrapper").append("<div style='background-image:url(images/brands_gradright.png); width:160px; height:90px; position:absolute; right:0px; '></div>");

	}
	
	
	
	
//  return this.each(function(){


  //  alert(this);



  //});
};


