/*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('/survivor10/')>=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','3299',
'2005_finales','3262','40acma/voting/','3758','40acma/','3752','47grammys/','3755','/amazing_race7/teams/','14071','/destination/','14068','/amazing_race7/insider/','14066','/amazing_race7/polls/','14067','leader/','14069','/amazing_race7/show/','14070','/amazing_race7/','14065','/amazing_race6/','14000','amazing_race5/','14000','amazing_race4/','14000','amazing_race3/','14000','amazing_race2/','14000','amazing_race/','14000','becker/','3218','bigbrother5/','16000','bigbrother4/','16000','bigbrother3/','16000','bigbrother2/','16000','bigbrother/','16000','cold_case','3240','csi/','3220','csi_miami/','3212','csi_ny/','3225','/elvis_by_the_presleys/','3355','elvis/','3354','everybody_loves_raymond','3201','/jag/slideshows/','3252','jag','3251','joan_of_arcadia','3233','judging_amy','3232','king_of_queens','3238','listen_up/','3258','movies_specials/','3350','navy_ncis/','3211','numb3rs/','3259','/specials/2005_commercials/','3261','still_standing/','3210','survivor_application/','18045','survivor9','18092','survivor7','18000','survivor6/','18000','survivor5/','18000','survivor4/','18000','survivor3/','18000','survivor2/','18000','survivor/','18000','two_and_a_half_men','3204','wickedly_perfect/','3260','without_a_trace/','3216','yes_dear','3234','video/','3999','pol_copyright.shtml','3005','pol_privacy.shtml','3006','info_sitemap.shtml','3007','info_faq_applications.shtml','3008','index.php','3009','hdtv_stations.shtml','3009')/*PrimeTime ID*/
/*'/primetime/','3299',*/


/*DayTime ID*/
var dtShows = new Array ('daytime default','3199','voice','3190','video','3105','slide','3106','quickies','3105','viewer_choice','3751','emmys_2005','3750','emmys_2004/','3861','interviews','3104','/yr/show_update/','3181','/yr/','3180','/price/','3910','/gl/updates/daily/','3161','/gl/','3160','/emmys_2002/','3750','/bb/show_update/','3141', '/bb/','3140','/atwt/show_update/','3121','/atwt/community/','3122','/atwt/','3120','newsletter/','3107','chat','3108','downloads','3109','community/fan_panel/','3110')
/*DayTime ID*/

/*LateTime ID*/
var lnShows = new Array ('latenight default','3399','ls_dtv_pop_player','3316','five_big.shtml','3361','ls_topten_extra.shtml','3322','/top_ten/archive/','3323','/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/','3360','/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','lateshow/','3300','latelate/','3360')
/*'top_ten/archive/','3222','/top_ten/ls_topten_extra.shtml','3223',*/
/*LateTime ID*/

/*Survivor_ID*/
var sr = new Array ('survivor default','18100','/survivors/','18101','sv10_photo_gal.php','18102','/fantasy/','18103','/vote/','18104','/sweepstakes/','18105')
/*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;
}}