section of HTML // Banner Object function Banner(objName) { this.obj = objName; this.aNodes = []; this.currentBanner = null; }; // Add Banner Banner.prototype.add = function(BannerType, BannerLocation, BannerLength, H, W, AltText, URL) { this.aNodes[this.aNodes.length] = new Node(this.obj +"_"+ this.aNodes.length, BannerType, BannerLocation, BannerLength, H, W, AltText, URL); }; // Create Banner function Node(Name, BannerType, BannerLocation, BannerLength, H, W, AltText, URL) { this.Name = Name; this.BannerType = BannerType; this.BannerLocation= BannerLocation; this.BannerLength = BannerLength; this.H = H this.W = W; this.AltText = AltText; this.URL = URL; }; // Creates the HTML and places it on webpage Banner.prototype.toString = function() { var str = "" for (var iCtr=0; iCtr < this.aNodes.length; iCtr++){ str = str + '\n'; if (this.aNodes[iCtr].URL != ""){ str = str + ''; } if ( this.aNodes[iCtr].BannerType == "FLASH" ){ str = str + '' str = str + '' str = str + '' str = str + '' str = str + '' str = str + '' str = str + '' }else if ( this.aNodes[iCtr].BannerType == "IMAGE" ){ str = str + ''; } if (this.aNodes[iCtr].hyperlink != ""){ str = str + ''; } str += ''; } return str; }; // Start the Banner Rotator Banner.prototype.start = function() { this.changeBanner(); var thisBannerObj = this.obj; setTimeout(thisBannerObj+".start()", this.aNodes[this.currentBanner].BannerLength * 1000); } // Swap Banners Banner.prototype.changeBanner = function() { if (this.currentBanner == null) this.currentBanner= this.currentBanner=Math.round((this.aNodes.length-1)*Math.random()); var oldBanner=this.currentBanner; do{ this.currentBanner=Math.floor((this.aNodes.length)*Math.random()) } while(this.currentBanner==oldBanner) if (document.getElementById(this.aNodes[oldBanner].Name).className=='m_banner_show') { document.getElementById(this.aNodes[oldBanner].Name).className = "m_banner_hide"; } document.getElementById(this.aNodes[this.currentBanner].Name).className = "m_banner_show"; }