Apalje.Web.ImageSequence = Class.create();
Apalje.Web.ImageSequence.prototype = {

   initialize: function( el, type, timeout, params ) {

      this.element = el;
      params = params || {};

      this.options = {
         fx: type,
         timeout: timeout
      };
      Object.extend( this.options, params );

      var sync = false;

      switch ( type ) {
         case 'scrollLeft':
         case 'scrollRight':
         case 'blindX':
         case 'blindZ':
         case 'cover':
         case 'curtainX':
         case 'fadeZoom':
         case 'growX':
         case 'toss':
            break;
         case 'scrollHorz':
            sync = true;
            break;
         default:
            this.centerImagesHor();
            break;
      }

      if ( sync ) {
         Object.extend( this.options, {
            sync: true
         });
      }

      if ( timeout == 0 && !params.next ) {
         Object.extend( this.options, {
            next: el
         });
      }

   },

   centerImagesHor: function() {

      Object.extend( this.options, {
         before: function() {
            $j(this).css({
               left: '50%',
               marginLeft: -$j(this).width()/2}
               );
         }
      });

   },

   render: function() {
//alert(Object.toJSON(this.options));
      $j( this.element ).cycle( this.options );

   }

}


