Add in auto load pic for none xml gallery

I need to add in a code to ask the gallery to auto load in the next pic, but how?


// add in the new auto load pic code here
delay = 3;
function slideshow() {
    myInterval = setInterval(pause_slideshow, delay);
    function pause_slideshow() {
        clearInterval(myInterval);
        if (p == (total-1)) {
            p = 0;
        } else {
            **should be adding some thing here, need help!
        }
    }
}
slideshow();
////////////////////////////////////////////////////////////////
image_arr = new Array();
maxImages = 41;
for (var i = 0; i<maxImages; i++) {
    image_arr.push("image"+i);
}

currentHolder = 0;
theDepth = 1000;
gap = 5;
topY = 25;
_global.imageLoaded = false;
_global.selectedImage = 0;

this.createEmptyMovieClip("thumb_mc",theDepth+++10000);
this.createEmptyMovieClip("img0_mc",theDepth+++10000);
this.createEmptyMovieClip("img1_mc",theDepth+++10000);

this.attachMovie("FScrollPaneSymbol","thumb_sp",1000,{_x:440, _y:topY});
this.thumb_sp.setSize(250+gap+5+gap/2,280);
this.thumb_sp.boundingBox_mc._alpha = 0;

this.thumb_sp.setStyleProperty("arrow",FF0000);
this.thumb_sp.setStyleProperty("scrollTrack",0x262626);
this.thumb_sp.setStyleProperty("face",0x222222);

for (var i = 0; i<image_arr.length; i++) {
    this.thumb_mc.createEmptyMovieClip("thumb"+i+"_mc",theDepth++);
    this.thumb_mc.createEmptyMovieClip("thumb"+i+"_tmp_mc",theDepth++);
    this.thumb_mc["thumb"+i+"_mc"]._x = ((i%2)*(128+gap));
    this.thumb_mc["thumb"+i+"_mc"]._y = Math.floor(i/2)*(85+gap);
    this.thumb_mc["thumb"+i+"_mc"].loadMovie("thumbnail/"+image_arr*+"_tn.JPG");

    this.thumb_mc["thumb"+i+"_tmp_mc"].no = i;
    this.thumb_mc["thumb"+i+"_tmp_mc"].onEnterFrame = function() {
        var _mc = this._parent["thumb"+this.no+"_mc"];
        var l = _mc.getBytesLoaded();
        var t = _mc.getBytesTotal();
        if ((l>=t) && (t>1) && (_mc._width>1)) {
            _mc.num = this.no;
            _mc.onPress = function() {
                if ((_global.selectedImage != this.num) && (_global.imageLoaded)) {
                    loadImage(this.num);
                }
            };
            this._parent._parent.thumb_sp.setScrollContent(this._parent);
            this._parent._parent.thumb_sp.refreshPane();
            delete this.onEnterFrame;
            this.removeMovieClip();
        }
    };
}

function loadImage(num) {
    _global.imageLoaded = false;
    this["img"+currentHolder+"_mc"]._x = 15;
    this["img"+currentHolder+"_mc"]._y = 10;
    this.createEmptyMovieClip("img0_tmp_mc",theDepth++);
    this.createEmptyMovieClip("img1_tmp_mc",theDepth++);
    this["img"+currentHolder+"_mc"].loadMovie("pictures/"+image_arr[num]+".JPG");
    this["img"+currentHolder+"_tmp_mc"].onEnterFrame = function() {
        var l = this._parent["img"+currentHolder+"_mc"].getBytesLoaded();
        var t = this._parent["img"+currentHolder+"_mc"].getBytesTotal();
        if ((l>=t) && (t>1) && (this._parent["img"+currentHolder+"_mc"]._width>1)) {
            this._parent["img"+currentHolder+"_mc"]._alpha = 1;
            this._parent["img"+currentHolder+"_mc"]._y = topY;
            _global.imageLoaded = true;
            _global.selectedImage = num;
            delete this.onEnterFrame;
            this.removeMovieClip();
        }
    };
    this["img"+((currentHolder+1)%2)+"_tmp_mc"].onEnterFrame = function() {
        if (_global.imageLoaded) {
            if (this._parent["img"+currentHolder+"_mc"]._alpha<100) {
                this._parent["img"+currentHolder+"_mc"]._alpha += 5;
                this._parent["img"+((currentHolder+1)%2)+"_mc"]._alpha -= 20;
            } else {
                this._parent["img"+currentHolder+"_mc"]._alpha = 100;
                this._parent["img"+((currentHolder+1)%2)+"_mc"]._alpha = 0;
                currentHolder = (currentHolder+1)%2;
                delete this.onEnterFrame;
                this.removeMovieClip();
            }
        }
    };
}

loadImage(_global.selectedImage);