   var rotateInit = {
       speed:3500,
       speedAnimation: 1500,
       track: 0,
       count:0,
       timer:0,
       curr:null,
       p:0,
       wait:300,
       div: null,
       buttons: null,
       mainTags: null,
       fade:function(){

          $(this.div).fadeIn(this.speedAnimation);
          $(this.curr).fadeOut(this.speedAnimation);
       },
       d:0,
       rotate: function (){
          clearTimeout(this.timer);
          this.track = (this.div != null) ? this.div : this.track;
          this.track++;
          this.curr = this.track - 1;
          if(this.track >= this.buttons.length) {
               this.track = 0;
               this.curr = this.buttons.length - 1;
          }
          if(this.d > 0){
                 this.curr = this.d;
                 this.d = 0;
          }else this.curr = this.curr;
          $(this.mainTags[this.track]).fadeIn(this.speedAnimation);
          $(this.mainTags[this.curr]).fadeOut(this.speedAnimation);
          $(this.buttons[this.track]).fadeIn(this.speedAnimation, $(this.buttons[this.track]).fadeIn(this.speedAnimation));
          $(this.buttons[this.track]).addClass('active');
          $(this.buttons[this.curr]).removeClass('active');
          //this.buttons[this.track].style.backgroundPosition = "0 -15px";
          //this.buttons[this.curr].style.backgroundPosition = "0 0px";

          this.div = null;
            //this.buttons[this.track].getElementsByTagName("a")[0].style.backgroundPosition = "0 -20px";

            this.timer = setTimeout("rotateInit.rotate()", this.speed + this.p);
            this.p = 0;
       },

       slid: function (){
          clearTimeout(this.timer);
          this.track = (this.div != null) ? this.div : this.track;
          this.track++;
          this.curr = this.track - 1;
          if(this.track >= this.buttons.length) {
               this.track = 0;
               this.curr = this.buttons.length - 1;
          }
          if(this.d > 0){
                 this.curr = this.d;
                 this.d = 0;
          }else this.curr = this.curr;
          var oLeft = this.mainTags[this.track].offsetWidth;
           $(this.mainTags[this.track]).show("slide", { direction: "right" }, this.speedAnimation);
          $(this.mainTags[this.curr]).hide("slide", { direction: "left" }, this.speedAnimation);
          this.div = null;

            this.timer = setTimeout("rotateInit.slid()", this.speed + this.p);
            this.p = 0;
       },

      init: function(btn_param, rotate_param, fun){
         this.mainTags = document.getElementById(rotate_param.id).getElementsByTagName(rotate_param.tag);
         this.buttons = document.getElementById(btn_param.id).getElementsByTagName(btn_param.tag);
         this.timer = setTimeout("rotateInit."+fun+"()", this.speed);
         $(this.buttons[0]).addClass('active');
         $("#"+btn_param.id+" "+btn_param.tag).click(function (){
            tracker = parseInt(this.parentNode.getAttribute("id").substring(3)) - 2;
               rotateInit.d = rotateInit.track;
               clearTimeout(rotateInit.timer);
               rotateInit.div = tracker;
               rotateInit.p = rotateInit.wait;
                rotateInit.timer = setTimeout("rotateInit."+fun+"()", this.speed);
               return false;
        });

      }
   };




