// (c) 2009 profi-studio.ru # kostya makarchev
SliderContent = function(options) { this.init(options); }
$.extend(SliderContent.prototype, {

  init:function(options){
    this.viewport = options.viewport;
    this.content  = options.content;
    this.slider_track = options.slider_track;

    this.scroll_height   = this.content.height() - this.viewport.height();

    this.slider_element = this.slider_track.slider({
        min: 0,
        max: this.scroll_height,
        value: this.scroll_height,
        animate: false,
        orientation: 'vertical',
        slide: (function(e, ui){
          $('#slider_content').css('bottom', - ui.value ); // косяк с вызовом, не объектно
        })
    });

    this.viewport.mousewheel(function(objEvent, intDelta){
      document.slider_content.move(intDelta); // косяк с вызовом, не объектно
      return false;
    });
  
  },

  move: function(delta){
    var bottom = - this.slider_element.slider('option', 'value') - delta * 60;
    if (bottom > 0){ bottom = 0;}
    if (bottom <= -this.scroll_height) { bottom = -this.scroll_height; }
    this.content.css('bottom', bottom  );
    this.slider_element.slider('option', 'value', -bottom );
    return false;
  }
  
});

