var top_menu_item_text = new Array()
var top_menu_item_link = new Array()
var sub_menu_item = new Array()

top_menu_item_text[0] = "Home"
top_menu_item_link[0] = "http://www.nationalreview.com/"

top_menu_item_text[1] = "Blog Row"
top_menu_item_text[2] = "NRO Radio & TV"
top_menu_item_text[3] = "Hot Topics"

top_menu_item_text[4] = "Tweet Tracker"
top_menu_item_link[4] = "http://tweet.nationalreview.com/"


top_menu_item_text[5] = "Subscribe"
top_menu_item_text[6] = "Search"
top_menu_item_text[7] = "NR / Digital"

top_menu_item_text[8] = "Shop!"

top_menu_item_text[9] = "Donate"
top_menu_item_link[9] = "https://store.nationalreview.com/donate/"

top_menu_item_text[10] = "Media Kit"
top_menu_item_link[10] = "http://www.nationalreview.com/mediakit/"

top_menu_item_text[11] = "Contact"
top_menu_item_link[11] = "http://www.nationalreview.com/contact/"



sub_menu_item[1] = 	new Array(
                                new Array("Agenda", "http://agenda.nationalreview.com/"),
				new Array("Bench", "http://bench.nationalreview.com/"),
				new Array("Campaign Spot", "http://campaignspot.nationalreview.com/"),
				new Array("Corner", "http://corner.nationalreview.com/"),
                                new Array("Brookhiser", "http://brookhiser.nationalreview.com/"),
				new Array("Kudlow", "http://kudlow.nationalreview.com/"),
				new Array("Lib Fascism", "http://liberalfascism.nationalreview.com/"),
				new Array("Media Blog", "http://media.nationalreview.com/"),
				new Array("Phi Beta Cons", "http://phibetacons.nationalreview.com/"),
				new Array("Planet Gore", "http://planetgore.nationalreview.com/"),
				new Array("Pryce-Jones", "http://pryce-jones.nationalreview.com/")
				
			)

sub_menu_item[2] = 	new Array(
				new Array("Betsy Hart", "http://radio.nationalreview.com/betsyhart/"),
				new Array("Between the Covers", "http://radio.nationalreview.com/betweenthecovers/"),
				new Array("John Derbyshire", "http://www.nationalreview.com/derbradio/"),
				new Array("Uncommon Knowledge", "http://tv.nationalreview.com/uncommonknowledge/"),
				new Array("Off the Page", "http://tv.nationalreview.com/offthepage/")
			)




sub_menu_item[3] =      new Array(
                                new Array("Health Care", "http://www.nationalreview.com/topics/healthcare/")
                        )







sub_menu_item[5] = 	new Array(
				new Array("Subscribe to <i>National Review</i>", "https://www.nationalreview.com/subscribe/nr.p"),
				new Array("Subscribe to <i>National Review Digital</i>", "https://www.nationalreview.com/subscribe/nrd.p"),
                                                                                     new Array("Pay Online", "https://www.kable.com/pub/ntrv/payment.asp"), 
				new Array("Renew your Subscription", "https://www.kable.com/pub/ntrv/renew.asp?theStyle=COABETA"),
				new Array("Give the Gift of NR", "https://www.nationalreview.com/subscribe/gift.p"),
				new Array("Subscription Help", "https://www.nationalreview.com/contact/")
			)

sub_menu_item[6] = 	new Array(
				new Array("National Review Online", "http://search.nationalreview.com/"),
				new Array("NRO Authors", "http://author.nationalreview.com/"),
				new Array("Syndicated Columnists", "http://syndicated.nationalreview.com/"),
				//new Array("NR Magazine (pre-2003)", "http://store.nationalreview.com/archives/"),
				new Array("NR Magazine (post-2003)", "http://search.nationalreview.com/?s=NQ==")
			)

sub_menu_item[7] = 	new Array(
				new Array("NR / Digital Home", "http://nrd.nationalreview.com/"),
				new Array("NR / Digital Login", "http://nrd.nationalreview.com/login/"),
				new Array("Search", "http://search.nationalreview.com/?s=NQ==")
			)

