SlideShow = function(div, leftArrow, rightArrow, txt, a, firstImg, width, pics)
    {
    var THIS = this;

    this._div = $(div);
    this._leftArrow = $(leftArrow);
    this._rightArrow = $(rightArrow);
    this._txt = $(txt);
    this._a = $(a);
    this._firstImg = $(firstImg);
    this._width = width;

    this._pictures = pics;

    this._currPic = 1;
    this._interval = 5 * 1000; // 5 seconds
    this._firstTime = true;

    this._newPic = $(document.createElement("img"));
    this._newPic.src = this._pictures[1].src;
    this._newPic.setStyle({position: "absolute", left: this._width + "px"});
    this._div.insertBefore(this._newPic, this._txt);

    for(i = 2, ic = this._pictures.length; i < ic; i++)
        document.createElement("img").src = this._pictures[i].src;

    //this._leftArrow.setStyle({display: 'block'});
    //this._rightArrow.setStyle({display: 'block'});

    this._changePic();

    }

SlideShow.prototype =
	{
    _changePic: function()
        {
        var THIS = this;

        if(this._firstTime == true)
            {
            window.setTimeout(function() {new Effect.Move(THIS._newPic, { x: -THIS._width, y: 0, mode: "relative" }); THIS._txt.update(THIS._pictures[1].title); THIS._a.href = THIS._pictures[1].href;}, THIS._interval);
            this._firstTime = false;
            }
        else
            {
            this._firstImg.src = this._newPic.src;
            this._newPic.setStyle({left: this._width + "px"});

            if(this._pictures.length <= (this._currPic + 1))
                this._currPic = 0;
            else
                this._currPic += 1;

//            this._newPic.src = this._pictures[this._currPic][0];
//            this._newPic.onload = function() {window.setTimeout(function() {new Effect.Move(THIS._newPic, { x: -566, y: 0, mode: 'relative' }); THIS.txt.update(THIS._pictures[THIS._currPic][1]);}, THIS._interval)};

            window.setTimeout(function() {THIS._newPic.src = THIS._pictures[THIS._currPic].src;}, 100);
            this._newPic.src = this._pictures[this._currPic].src;
            window.setTimeout(function() {new Effect.Move(THIS._newPic, { x: -THIS._width, y: 0, mode: "relative" }); THIS._txt.update(THIS._pictures[THIS._currPic].title); THIS._a.href = THIS._pictures[THIS._currPic].href;}, THIS._interval);
            }

        window.setTimeout(function() {THIS._changePic()}, (THIS._interval + THIS._interval));
        }
    }