RegionCurrent.Inherits(PortalControl);
function RegionCurrent() {
    this.Inherits(PortalControl);
    this.id = "RegionCurrent";
};

Object.extendprototype(RegionCurrent.prototype, {
    OnLoad : function() {
        this.timerHandle = 0;
        this.timeSpan = 7000;
        this.img = engine.GetElement("RegionImage");
        this.curr = 1;
        this.numImg = this.img.getAttribute("numImages");
        this.timerHandle = window.setTimeout(eventCallback(this, this.NextImage), this.timeSpan);
    },
    NextImage : function() {var n = this.curr;while (n == this.curr) {n = Math.floor(Math.random()*this.numImg)+1;}this.curr = n;this.img.src = "Images/Regions/" + this.img.getAttribute("imgPrefix") + this.curr.toString() + ".jpg";this.timerHandle = window.setTimeout(eventCallback(this, this.NextImage), this.timeSpan);}
});
engine.RegisterControl("RegionCurrent");

