var url = document.URL;

/* vars from accipiter code */
var userver = "http://u.npr.org";
//random = Math.round(Math.random() * 10000000000);
random = Math.round(Math.random() * 8000000000 + 1000000000);
if (!pageNum) var pageNum = Math.round(Math.random() * 100000000);


urlArray = new Array();        

/* contact */
urlArray[0] = new Array("utility.contact", "", "");

/* taking issue */
urlArray[1] = new Array("opinion.commentary", "", "4526956");

/* sports */
urlArray[2] = new Array("diversions.sports", "", "");

/* everywhere */
urlArray[3] = new Array("utility.everywhere", "", "");

/* send email */
urlArray[4] = new Array("utility.emailstory", "", "");

/* worldwide */
urlArray[5] = new Array("utility.everywhere.worldwide", "", "");

/* this i believe */
urlArray[6] = new Array("people___places", "", "4538138");

/* help */
urlArray[7] = new Array("utility.help", "", "");

/* about */
urlArray[8] = new Array("utility.about", "", "");

/* /differneces_opinion and /usopinion  */
urlArray[9] = new Array("opinion", "", "");

/* symphonycast */
urlArray[10] = new Array("music.classical_music", "SYMPHCAST", "");

/* driveway moments archives */
urlArray[11] = new Array("diversions", "", "driveway_moments");

/* music */
urlArray[12] = new Array("music", "", "");

/* Holiday: Memorable Moments 2007 */
urlArray[13] = new Array("HOLIDAYS", "", "");

/* blogs */
urlArray[14] = new Array("BLOGS", "", "");

/* pictureshow */
urlArray[15] = new Array("PHOTOGALLERY.PICTURESHOW", "", "");

/* 404 pg in root directory */
urlArray[16] = new Array("utility.search", "", "");



/* PAGES IN /NEWS -- ARRAY RANGE FROM 20-39 */

/* hurricane, katrina, nola */
urlArray[20] = new Array("news.katrina___recovery", "", "");

/* election 2006 */
urlArray[21] = new Array("news.election_2006", "", "");

/* world cup 2006 */
urlArray[22] = new Array("diversions.world_cup_2006", "", "");

/* veto, alaska oil */
urlArray[23] = new Array("politics___society.politics", "", "");

/* barry bonds */
urlArray[24] = new Array("diversions.sports", "", "");

/* jonbenet, usdiverse, longevity */
urlArray[25] = new Array("news.nation", "", "");

/* climate */
urlArray[26] = new Array("Health___Science", "", "9657621");

/* election 2008 */
urlArray[27] = new Array("POLITICS___SOCIETY.ELECTION_2008", "", "ELECTIONS_2008_DEBATES");

/* inaug09 */
urlArray[28] = new Array("POLITICS___SOCIETY", "", "");



/* PAGES IN /PROGRAMS -- ARRAY RANGE FROM 50-69 */

/* protecting the kids contact form */
urlArray[50] = new Array("utility.contact", "ATC", "");

/* jazz profiles */
urlArray[51] = new Array("music.jazz", "PROFILES", "");

/* hidden kitchens */
urlArray[52] = new Array("DIVERSIONS.FOOD", "", "hidden_kitchens");

/* moments 2005 */
urlArray[53] = new Array("area=people___places", "", "memorable_moments_2005");

/* TOTN */
urlArray[54] = new Array("", "TOTN", "");

/* WWDTM */
urlArray[55] = new Array("diversion.fun___games", "WAITWAIT", "");

/* world of opera */
urlArray[56] = new Array("music.classical_music", "OPERA", "");

/* piano jazz */
urlArray[57] = new Array("music.jazz", "", "");

/* pt - for static page saying pt is going away */
urlArray[58] = new Array("music.classical_music", "PT", "");


/* DEFAULTS */

/* NEWS DEFUALT */
urlArray[40] = new Array("news", "", "");

/* PROGRAMS DEFUALT */
urlArray[70] = new Array("utility.programlist", "", "");

/* DEFAULT */
urlArray[99] = new Array("NO_TOPIC.STATIC_PAGE", "", "");




