function PromotedLink(imageURL, linkURL, eventURL) { this.image = new Image(); this.image.src = imageURL; this.linkURL = linkURL; this.eventURL = eventURL; } function LinkCollection(imageID, linkID) { this.list = new Array(); this.index = 0; this.imageID = imageID; this.linkID = linkID; } function LinkCollection_AddLink(imageURL, linkURL, eventURL) { this.list[this.list.length] = new PromotedLink(imageURL, linkURL, eventURL); } function LinkCollection_Rotate() { this.index++; if (this.index == this.list.length) this.index = 0; document.getElementById(this.imageID).src = this.list[this.index].image.src; var link = document.getElementById(this.linkID); link.onclick = "javascript:urchinTracker('" + this.list[this.index].eventURL + "')"; link.href = this.list[this.index].linkURL; setTimeout(function() { onG4Links.Rotate() }, 4000); } function LinkCollection_StartTimer() { setTimeout(function() { onG4Links.Rotate() }, 4000); } LinkCollection.prototype.AddLink = LinkCollection_AddLink; LinkCollection.prototype.Rotate = LinkCollection_Rotate; LinkCollection.prototype.StartTimer = LinkCollection_StartTimer; var onG4Links = new LinkCollection('imgOnG4', 'lnkOnG4'); function loadOnG4Links() { onG4Links.AddLink('http://cache.g4tv.com/images/imageDB/promoteditems/159/15977_link.JPG', 'http://www.g4tv.com/humanwreckingballs/index.aspx', '/events/homeclicks/on_g4/Human_Wrecking_Balls__All_New_Wednesday'); onG4Links.AddLink('http://cache.g4tv.com/images/imageDB/promoteditems/167/16786_link.jpg', 'http://www.g4tv.com/ces', '/events/homeclicks/on_g4/CES__Starts_Thursday'); onG4Links.AddLink('http://cache.g4tv.com/images/imageDB/promoteditems/167/16744_link.jpg', 'http://www.g4tv.com/heroes', '/events/homeclicks/on_g4/Heroes_Marathon__Jan_31'); onG4Links.AddLink('http://cache.g4tv.com/images/imageDB/promoteditems/167/16787_link.jpg', 'http://www.g4tv.com/aee', '/events/homeclicks/on_g4/AEE_09__Jan_25'); onG4Links.StartTimer(); } addLoadEvent(loadOnG4Links);