JS2.OO.createClass("PartnerScroller");  (function (K,Package) {var self=K; var _super=JS2.OO['super']; 
  K.oo('member', 'visibleWidth',  625);
  K.oo('member', 'totalWidth',  4 * 625);

  K.oo('method', "initialize", function () {
    this.initHTML();
    this.registerEvents();
  });

  K.oo('method', "initHTML", function () {
    this.jq = $('div.partner-scroller');
    this.jqContainer = this.jq.find('.partner-container');
    this.jqLeft = this.jq.find('.scroll-left');
    this.jqRight = this.jq.find('.scroll-right');

    this.jqContainer.width(this.totalWidth);
    this.currentPosition = 0;
    this.disableScroll();
  });

  K.oo('method', "registerEvents", function () {
    var self = this;
    this.jqLeft.click(function () {
      self.scrollLeft();
    });
    this.jqRight.click(function () {
      self.scrollRight();
    });
  });

  K.oo('method', "scrollLeft", function () {
    if (this.currentPosition <= 0) return;
    this.currentPosition -= this.visibleWidth;
    this.jqContainer.animate({ left:  -(this.currentPosition) });
    this.disableScroll();
  });

  K.oo('method', "scrollRight", function () {
    if (this.currentPosition >= this.totalWidth - this.visibleWidth) return;
    this.currentPosition += this.visibleWidth;
    this.jqContainer.animate({ left:  -(this.currentPosition) });
    this.disableScroll();
    
  });

  K.oo('method', "disableScroll", function () {
    // not super efficient
    this.jqLeft.removeClass('disabled');
    this.jqRight.removeClass('disabled');
    if (this.currentPosition <= 0) {
      this.jqLeft.addClass('disabled');
    }
    else if (this.currentPosition >= this.totalWidth - this.visibleWidth) {
      this.jqRight.addClass('disabled');
    }
  });
})(PartnerScroller, null);