function classifieds_box() { // defaults this.links = []; this.numberOfItems = 4; this.site = "daytondailynews"; this.addLink = function(link) { if(typeof(link)!='object') return false; link.link = link.link.replace(/\@\@publicationname\@\@/g, this.site); if(link.sites && typeof(link.sites)!='undefined' && link.sites.length > 0) { if(link.sites.toString().indexOf(this.site) < 0) return false; } if(link.thru && typeof(link.thru)=='string') { var threshold = Number(link.thru.replace(/\//g, "")); if(threshold < this.today()) return false; } if(link.start && typeof(link.start)=='string') { var start = Number(link.start.replace(/\//g, "")); if(start > this.today()) return false; } this.links.push(link); }; this.setSite = function() { var sites = ['daytondailynews', 'springfieldnewssun', 'activedayton', 'journal-news', 'middletownjournal', 'pulsejournal', 'western-star', 'oxfordpress', 'fairfield-echo' ]; for(var i=0;i'); // Randomize links if(typeof(randomize)!='undefined' && randomize) this.randomizeLinks(); // List var numberOfItems = Math.min(this.links.length, this.numberOfItems); var list = document.createElement("ul"); list.className = 'classifiedbox'; for(var i=0;i var container = document.getElementById(div_id); container.className = "classifieds_box_container"; container.appendChild(list); } this.setSite(); // write stylesheet to if(document.getElementById('classifiedbox_bootstrap_css')) return; var css = document.createElement('link'); css.setAttribute("id", "classifiedbox_bootstrap_css"); css.setAttribute("rel", "stylesheet"); css.setAttribute("type", "text/css"); css.setAttribute("media", "all"); css.setAttribute("href", "http://alt.coxnewsweb.com/daytondailynews/classifieds/styles.css"); document.getElementsByTagName("head")[0].appendChild(css); }