application.core.extend({
  rowscroll: {  
    RowScroll: function(config) {
	  this.storeConfig({ 
	    ul: 'div.row-scroll ul',
		scrollbarHeight: $.browser.opera ? 17 : 22
	  }, config);
		
	  return this.init();
    }
  }
});

application.core.extend(
  application.rowscroll.RowScroll.prototype, 
  application.base.Base.prototype, 
  {  
  	init: function() {
	  this.ready(function() {
		this.setProp('ul', $(this.retrieveConfigValue('ul')));
	
		this.fix();
	  });
	  
	  return this;	
	},
	
	fix: function() {
	  var self = this;
	  
	  if ($.browser.msie && $.browser.version <= 6) {
		return;  
	  }
	  
	  this.getProp('ul').each(function() {
	    var ul = $(this);
	    var lis = ul.find('li');
	    var parent =  ul.parent();
	    var w = lis.size() * lis.outerWidth(true);

	    ul.css({ width: w });
	 
	    if (w < parent.width()) {
		  parent.height(parent.height() - self.retrieveConfigValue('scrollbarHeight'));
	    }
	  });
	}
  }  
);   