    

function imageTransparencer(container,subcontainerOne,containerTwo,images,showTime,changeTime, startDelay, stopped)
{
    this._image_one = document.getElementById(subcontainerOne);
    this._image_two = document.getElementById(containerTwo);
    
    this._images = images;
    this._show_time = showTime;
    this._change_time = changeTime;
    this._change_time = changeTime;    
    
    this.stopped = stopped;
 //   if (!this.stopped)
   //    this.prototype.startMove();
}

imageTransparencer.prototype._images;
imageTransparencer.prototype._show_time = 1000;
imageTransparencer.prototype._change_time = 1000;
imageTransparencer.prototype._delay = 10;
imageTransparencer.prototype._currentBanner = 1;
imageTransparencer.prototype._previousBanner = 1;
imageTransparencer.prototype._image_one = null;
imageTransparencer.prototype._image_two = null;
imageTransparencer.prototype._opacity = 100;
imageTransparencer.prototype._dir = -1;

imageTransparencer.prototype.stopped = true;
imageTransparencer.prototype._startDelay = 0;

  imageTransparencer.prototype.rotateBanner = function()
  {
     if (++this._currentBanner > this._images.length)
     {
         this._currentBanner = 1;
         this._previousBanner = this._images.length;
     }
     else
     {
         this._previousBanner = this._currentBanner - 1;
     }

     if (this._dir < 0)
     {
         this._image_one.setAttribute('src', this._images[this._currentBanner-1]);
     }
     else
     {
         this._image_two.setAttribute('src', this._images[this._currentBanner-1]);
     }

    if (this._images.length > 1)
    {
           this.setOpacity();
    }

  }

  imageTransparencer.prototype.setOpacity = function()
  {
       if (((this._opacity + this._dir) > 0) && ((this._opacity + this._dir) < 100))
       {
           this._opacity += this._dir;
           this._image_two.style.opacity = this._opacity/100;
           this._image_two.style.filter = 'alpha(opacity=' + this._opacity + ')';
           setTimeout(this.setOpacity.bind(this), this._delay);
       }
       else
       {
           this._dir = - this._dir;
           setTimeout(this.rotateBanner.bind(this), this._show_time);
       }
       return;
  }
  imageTransparencer.prototype.startMove = function()
  {
      setTimeout(this.rotateBanner.bind(this), this._startDelay);
  }  
  

Function.prototype.bind = function( object )
{
  var method = this;
  return function()
  {
    method.apply( object );
  }
}

