// Version 2 dated 14.11.03 by PS

var page = document.location.href;

// each element of array made up of:
// [Name,Link,External Link?,Sub menu?]

var Menu 	= new Array();


Menu[0] 	= 
["Extreme Earth Home","../_home/index.shtml",0,0];

Menu[1] 	= 
["Extreme Earth Timeline","../timeline/index.shtml",0,0];

Menu[2] 	= 
["Asian Earthquake Disaster","",0,1,
	["Asian Earthquake Disaster","../tsunami/feature1.shtml",0,0],
	["Condolences from Discovery","../tsunami/feature2.shtml",0,0],
	["Interactive Map","../tsunami/feature3.shtml",0,0]	
];





Menu[3] 	= 


["Earth","",0,1,
	["Earthquakes","../earth/feature1.shtml",0,0],
	["Drought","../earth/feature2.shtml",0,0],
	["Volcanoes","../earth/feature3.shtml",0,0],
	["Avalanches","../earth/feature4.shtml",0,0]
	];


Menu[4] 	= 
["Air","",0,1,
	["Tornadoes","../air/feature1.shtml",0,0],
	["Hurricanes","../air/feature2.shtml",0,0],
	["Meteorite Impacts","../air/feature3.shtml",0,0]
	];

Menu[5] 	= 
["Fire","",0,1,
	["Bush fires","../fire/feature1.shtml",0,0],
	["Lava","../fire/feature2.shtml",0,0],
	["Rainforest Fires","../fire/feature3.shtml",0,0]
];

Menu[6] 	= 
["Water","",0,1,
	["Flooding","../water/feature1.shtml",0,0],
	["Whirlpools","../water/feature2.shtml",0,0],
	["Icebergs","../water/feature3.shtml",0,0],
	["Tsunamis","../water/feature4.shtml",0,0]
];

/*Menu[7] 	= 
["Volcanoes","",0,1,
	["About Volcanoes","../volcanoes/feature1.shtml",0,0],
	
	
	["Mount St. Helens","../sthelens/feature1.shtml",0,1,
	    ["Forecast for Disaster","../sthelens/feature2.shtml",0,0],
		["Past Eruptions","../sthelens/feature3.shtml",0,0],
		["Current Situation","../sthelens/feature4.shtml",0,0],
		["Scientific Predictions ","../sthelens/feature5.shtml",0,0],
		["Preparations","../sthelens/feature6.shtml",0,0]
  ]
];*/

Menu[7] 	= 
["Mount St. Helens","",0,1,
	["Introduction","../sthelens/feature1.shtml",0,0],
	["Forecast for Disaster","../sthelens/feature2.shtml",0,0],
	["Past Eruptions","../sthelens/feature3.shtml",0,0],
	["Current Situation","../sthelens/feature4.shtml",0,0],
	["Scientific Predictions ","../sthelens/feature5.shtml",0,0],
	["Preparations","../sthelens/feature6.shtml",0,0]
];

Menu[8] 	= 
["Year Without Summer","",0,1,
	["Introduction","../summer/feature1.shtml",0,0],
	["Mount Tambora Pre-Eruption","../summer/feature2.shtml",0,0],
	["The Blast","../summer/feature3.shtml",0,0],
	["Indonesia's Devastation","../summer/feature4.shtml",0,0],
	["The Unseen Link","../summer/feature5.shtml",0,0],
	["Facts","../summer/feature6.shtml",0,0]
];

Menu[9] 	= 
["Extreme Atmosphere","../atmosphere/feature1.shtml",0,0];

Menu[10] 	= 
["Understanding Extreme Earth","../understanding/feature1.shtml",0,0];

Menu[11] 	= 
["Famous Earth","../famous/feature1.shtml",0,0];

Menu[12] 	= 
["Extreme Earth in the Movies","../movies/feature1.shtml",0,0];

Menu[13] 	= 
["Play: Extreme Earth","../weather/feature1.shtml",0,0];

//move this up


//Menu[10] 	= 
//["Interactive","../game/feature1.shtml",0,0];

// -------------------------------------------------------------------------

// do not edit below this line!!
// Last Update 27/11/03


// variables for highlighting section/subsection

var showSection = false;

var showSubSection = false;

var output = output2 = output3 = "";

var breadcrumbs = "";
var sectionLink = "";


var next_link = "";
var next_text = "";

for (i=0; i<Menu.length;i++)

