/*edited by AFA**/
var presentUrl = document.location;var urlString = presentUrl.toString();
function findYourself(){
this.ln = urlString.indexOf('/latenight/')>=0?1:0;
this.dt = urlString.indexOf('/daytime/')>=0?1:0;
this.pt = urlString.indexOf('/primetime/')>=0?1:0;
this.sv = urlString.indexOf('/survivor6/')>=0?1:0;
this.sv?this.pt=0:0;
return this;
}
var sect = new findYourself();
var bgColour = '#ffffff';var secNum;
var secS = '', adTile = 1;

/*PrimeTime ID*/
var ptShows = new Array ('primetime default','3000','45grammys/jukebox/','3754','45grammys/poll_results.html','3756','45grammys/','3755','9_11/','227','agency','3208','ar4route.shtml','14034','ar4sofar.shtml','14035','ar4gallery.shtml','14036','amazing_race4/show/','14033','amazing_race4/index.shtml','14019','amazing_race4/polls/index.shtml','14020','amazing_race4/polls/winners_circle/index.shtml','14021','amazing_race4/destinations/','14022','amazing_race4/teams/','14023','amazing_race4/video/','14027','amazing_race4/features/phil.shtml','14028','amazing_race4/features/index.shtml','14029','amazing_race4/leaderboard/index.shtml','14030','amazing_race4/newsletter/','14037','amazing_race4/','14019','amazing_race3/','14000','amazing_race2/','14000','amazing_race/','14000','baby_bob/','3224','becker','3218','bigbrother4/fantasy','3269','bigbrother4/features/','3267','bigbrother4/guests/dana/','3278','bigbrother4/guests/','3268','bigbrother4/polls/','3274','bigbrother4/show/','3266','bigbrother4/video/','3272','bigbrother4/','3265','bigbrother3/','13000','bigbrother2/','13000','bigbrother/','13000','bram_and_alice/','3217','charlie_lawrence/','3217','clip_of_the_week','3267','cupid/dates/','3292','cupid/girls/','3293','cupid/personals/','3297','cupid/polls/','3295','cupid/show/','3291','cupid/suitors/','3294','cupid/video','3289','cupid/vote/','3298','cupid/','3290','csi/','3220','csi_miami/','3212','district','3230','everybody_loves_raymond','3201','fall_preview_2002','3203','funny/','3242','guardian','3214','hack/','3213','jag','3251','judging_amy','3232','king_of_queens','3238','mas_bruce_springsteen.shtml','3765','movies_specials/','3350','my_big_fat_greek_life/','3239','presidio_med/','3211','queens_supreme/','3235','robbery_homicide/','3215','schedule','3202','specials/38_acma/nominees/','3759','specials/38_acma/','3752','specials/44grammys/','3755','specials/bruce/','3765','specials/latin_grammys3/jukebox/','3766','specials/latin_grammys3/','3765','specials/living_dead/','3351','specials/mary_tyler_moore/','3850','specials/tony_awards/','3753','specials/ncaa/','3870','specials/open_house/','3350','specials/profoundly_normal/','3350','specials/the_locket/','3352','specials/u2/','3764','specials/victorias_secret/','3763','star_search3/','3237','star_search2/','3237','star/','3236','still_standing/','3210','survivor_application/','18045','survivor5/','18000','survivor4/','18000','survivor3/','18000','survivor2/','18000','survivor/','18000','touched_by_an_angel','3255','without_a_trace/','3216','yes_dear','3234')/*PrimeTime ID*/
/*DayTime ID*/
var dtShows = new Array ('daytime default','3100','viewersvoice','3190','video','3105','slide','3106','quickies','3105', '/yr/show_update/','3181','/yr/','3180','/price/','3910','/gl/','3160','/emmys_2002/','3750','/bb/show_update/','3141', '/bb/','3140','/atwt/show_update/','3121','/atwt/community/','3122','/atwt/','3120')/*DayTime ID*/
/*LateTime ID*/
var lnShows = new Array ('latenight default','3300','ls_dtv_pop_player','3316','five_big.shtml','3361','/top_ten/contest/','3321','/top_ten/','3320','/survivor3/video/','3316','/slide_shows/','3344','/show_info/ls_show_info_pop_newsletter','3335','/show_info/ls_show_info_get_ticket','3312','/show_info/','3345','/latelate/','3360off','/exclusives/wahoo/','3349','/exclusives/record_collection/popup_areas/','3326','/exclusives/record_collection/','3325','/exclusives/giveaway/','3330','/exclusives/games/dcr/','3348','/exclusives/games/','3347','/exclusives/daves_downloads/','3346','/exclusives/biff_tour/','3371','/dave_tv/','3315')/*LateTime ID*/
/*Survivor_ID*/
var sr = new Array ('survivor default','18022','/survivors/','18023','/amazon/','18024','/polls/solesurvivor/','18038','/polls/opinion/','18029','/polls/whosnext.shtml','18025','/polls/ultimate.shtml','18039','/polls/','18036','/newsletter/','18033','/video/s6video_01.shtml','18032','/video/','18028','/fantasy/','18034','/show/tcvh.shtml','18040','/show/challenges.shtml','18041','s6ff.shtml','18026','/show/','18035')/*Survivor_ID*/

