Documente Academic
Documente Profesional
Documente Cultură
size // ensures removing ad from the array also removes any ads in the same grouping function removeFromAdList(alist, html) { // parse html for grouping value from the id attribute of the img tag var imgTag = html.substr(html.indexOf("<img")); var groupMatch=""; // if there's an id in this img tag, pull the value into group if (imgTag.indexOf('id=') != -1) { groupMatch = imgTag.substr(imgTag.indexOf('id=')); // groupMatch represents the banner ad grouping defined by the b usiness groupMatch = groupMatch.substr(0,groupMatch.indexOf('"',4)+1); } // define a clean array to temporarily hold all ads that can be used els ewhere on the page var tmp = new Array(); var j = 0; for (var i = 0; i < alist.length; i++) { // if this array index doesn't match the html coming in AND ther e is a non-blank group and that group isn't in this array index if (alist[i] != html && (groupMatch == '' alist[i].indexOf(gr oupMatch) == -1)) { tmp[j] = alist[i] ; j++ } } return tmp; } // gets a random member of the array for that slot function getAds(pos) { var ad_ar = eval('window.' + pos); if (ad_ar && ad_ar.length > 0) { var rndNum = Math.floor(Math.random() * ad_ar.length); var html = ad_ar[rndNum]; document.write(html); //trackAdImpression(html); if (pos == 'top' pos == 'bottom') { if (window.bottom) { bottom = removeFromAdList(bottom, html); } else if (window.bottom_left) { bottom_left = removeFromAdList(bottom_left, html ); bottom_right = removeFromAdList(bottom_right, ht ml); } } else if (pos == 'bottom_left') { bottom_right = removeFromAdList(bottom_right, html); } } } // gets 2 random and different ads from an array and writes them out function getDoubleAds(pos) { var ad_ar = eval('window.' + pos); if (ad_ar && ad_ar.length > 0) { document.write('<div id="ads">'); var rndNum = Math.floor(Math.random() * ad_ar.length); document.write(ad_ar[rndNum]); //trackAdImpression(ad_ar[rndNum]); ad_ar = removeFromAdList(ad_ar, ad_ar[rndNum]);
// is there anything left in the array to write a second ad if (ad_ar.length > 0) { rndNum = Math.floor(Math.random() * ad_ar.length); document.write(ad_ar[rndNum]); //trackAdImpression(ad_ar[rndNum]); } document.write('</div>'); } } // gets a random member of the array (with getAds) and displays within HTML function getAdsHTML(pos) { // prevent from breaking if not called correctly // calling with 'bottom' might mean one bottom array or two arrays for b ottom_left and bottom_right if (pos == 'bottom') { if (!window.bottom && !window.bottom_left) { return } } else { if (!eval('window.' + pos)) { return } } if (pos == 'left') { getAds(pos); } else if (pos == 'bottom') { document.write('' + '<table cellpadding="0" cellspacing="0" border="0">' + '<tr><td><img src="/images/null_1x1.gif" width="16" heig ht="1" border="0" alt=""/></td>' + '<td>' ); if (window.bottom) { getAds('bottom'); } else { getAds('bottom_l eft'); } document.write( '</td>' + '<td><img src="/images/null_1x1.gif" width="4" height="1 " border="0" alt=""/></td>' + '<td>' ); if (window.bottom) { getAds('bottom'); } else { getAds('bottom_r ight'); } document.write( '</td></tr></table>' ); } else { getAds(pos); } } var left = new Array(); left[0] = '<a href="http://apps.collegeboard.com/ut/AffiliateJumpPage.jsp?Affili ateID=1&BannerID=ba_213180&DestURL=http%3A%2F%2Fstore.collegeboard.com%2Fsto%2Fp roductdetail.do%3FItemkey%3D007115R"><img src="/ad/images/G25735_collappessay.gi f" width="182" height="70" alt="College Application Essays" border="0" bannerId= "ba_213180"/></a>'; left[1] = '<a href="http://apps.collegeboard.com/ut/AffiliateJumpPage.jsp?Affili ateID=1&BannerID=ba_215500&DestURL=http%3A%2F%2Fsat.collegeboard.com%2Fregister" ><img src="/ad/images/cb_apply_pg_182x140.gif" width="182" height="140" alt="Reg ister for the SAT" border="0" bannerId="ba_215500"/></a>';