{

	showSection = comparePage(Menu[i][1],page) ? true : false;

	output3="";

	if (Menu[i][3]==1 && Menu[i][4]!="undefined") // sub nav

	{

		

		for (j=4; j<Menu[i].length;j++)

		{

			breadcrumbsSec=" > <a href=\"" + Menu[i][j][1] + "\">" + Menu[i][j][0] + "</a>" + breadcrumbs;

		

			showSubSection = comparePage(Menu[i][j][1],page) ? true : false;



			output2="";

			for (k=4; k<Menu[i][j].length;k++)
			{

				if (comparePage(Menu[i][j][k][1],page))
				{

					output2 += showTable(Menu[i][j][k][0],Menu[i][j][k][1],showSection,20,true,"",Menu[i][j][k][2]);
				if (k+1 <Menu[i][j].length)
				next_link = Menu[i][j][k+1][1];
				else if (k!=4)
				next_link = Menu[i][j][4][1];
				next_text = "Sub Article";

					showSubSection=showSection=true;

					breadcrumbs+=breadcrumbsSec;

					breadcrumbs+=" > <a href=\"" + Menu[i][j][k][1] + "\" >" + Menu[i][j][k][0] + "</a> ";

				}

			}

			

			if (comparePage(Menu[i][j][1],page))

			{

				showSection=true;
				if (j+1 <Menu[i].length)
				{
					next_link = Menu[i][j+1][1];
					next_text = Menu[i][j+1][0];
				}
				else if (j!=4)
				{
					next_link = Menu[i][4][1];
					next_text = Menu[i][4][0];
				}



				breadcrumbs=breadcrumbsSec + breadcrumbs;
			}

			output3 += showTable(Menu[i][j][0],Menu[i][j][1],showSection,15,comparePage(Menu[i][j][1],page) ? true: false,"",Menu[i][j][2]) + output2;

			output3 = output3.replace("replace"," bgcolor='#ffffff'");
			if (showSection && next_text=="")
			{
				if (i+1 < Menu.length)
				next_link = Menu[i+1][1];
				else
				next_link = Menu[0][1];
				next_text = "Feature";
			}

		}

		if (!showSubSection && !showSection)
		output3="";
		else 
		{
			var featureLink=Menu[i][1];
			
			if (Menu[i][1]=="undefined" || Menu[i][1]=="")
			featureLink=Menu[i][4][1];

			breadcrumbs="<span class=\"breadcrumb\"><a href=\"" + featureLink + "\" >" + Menu[i][0] + "</a> " + breadcrumbs; 
		}
				

	}

	if (Menu[i][1]=="")
	sectionLink = Menu[i][4][1];
	else 
	sectionLink = Menu[i][1];

	output += showTable(Menu[i][0],sectionLink,showSection,10,comparePage(Menu[i][1],page) ? true : false,showSubSection || showSection ? "" : "bgcolor='#fffff'",Menu[i][2]) + output3;

}

breadcrumbs = "<span class=\"breadcrumb\"><a href=\"" + Menu[0][1] + "\">Extreme Earth</a> > </span>" + breadcrumbs +"</span>";
output = "<table><tr><td height=\"30\"><img src=\"../_includes/sitewide_images/blank.gif\" width=\"1\" height=\"1\" alt=\"\" border=\"0\"/></td></tr></table>" + output.replace ("replace"," ");









function comparePage (check,current)
{

	var returnValue = false;

	check = check.replace ("\.\.\/","");

	if (current.match(check)) returnValue=true;

	if (check==current) returnValue=true;

	if (check=="") returnValue=false;

	return returnValue;
}

//this is fine
function showNext()
{
	if (next_link!="")
	return "<a href=\"" + next_link + "\" class=\"next\"><b>" + next_text + "</b> <img src=\"../_includes/sitewide_images/arrow_next.gif\" width=\"7\" height=\"6\" alt=\"\" border=\"0\"/></a>";
	else
	return "";
}


function showTable(name,link,show,pixels,highlight,bgcolor2,target)

{

	bgcolor = show ? "bgcolor='ffffff'" : "replace";

	nav 	= highlight ? "NavSelect" : "NavGeneral";

	target 	= target==1 ? "target=_new" : "";

	isOn 	= highlight ? "_on" : "";



	return  "<table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" width=\"100%\" " + bgcolor + "><tr>" +

	"<td width=\"10\"><img src=\"../_includes/sitewide_images/blank.gif\" width=\"" + pixels + "\" height=\"1\" alt=\"\" border=\"0\"/></td>" + 

	"<td width=\"166\" height=\"20\" valign=\"middle\"><a href=\"" + link + "\" " + target + " class=\"" + nav + "\"><b>" + name + "</b></a></td>" +

	"<td width=14><a href=\"" + link + "\" " + target + " class=\"" + nav + "\"><img src=\"../_includes/sitewide_images/arrow_nav" + isOn + ".gif\" width=\"7\" height=\"6\" alt=\"\" border=\"0\"/></a>" + 

	"<img src=\"../_includes/sitewide_images/blank.gif\" width=\"5\" height=\"1\" alt=\"\" border=\"0\"/></td>" + 

	"</tr></table>" + 

	"<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\"  " + bgcolor2 + ">" + 

	"<tr><td height=\"1\" " + bgcolor2 + "><img src=\"../_includes/sitewide_images/blank.gif\" width=\"1\" height=\"1\" alt=\"\" border=\"0\"/></td>" + 

	"</tr></table>";

}

next = showNext();
