rootMenu = new Element('Biology','content.html','menu','rootMenu','biology',true,true);


// Menu() creates menu object
function Element(linktext,name,type,ref,dir,open,active) {
	this.linktext = linktext;				// the name of the file/menu to appear in the site map
	this.name = name;			// the name of the file to appear in the site map
	this.type = type;
	this.ref  = ref;				// reference to the object being constructed 
	this.dir = dir;				// initial path, built when adding nested objects
	this.path = this.name;
	
	if (type == 'menu')
	{
		if (!open)						// optional value indicating if object is open or closed
			this.open = false;
		else
			this.open = true;
		this.index = 0;					// initial number of items in Contents
		this.Add = Add;					// Add is a Menu method e.g. Menu.Add()
		this.Contents = new Object();	// adds an empty built-in JavaScript Object
	}
	
	this.active = active;
}

// Add() adds menu/file objects to menu objects
function Add(obj) {
	this.Contents[this.index++] = obj;
}

// Show()
function Show(obj) {
	var output;


	var anchor = '<a href="javascript:parent.OpenElement(parent.' + obj.ref + ')"' +
				 ' onMouseover="window.status=\'' + obj.path + '\'; return true"' +
				 ' onMouseout="window.status=\'\'; return true">';
		
	var picture = '<img src="' + obj.type + '.gif" align="absbottom" border="0" width="20" height="21">';

	var output = '<table border=0><tr><td valign=top>' + anchor + picture + '</a></td>' +
				 '<td><table border=0 cellpadding=0 cellspacing=0 ';
	
	if (obj.active)
	{
		output += 'bgcolor=yellow>';
	}
	else
	{
		output += '>';
	}
	
	output += '<tr><td><font face="arial">' + anchor + obj.linktext + '</a></td></tr></table>';
		
	if (obj.open)
		for (var i=0; i<obj.index; i++)
		output += Show(obj.Contents[i]);
		output += '</td></tr></table>';
	return output;
}

// begin create objects
//////////////////////////////////////////////////
// PUT OBJECTS HERE
//////////////////////////////////////////////////
top_0 = new Element("Ch. 8 Photosynthesis",'chapter8/content.html','menu','top_0','biology',false,false);
rootMenu.Add(top_0);
	levelB_1 = new Element("8-1 Energy and Life",'chapter8/section1/content.html','menu','levelB_1','biology',false,false);
	top_0.Add(levelB_1);
	levelB_5 = new Element("8-2 Photosynthesis: An Overview",'chapter8/section2/content.html','menu','levelB_5','biology',false,false);
	top_0.Add(levelB_5);
	levelB_9 = new Element("8-3 The Reactions of Photosynthesis",'chapter8/section3/content.html','menu','levelB_9','biology',false,false);
	top_0.Add(levelB_9);
	levelB_15 = new Element("Design an Experiment: Investigating Photosynthesis",'chapter8/design_experiment.html','menu','levelB_15','biology',false,false);
	top_0.Add(levelB_15);
	levelB_16 = new Element("Ch. 8 Study Guide",'chapter8/study_guide.html','menu','levelB_16','biology',false,false);
	top_0.Add(levelB_16);
	levelB_17 = new Element("Ch. 8 Assessment",'chapter8/assessment/review_content.html','menu','levelB_17','biology',false,false);
	top_0.Add(levelB_17);
					file_2 = new Element("Autotrophs and Heterotrophs","chapter8/section1/content2.html",'file','file_2','biology',false,false);
					levelB_1.Add(file_2)
					file_3 = new Element("Chemical Energy and ATP","chapter8/section1/content3.html",'file','file_3','biology',false,false);
					levelB_1.Add(file_3)
					file_4 = new Element("ATP and Glucose","chapter8/section1/content4.html",'file','file_4','biology',false,false);
					levelB_1.Add(file_4)
					file_30 = new Element("Section Assessment","chapter8/section1/section_assessment.html",'file','file_30','biology',false,false);
					levelB_1.Add(file_30)
					file_6 = new Element("Investigating Photosynthesis","chapter8/section2/content2.html",'file','file_6','biology',false,false);
					levelB_5.Add(file_6)
					file_7 = new Element("The Photosynthesis Equation","chapter8/section2/content3.html",'file','file_7','biology',false,false);
					levelB_5.Add(file_7)
					file_8 = new Element("Light and Pigments","chapter8/section2/content4.html",'file','file_8','biology',false,false);
					levelB_5.Add(file_8)
					file_31 = new Element("Section Assessment","chapter8/section2/section_assessment.html",'file','file_31','biology',false,false);
					levelB_5.Add(file_31)
					file_10 = new Element("Inside a Chloroplast","chapter8/section3/content2.html",'file','file_10','biology',false,false);
					levelB_9.Add(file_10)
					file_11 = new Element("NADPH","chapter8/section3/content3.html",'file','file_11','biology',false,false);
					levelB_9.Add(file_11)
					file_12 = new Element("Light-Dependent Reactions","chapter8/section3/content4.html",'file','file_12','biology',false,false);
					levelB_9.Add(file_12)
					file_13 = new Element("The Calvin Cycle","chapter8/section3/content5.html",'file','file_13','biology',false,false);
					levelB_9.Add(file_13)
					file_14 = new Element("Factors Affecting Photosynthesis","chapter8/section3/content6.html",'file','file_14','biology',false,false);
					levelB_9.Add(file_14)
					file_32 = new Element("Section Assessment","chapter8/section3/section_assessment.html",'file','file_32','biology',false,false);
					levelB_9.Add(file_32)
					file_18 = new Element("Reviewing Content","chapter8/assessment/review_content.html",'file','file_18','biology',false,false);
					levelB_17.Add(file_18)
					file_19 = new Element("Understanding Concepts","chapter8/assessment/understand_concepts.html",'file','file_19','biology',false,false);
					levelB_17.Add(file_19)
					file_20 = new Element("Critical Thinking","chapter8/assessment/critical_thinking.html",'file','file_20','biology',false,false);
					levelB_17.Add(file_20)
					file_21 = new Element("Performance-Based Assessment","chapter8/assessment/performance_based.html",'file','file_21','biology',false,false);
					levelB_17.Add(file_21)
					file_22 = new Element("Standardized Test Prep","chapter8/assessment/standardized_test.html",'file','file_22','biology',false,false);
					levelB_17.Add(file_22)
//////////////////////////////////////////////////
// end create objects

// set files
//javatest.Add(new File('javatest.pdf','unknown'));

// ShowSiteMap()
	//function ShowSiteMap() {
	//	return Show(rootMenu);
	//}
function ShowSiteMap() {
	return Show(rootMenu);
}

// OpenMenu()
function OpenElement(obj) {
	if (obj.type == 'menu')
		obj.open = !obj.open;
	
	inActive(rootMenu);

	obj.active = true;
	window.left_nav.location.href = window.left_nav.location.href;
	window.content.location.href = (obj.path);
}

function inActive(obj)
{
	obj.active = false;
	
	for (var i=0; i<obj.index; i++)
		inActive(obj.Contents[i]);
}