function ranNum(){
var now = new Date();
randomnum = parseInt(now.getTime() + (Math.random()*100));
}

function genAd(size,secid){
var shows = sect.pt?ptShows:sect.dt?dtShows:sect.ln?lnShows:sect.sv?sr:ptShows;
var parseDim = size.split('x');
var adW=parseDim[0];
var adH=parseDim[1];
secNum = 0;

for(i in shows){
if(urlString.indexOf(shows[i])>=0){
secNum = shows[++i];break;
}}
secid!=null?secNum=secid:0;
secNum==0?secNum = shows[1]:0;

if(secNum.indexOf("hse")>=0){
self.onerror = function trapError(){return true;}
var hseSec = shows == ptShows?'ptHseAd':shows == dtShows?'dtHseAd':shows == lnShows?'lnHseAd':'ptHseAd';
houseAd(adW,adH,hseSec);
return;
}

ranNum(); ordnum = randomnum;

var adCall = new Array('<SCRIPT language="JavaScript" SRC="http://ad.doubleclick.net/adj/network.now.com/network;abr=!webtv;sec='+secNum+';dcopt=ist;sz='+size+';tile='+adTile+++';ord='+ordnum+'?"></SCRIPT>');

var hardCode = genAd.arguments.length==2?"\n** HARDCODED **":"";
if(secNum.indexOf("off")>=0){secS += (adCall+hardCode+'\n** OFF **\n\n');return;}
secS += (adCall+hardCode+'\n\n');

document.write(adCall[0]);
}

function richAdLayer(){/*remove this function once calls have been purged*/}

function showSections(){window.open('/Common/ad_inventory.html')}
function setColour(){bgColour = bgColour=='#ffffff'?'#abc9a5':'#ffffff'}

function sections(){
var category = window.prompt('Please specify section: Daytime, Primetime, Latenight, or Survivior.','');
if(category==null){self.close();return}
category=category.toUpperCase();
var useArray = category=='PRIMETIME'?ptShows:category=='DAYTIME'?dtShows:category=='LATENIGHT'?lnShows:category=='SURVIVOR'?sr:0;
if(useArray==0){alert('You did not specify a valid site section.\n\n Primetime section numbers will be displayed by default.');category = 'PRIMETIME';useArray = ptShows;}
var displayText = '<table align="center" width=500 cellpadding=0 cellspacing=0 border=0><tr><td>';
displayText += '<b>'+category +' SECTIONS</b><br><br></td></tr>';
for(x=0,i=0;x<(useArray.length/2);x++){
displayText += '<tr bgcolor="'+bgColour+'"><td>'+useArray[i++]+'</td><td>'+useArray[i++]+'</td></tr>';
setColour();}displayText += '<tr align=right><td colspan=2><hr width="500" noshade><a href="javascript:location.reload();"><img src="/Common/images/ad_inventory_query.gif" width="55" height="58" border="0" alt="New Query" hspace=13></a><a href="javascript:self.print()"><img src="/Common/images/ad_inventory_print.gif" width="61" height="58" border="0" alt="Print" hspace=13></a><a href="javascript:self.close();"><img src="/Common/images/ad_inventory_close.gif" width="60" height="58" border="0" alt="Close" hspace=13></a></td></tr></table>';
document.write(displayText);}

function checkSection(){
if(secNum==null){
alert('No calls to the function "genAd" were found on this page.');
}else{
ranNum(); winTit = randomnum;
var secWin = window.open('',winTit,'width=640,height=250,location=no,menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no');
var AdReport = secWin.document;
var adCnt = adTile==1?1:adTile;
AdReport.write('<form>'+(adCnt-1)+' Ad(s) found on page: <b>'+document.location+'</b><br><textarea cols=75 rows=12 wrap=virtual>');
AdReport.write(secS);
AdReport.write('</textarea></form>');
AdReport.close;
}}