

slide.restartDelay = 500;
slide.col = []; 

function slide(name, speed, path, tgt) {
    this.name = name; this.speed = speed || 5000;
    this.path = path || ""; this.tgt = tgt;
    this.ctr = 0; this.timer = 0; this.imgs = []; this.actions = [];
    this.index = slide.col.length; slide.col[this.index] = this;
    this.animString = "slide.col[" + this.index + "]";
}

slide.prototype.addImages = function() { 
    var img;
    for (var i=0; arguments[i]; i++) {
        img = new Image();
        img.src = this.path + arguments[i];
        this.imgs[this.imgs.length] = img;
    }
}

slide.prototype.addActions = function() {
    var len = arguments.length; 
    for (var i=0; i < len; i++) 
        this.actions[this.actions.length] = arguments[i]; 
}

slide.prototype.rotate = function() {
    clearTimeout(this.timer); this.timer = null;
    if (this.ctr < this.imgs.length-1) this.ctr++;
    else this.ctr = 0;
    var imgObj = document.images[this.name];    
    if (imgObj) {
        imgObj.src = this.imgs[this.ctr].src;
        this.timer = setTimeout( this.animString + ".rotate()", this.speed);
    }
}

 
slide.start = function() {
    var len = slide.col.length, obj;
    for (var i=0; i<len; i++) {
        obj = slide.col[i];
        if (obj && obj.name ) 
            obj.timer = setTimeout( obj.animString + ".rotate()", obj.speed);
    }
}

