YAHOO.example.slider = function() {
  var $E = YAHOO.util.Event;
  var $M = YAHOO.util.Motion;
  var x = 1;
  var maxX = 4;

  return {
    init : function() {
      $E.on(['move-right'], 'click', this.move);
      $E.on(['move-left'], 'click', this.move);

//      for(i=0; i < document.getElementById('productSlider').childNodes.length; i++)
//      {
//        if (document.getElementById('productSlider').childNodes[i].nodeName == "LI")
//        {
//          maxX++;
//        }
//      }

      // alert(maxX);
      // maxX = Math.ceil(maxX / 6);
     //  maxX = 4;

    },

    move : function(e) {
      $E.stopEvent(e);
      switch(this.id) {
        case 'move-left':
          if ( x === 1 ) {
            return;
          }

          var attributes = {
            points : {
              by : [665, 0]
            }
          };

          x--;
          break;

        case 'move-right':
          if ( x === maxX ) {
            return;
          }

        var attributes = {
          points : {
            by : [-665, 0]
          }
        };

        x++;
        break;

    };

    var anim = new $M('productSlider', attributes, 0.5, YAHOO.util.Easing.easeOut);
      anim.animate();
    }
  };
}();
