/**
* Wait for document 1.
*/
$(document).ready(function () {
  var p = new Pages({className : 'slide-page'});
  
  $('#a-more').click(function(event){
    event.preventDefault();
    p.slideLeft(1);
  });
  $('#a-no-more').click(function(event){
    event.preventDefault();
    p.slideLeft(0);
  });
  
});

/**
*  Pages class
* @param options
*/
Pages = function(options) {
  this.initialize(options);
};


Pages.prototype = {
  /**
  * @var object
  */
  options : {},
  /**
  * @var int
  */
  currentState : 0,
  
  
  /**
  * __constructor
  * @param options
  */
  initialize : function(options) {
    this.options = options;
  },
  
  /**
  * Slide left
  */
  slideLeft : function(index) {
    var  position = (-index * 50) + '%';
    $('.'+this.options.className + ':first').animate({
      marginLeft :position
    }, 800);
  },
  
  /**
  *  Chage state
  * @param currentState
  * @return void
  */
  changeState : function(currentState) {
    this.currentState = currentState > $('.'+this.options.className).length -1  ? 0 : currentState;
  }
};