var P2W_Marketplace_1_Rail_Data = new Array(); function P2W_Marketplace_1_Rail_Lnk(io,lbl){this.IO=io;this.Label=lbl;} function P2W_Marketplace_1_Rail() { this.BaseUrl = "http://print2webcorp.com/mkt/timescommun8/culpeper/"; this.NumberOfItemsToDisplay = 5; this.ItemData = P2W_Marketplace_1_Rail_Data; this.ItemsToDisplay = new Array(); this.GetRandom = P2W_Marketplace_1_Rail_GetRandom; this.RemoveItem = P2W_Marketplace_1_Rail_Lnk_RemoveItem; this.GetHtml = P2W_Marketplace_1_Rail_GetHtml; this.WriteRail = P2W_Marketplace_1_Rail_WriteRail; } function P2W_Marketplace_1_Rail_GetRandom(n){ return Math.round(Math.random()*n); } function P2W_Marketplace_1_Rail_Lnk_RemoveItem(n){ this.ItemData = this.ItemData.slice(0,n).concat(this.ItemData.slice(n + 1)); } function P2W_Marketplace_1_Rail_WriteRail(){ document.write(this.GetHtml()); } function P2W_Marketplace_1_Rail_GetHtml() { for (var i = 0; i < this.NumberOfItemsToDisplay; i++) { if(this.ItemData != null && this.ItemData.length>0) { var ind = this.GetRandom(this.ItemData.length-1); var l = this.ItemData[ind]; this.RemoveItem (ind); if( l != null) this.ItemsToDisplay[this.ItemsToDisplay.length] = l; } } var s= ""; var cat = ""; if (this.ItemsToDisplay.length > 0) { s = "
" + cat + "
"; for(var j = 0; j < this.ItemsToDisplay.length; j++) { s += "

"+this.ItemsToDisplay[j].Label + "

"; } s += "
"; } return s; }