function SlideShow(element, $a){ if($(element)){ this.$e($(element),$a||{}); } };
  
SlideShow.prototype.$e=function(el, $a){
  
  this.$i=$a.frequency||40;
  this.$j=$a.pauseLength||4000;
  this.$k=$a.itemsPerContainer||1;
  this.$l=$a.itemWidth||140;
  this.$z=$a.containerWidth||140;
  this.$r=$a.step||0.1;
  this.$u=$a.stopOnMouseOver||true;
  
  this.$f=el;
  this.$g=null;
  this.$h=null;
  this.$m=this.$k*this.$l;
  this._x=0;
  this.$n=0;
  this.$o=false;
  this.$p=1;
  this.$q=false;
  var $b=0;
  
  var me=this;
  for(var i=0; i<this.$f.firstChild.childNodes.length; i++){
    var $c=this.$f.firstChild.childNodes[i];
    if($c.nodeType==1){
      if(this.$u){
        $c.onmouseover=function(){ me.pause(); };
        $c.onmouseout=function(){ me.start(); };
      };
      $b++;
    }
  };
  this.$s=$b*this.$l;
  this.$f.style.width=this.$s+'px';
};

SlideShow.prototype.goBack=function(){
  if(this.$q){this.$o=true;return;};
  if(this.isFirst()){return;};
  this.$p=-1;
  this.$o=false;
  this.$t(true);
};

SlideShow.prototype.goForward=function(){
  if(this.$q){ this.$o=true;return; };
  if(this.$q||this.isLast()){return;};
  this.$p=1;
  this.$o=false;
  this.$t(true);
};

SlideShow.prototype.animate=function($d){
  this.$q=true;
  var x=Math.ceil(this.$n*this.$r);
  this.$n-=x;
  this._x-=x*this.$p;
  this.$f.style.left=this._x+'px';
  if(this.$n<=0){
    if(this.isLast()&&this.onEnd){ this.onEnd(); };
    this.$f.style.left=this._x+'px';
    this.$q=false;
    var me=this;
    this.stop();
    if(!this.$o&&!$d){
      this.$q=true;
      clearInterval(this.$h);
      this.$h=setInterval(function(){me.$t(false);},this.$j);
    }
  }
};
      
SlideShow.prototype.isLast=function(){ return(this._x + this.$s)<= 0; } //return(this.$s+this._x)<=this.$m;};

SlideShow.prototype.isFirst=function(){return this._x===0;};

SlideShow.prototype.$t=function($d){
  this.stop();
  if(this.$o){ return; };
  if (this.isLast()) { this._x = this.$z; }
  //if((this.$p==1)&&this.isLast()){ this.$p=-1; } else if( this.$p==-1&&this.isFirst()){this.$p=1;};
  this.$n=this.$m;
  var me=this;
  this.$g=setInterval(function(){me.animate($d);},this.$i);
};

SlideShow.prototype.stop=function(){
  this.$q=false;
  clearInterval(this.$h);
  clearInterval(this.$g);
};

SlideShow.prototype.pause=function(){this.$o=true;};

SlideShow.prototype.start=function(){
  this.$o=false;
  var me=this;
  clearInterval(this.$h);
  this.$h=setInterval(function(){me.$t(false);}, 3000);
};
