// JavaScript Document
//WitPress Navigator Menu

//requires menu.css
//requires inclusion of witPressMenu.js
//above file must have been called in the target document FIRST!!!

//these vars are used to hold the tags that will be written to 
//the document based on wether a table is required or
//an unsorted list

var oTag, cTag, mnuHTMLStart, mnuHTMLEnd; 


//this funciton checks the browser type and constructs
//the appropriate tags for the menu
function generateBrowserTags() {
  //use CSS version	
		mnuHTMLStart = "<div id=list-menu style='width:140px;'><ul>";
		oTag = "<li>";
		cTag = "</li>";
		mnuHTMLEnd = "</ul></div>";
}

//this function takes in TWO arrays to render a titles book table
//of rollover links
function drawMenu(titles, urls) {
	//determine the tags to use based on browser type
	generateBrowserTags();
	
//-------------DYNAMIC CODE START  ---------------	
		
	//this code starts the approriate code for the menu
	document.write(mnuHTMLStart);
	
	//this code now builds the menu
	for(i = 0; i < titles.length; i++) {
		if(titles[i] != null && titles[i] !="") {
			document.write(oTag + "<a href='" + urls[i] + "' style='width:140px;'>"+ titles[i] + "</a>" + cTag)	;
		}
	}

	//Close the code
	document.write(mnuHTMLEnd);
//-------------DYNAMIC CODE END ---------------
}