$.fn.ContentScroller = function () {

  var scrollerTimer;
  var scrollerCurrentIndex = 0;
  var self = $(this);
  var scrollerItems = self.find(".scrollerItem");
  var visibleItems;
  var startingNumberToShow = 4;
  
  if(scrollerItems.length > startingNumberToShow)
  { 
    self.wrap("<div class=\"contentScrollerClipper\"></div>");
    scrollerCurrentIndex = scrollerItems.length - startingNumberToShow;
    
    var scrollerItemWidth = $(scrollerItems[0]).outerWidth();
    var scrollerItemHeight = $(scrollerItems[0]).outerHeight();
    
    //setup container to hold absolutely positioned items
    self.css({
      "position" : "relative",
      "width" : scrollerItemWidth * scrollerItems.length + "px",
      "height" : scrollerItemHeight + "px",
      "overflow" : "hidden"
    });    
    
    //hide all but the last 4 content items
    scrollerItems.hide();
    scrollerItems.css("float","left");
      
    scrollerItems.each(function(i){
      if(i >= scrollerItems.length-startingNumberToShow)
      {
        $(this).show();
      }
    });
    
    scrollerTimer = window.setInterval(function(){nextItem();},6000);
    //make all absolutely positioned
    
    //make container relative postioned
    
    //timer
      //after timer space all right one width
      //popup new item from 0-1
  }
  
  function nextItem()
  {
    var currentItem = $(scrollerItems[scrollerCurrentIndex]);
    var nextItem = $(scrollerItems[scrollerCurrentIndex-1]);
    var spacer;
    
    //create spacer the same size as nextItem, grow it
    currentItem.before("<div id=\"scrollerSpacer" + scrollerCurrentIndex + "\" style=\"float:left; width: 0px\">&nbsp;</div>");
    spacer = currentItem.prev();
    spacer.animate({
      width : scrollerItemWidth + "px"
      }, 200, "swing", function(){
        
        nextItem.fadeTo(0,0);
        nextItem.css("margin-top","20px");
        $(this).remove();       
        nextItem.show();
        
        nextItem.animate({
          opacity: ["1","linear"],
          marginTop: "0px"
        }, 500, "swing");

    });
    
    scrollerCurrentIndex--;
    
    if(scrollerCurrentIndex == 0)
    {
      scrollerTimer = window.clearInterval(scrollerTimer);
    }
  }
};
