/* javascript component called 07-AUG-2007 11:18:57 with id apps_scores */ // ensures same ad can't display in two slots of the same size function removeFromAdList(alist, html) { var tmp = new Array(); var j = 0; for (var i = 0; i < alist.length; i++) { if (alist[i] != html) { tmp[j] = alist[i] ; j++ } } return tmp; } // gets a random member of the array for that slot function getAds(pos) { if (eval('window.' + pos)) { var adLength = eval(pos + '.length'); var rndNum = Math.floor(Math.random() * adLength); var html = eval(pos + '[rndNum]'); if (adLength > 0) { if (pos == 'top' || pos == 'bottom') { document.write(html); if (window.bottom) { bottom = removeFromAdList(bottom, html); } else if (window.bottom_left) { bottom_left = removeFromAdList(bottom_left, html); bottom_right = removeFromAdList(bottom_right, html); } } else if (pos == 'bottom_left') { document.write(html); bottom_right = removeFromAdList(bottom_right, html); } else { document.write(html); } } } } function getDoubleAds(pos) { ad_ar = eval('window.' + pos); if (ad_ar && ad_ar.length > 0) { document.write('
'); var rndNum = Math.floor(Math.random() * ad_ar.length); document.write(ad_ar[rndNum]); ad_ar = removeFromAdList(ad_ar, ad_ar[rndNum]); // is there anything left in the array if (ad_ar.length > 0) { rndNum = Math.floor(Math.random() * ad_ar.length); document.write(ad_ar[rndNum]); } document.write('
'); } } // 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 bottom_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('' + '' + '' + '' + '' + '
' ); if (window.bottom) { getAds('bottom'); } else { getAds('bottom_left'); } document.write( '' ); if (window.bottom) { getAds('bottom'); } else { getAds('bottom_right'); } document.write( '
' ); } else { getAds(pos); } } var top = new Array(); top[0] = 'SAT preparation every day!'; var left_square = new Array(); left_square[0] = 'Daily SAT Prep'; var left_wide = new Array(); var left_wide2 = new Array(); left_wide2[0] = 'SAT preparation every day!'; var bottom_left = new Array(); bottom_left[0] = 'Daily SAT Prep'; var bottom_right = new Array(); bottom_right[0] = 'Daily SAT Prep'; var url = window.location.toString(); var left = new Array(); if ((url.indexOf('www.') != -1 && url.indexOf('/student/testing') != -1) || (url.indexOf('apps.') != -1 && url.indexOf('cbsearch') != -1) || url.indexOf('qotd') != -1 || 'top left_wide2 bottom_left bottom_right'.indexOf('wide') != -1) { left = left_wide; } else { left = left_square; }