sub_menu_item[8] = 	new Array(
				new Array("NRO Store Home", "http://store.nationalreview.com/"),
				new Array("Accessories", "http://store.nationalreview.com/?ic=Mw=="),
				new Array("Books", "http://store.nationalreview.com/?ic=Mg=="),
				new Array("Clothing", "http://store.nationalreview.com/?ic=MQ=="),
				new Array("Specials", "http://store.nationalreview.com/?ic=NQ=="),
				new Array("Stationery", "http://store.nationalreview.com/?ic=Ng=="),
				new Array("Buy Jay Nordlinger's Book!", "http://store.nationalreview.com/?i=Zjk5ZGU3NmE5MGZhZGE2NmNkZWY1NWYyN2QxMTQ2OGY=")
			)


function show_menu(menu_number)
{
	var topHTML = ""
	var subHTML = ""
	var allHTML = ""

	allHTML  = top_menu(menu_number)
	allHTML += sub_menu(menu_number)

	if (!document.getElementById('menu'))
	{
		document.write('<div id="menu" style="margin: 0px; border:0px; padding:0px;">')
		document.write('</div>')
	}

	document.getElementById('menu').innerHTML = allHTML
}

function top_menu(menu_number)
{
	var topHTML = ""
	var style_class = ""
	if (sub_menu_item[menu_number])
	{
		topHTML  = '<table cellpadding=0 cellspacing=0 width=100%><tr><td class="off_fill">'
	} else {
		topHTML  = '<table cellpadding=0 cellspacing=0 width=100%><tr><td class="off_fill_border">'
	}
	topHTML += '<table cellpadding=0 cellspacing=0><tr>'
	for(i=0;i<top_menu_item_text.length;i++)
	{
		if (i == menu_number)
		{
			style_class = "on"
		} else {
			style_class = "off"
		}
		topHTML += '<td class="'+style_class+'">'
		topHTML += '&nbsp;&nbsp;&nbsp;&nbsp;'
		if (top_menu_item_link[i])
		{
			topHTML += '<a href="'+top_menu_item_link[i]+'" class="link_'+style_class+'">'+top_menu_item_text[i]+'</a>'
		} else {
			topHTML += '<a href="javascript:void(0)" onClick="javascript: show_menu('+i+');" class="link_'+style_class+'">'+top_menu_item_text[i]+'</a>'
		}
		topHTML += '&nbsp;&nbsp;&nbsp;&nbsp;'
		topHTML += '</td>'
		topHTML += '<td class="off_divider" width=1> </td>'
	}
	topHTML += '</table>'
	topHTML += '</td></tr></table>'
	return topHTML
}

function sub_menu(menu_number)
{
	var subHTML = ""
	var subber = ""
	if (sub_menu_item[menu_number])
	{
		subHTML  = '<table cellpadding=0 cellspacing=0 width=100%><tr><td class="on_sub">'
		subHTML += '<table cellpadding=0 cellspacing=0><tr>'
		for(i=0;i<sub_menu_item[menu_number].length;i++)
		{
			subHTML += '<td class="on_sub'+subber+'">'
			subHTML += '&nbsp;&nbsp;&nbsp;&nbsp;'
			subHTML += '<a href="'+sub_menu_item[menu_number][i][1]+'" class="link_sub">'+sub_menu_item[menu_number][i][0]+'</a>'
			subHTML += '&nbsp;&nbsp;&nbsp;&nbsp;'
			subHTML += '</td>'
			subHTML += '<td class="sub_divider" width=1> </td>'
		}
		subHTML += '</table>'
		subHTML += '</td></tr></table>'
	}
	return subHTML
}

function replaceAll( str, from, to )
{
	var idx = str.indexOf( from );

	while ( idx > -1 )
	{
        	str = str.replace( from, to )
	        idx = str.indexOf( from )
	}

	return str
}