if (url.indexOf("contact") > -1)
{
	urlIndex = 0;
}
else if (url.indexOf("takingissue") > -1)
{
	urlIndex = 1;
}
else if (url.indexOf("sports") > -1)
{	
	urlIndex = 2;
}
else if (url.indexOf("everywhere") > -1)
{	
	urlIndex = 3;
}
else if (url.indexOf("sendEmail") > -1)
{	
	urlIndex = 4;
}
else if (url.indexOf("worldwide") > -1)
{	
	urlIndex = 5;
}
else if (url.indexOf("thisibelieve") > -1)
{	
	urlIndex = 6;
}
else if (url.indexOf("help") > -1)
{	
	urlIndex = 7;
}
else if (url.indexOf("about") > -1)
{	
	urlIndex = 8;
}
else if (url.indexOf("differences_opinion") > -1 || url.indexOf("usopinion") > -1)
{	
	urlIndex = 9;
}
else if (url.indexOf("symphonycast") > -1)
{	
	urlIndex = 10;
}
else if (url.indexOf("driveway") > -1)
{	
	urlIndex = 11;
}
else if (url.indexOf("music") > -1)
{	
	urlIndex = 12;
}
else if (url.indexOf("moments_2007") > -1)
{
	urlIndex = 13;
}
else if (url.indexOf("blogs") > -1)
{	
	urlIndex = 14;
}
else if (url.indexOf("pictureshow") > -1)
{	
	urlIndex = 15;
}
else if (url.indexOf("") > -1)
{	
	urlIndex = 16;
}


/* NEWS */
else if (url.indexOf("news") > -1)
{
	if (url.indexOf("hurricane") > -1 || url.indexOf("katrina") > -1 || url.indexOf("nola") > -1)
	{
		urlIndex = 20;
	}
	else if (url.indexOf("election2006") > -1)
	{
		urlIndex = 21;	
	}
	else if (url.indexOf("worldcup2006") > -1)
	{
		urlIndex = 22;	
	}
	else if (url.indexOf("veto") > -1 || url.indexOf("alaskaoil") > -1)
	{
		urlIndex = 23;	
	}
	else if (url.indexOf("bonds") > -1)
	{
		urlIndex = 24;	
	}
	else if (url.indexOf("jonbenet") > -1 || url.indexOf("usdiverse") > -1 || url.indexOf("longevity") > -1)
	{
		urlIndex = 25;	
	}
	else if (url.indexOf("climate") > -1)
	{
		urlIndex = 26;	
	}
	else if (url.indexOf("election2008") > -1)
	{
		urlIndex = 27;	
	}	
	else if (url.indexOf("inaug09") > -1)
	{
		urlIndex = 28;	
	}		

	/* NEWS DEFUALT */
	else
	{
		urlIndex = 40;	
	}			
}


/* PROGRAMS */
else if (url.indexOf("programs") > -1)
{
	if (url.indexOf("protectingthekids") > -1)
	{
		urlIndex = 50;
	}
	else if (url.indexOf("jazzprofiles") > -1)
	{
		urlIndex = 51;	
	}
	else if (url.indexOf("hiddenkitchens") > -1)
	{
		urlIndex = 52;	
	}
	else if (url.indexOf("moments_2005") > -1)
	{
		urlIndex = 53;	
	}
	else if (url.indexOf("totn") > -1)
	{
		urlIndex = 54;	
	}
	else if (url.indexOf("waitwait") > -1)
	{
		urlIndex = 55;	
	}
	else if (url.indexOf("worldofopera") > -1)
	{
		urlIndex = 56;	
	}
	else if (url.indexOf("pianojazz") > -1)
	{
		urlIndex = 57;	
	}
	else if (url.indexOf("pt") > -1)
	{
		urlIndex = 58;	
	}	
	

	/* PROGRAMS DEFUALT */
	else
	{
		urlIndex = 70;	
	}	

}


/* GENERIC DEFUALT */
else 
{
	urlIndex = 99;	
}


var target = "/site=NPR/area=" + urlArray[urlIndex][0] + "/program=" + urlArray[urlIndex][1] + "/agg=" + urlArray[urlIndex][2] + "/storyid=";
aloc = "/utype=banner/aamsz=300x250/position=right_main";



//alert(urlArray[urlIndex][0]);
//alert(urlArray[urlIndex][1]);
//alert(urlArray[urlIndex][2]);
//alert(target);
//alert(random);


document.write('<div class="sponsor300">');
document.write('<');
document.write('script language=\"JavaScript\" src="' + userver + '/jserver/random=' + random + target + aloc + '/pageid=' + pageNum + '">');
document.write('<');
document.write('/script>');
document.write('</div>');

