<!--
var menuItems = new Array();

function setupMenu(){
// Note: you cannot use commas or single quotes in your array entries or 
// they will be split and produce errors in the functioning of the script.
//
// Each line is its own item with submenu and links in the format of:
// 'MENUSELECTION','SubHeading1','SubHeading2' etc.

		menuAdd('About Me','Background','../about_me/background.html','Latest News','../about_me/news.html','Likes/Hobbies','../about_me/likes.html','Resume','../about_me/resume.html','Contact Me','../about_me/contact.html');
//		menuAdd('About Me','Background','../about_me/background.html','Latest News','../about_me/news.html','Likes/Hobbies','../about_me/likes.html','Dislikes','../about_me/dislikes.html','Resume','../about_me/resume.html','Contact Me','../about_me/contact.html');
		menuAdd('My Sites','dgibson.net','http://www.dgibson.net','Metal Underground','http://www.metalunderground.com/','EpicGames.org','http://www.epicgames.org/');
		menuAdd('My Work (files)','Portfolio','../comingsoon/','Age of Wonders','../my_work/aow.html','Web Dev. Tools','../my_work/webdev.html');
		menuAdd('Web Development','Articles','../comingsoon/','Studies','../comingsoon/','Software','../comingsoon/','Links','../comingsoon/');
		menuAdd('Gaming','Age of Wonders','../comingsoon/','Unreal Tournament','../comingsoon/');
		menuAdd('Fun & Humor','English-to-|337','../fun_and_humor/english2leet.html');
//		menuAdd('Cool Links','Blues News','http://www.bluesnews.com','Planet Unreal','http://www.planetunreal.com');
//		menuAdd('Likes/Hobbies','Web development','#','Computer games','#','Fitness','#','Volleyball','#','Music (Heavy Metal)','#','Star Wars','#','X-files','#','Sarcasm','#');
//		menuAdd('Dislikes','Pictures of myself','#','Stress','#','Regrets','#','Dogma','#','Hypocrisy','#','Rednecks','#','Country Music','#');
//		menuAdd('Rants','Bally\'s Total Shitness','#','Rollingwood Apts','#');
}


// Construct the menu arrays
function menuAdd(){
	// Set the new menu item equal to the first argument
	menuItems[menuItems.length] = menuAdd.arguments[0];
	// Then loop throught the arguments and append pairs seperated by a ~ to a comma delimited list
	for (var i=1;i<menuAdd.arguments.length;i+=2){
		menuItems[menuItems.length-1] += ','+menuAdd.arguments[i]+'~'+menuAdd.arguments[i+1];
		if (menuAdd.arguments.length <= 2){
			discrete = 'true';
		}
	}
}


// Start outputting the menu html to the page.
function menuOut(){
	// Establish the layers in which the menu will reside.
	if (document.layers){
		document.writeln('<ILAYER NAME="holdme" WIDTH="140" HEIGHT="300" Z-INDEX="7" ID="holdme">');
		document.writeln('<LAYER NAME="leftnav" ID="leftnav" WIDTH=140 HEIGHT=300></LAYER>');
		document.writeln('</ILAYER>');
	}
	else if(document.all || document.getElementById){
		document.write('<DIV ID="leftnav" style="padding:7px">&nbsp;</DIV');
	}

	// Write the menu with the current section already exapanded.
	if (document.getElementById || document.all || document.layers){
		window.onload=setSection;
	}
	else{
		expandMenu(9999);	// Pass 9999 for to display all menus for compatibility
	}
}


// Set the current section to be expanded based on directory
function setSection(){
	var address=window.location.href;
	var address2=address.substring(7, address.length);
	var sections = address2.split('/');

	if(sections[1]=='about_me'){
		expandMenu(0);
	}
	else if(sections[1]=='my_sites'){
		expandMenu(1);
	}
	else if(sections[1]=='my_work'){
		expandMenu(2);
	}
	else if(sections[1]=='web_development'){
		expandMenu(3);
	}
	else if(sections[1]=='games'){
		expandMenu(4);
	}
	else if(sections[1]=='fun_and_humor'){
		expandMenu(5);
	}
	else expandMenu();
}


// Expand a menu branch when clicked or simply pass the url and query string for discrete items
function expandMenu(num){	
	var newMenu = '';

	// Loop through the menuItems arrays and get the branches and sub-links.
	for (var i=0; i<menuItems.length; i++){	
		var branch = menuItems[i].split(','); 	// branch[0] is the parent, branch[1-n] are text~link pairs.

		// If discrete item, write it as a link and pass a query string with it.
		if (num !=9999 && branch[1].indexOf('discrete')!=-1){
			var discreteURL = branch[1].split('~');
			newMenu += '<A HREF="' + discreteURL[1] + '" class="favMenuHead"><IMG SRC="../images/secondary/menubullet.gif" width=5 height=9 ALT="Click to Continue" border=0>';
		}
		// If branch.length>=2, this is an expandable menu item. 
		else if (num != 9999){
			i==num ? newMenu += '<A HREF="#" class="favMenuHead" onClick="expandMenu(null);return false;"><IMG SRC="../images/secondary/menubullet2.gif" width=9 height=9 ALT="Click to Expand" border=0>' : newMenu += '<A HREF="#" class="favMenuHead" onClick="expandMenu(' + i + ');return false;"><IMG SRC="../images/secondary/menubullet.gif" width=5 height=9 ALT="Click to Expand" border=0>';
		}
		newMenu += branch[0] + '</A><BR>';

		// If num is the item clicked (or 9999), show the children.
		if (i == num || num == 9999){
			// Loop through branches after 1 to get text (leaf[0]) and link (leaf[1]) pairs ("leafs")
			for (var j=1; j<branch.length; j++){	
				var leaf = branch[j].split('~');		// leaf is branch[1-n]; leaf[0] is the text, leaf[1] is the link
				if (branch.length>=2){
					newMenu += '&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="' + leaf[1] + '" class="favMenuSub" onClick="return true;">' + leaf[0] + '</A><BR>';
				}
			}
		}
	}
// End of page content


// Write all this info to the layer on the page.
	if(document.layers){
		document.holdme.document.leftnav.document.open();
		document.holdme.document.leftnav.document.write(newMenu);
		document.holdme.document.leftnav.document.close();
	}
	else if(document.all){
		document.all.leftnav.innerHTML = newMenu;
	}
	else if(document.getElementById){
		document.getElementById('leftnav').innerHTML = newMenu;
	}
	else{
		document.write(newMenu);
	}
}


// OnResize, reload the window to reposition dynamic elements
function setResize(){
	if(document.layers){
		setTimeout("window.onresize=rePosition;",500);
	}
}

function rePosition(){
	window.location.reload()
}

if(document.layers){
	window.onload=setResize;
}
// -->
