
// The menus

var headerbar = new Array();
var headbcount = 0;
headerbar[headbcount++] = "</td></tr>\n"; // Extra one so we can get script valid
headerbar[headbcount++] = " <td width=\"20\" bgcolor=\"#ffffff\"><img src=\"/images/blank_gif.gif\" height=\"10\" width=\"20\" border=\"0\" alt=\"\"></td>\n <td width=\"80\" bgcolor=\"#ffffff\"><img src=\"/images/blank_gif.gif\" height=\"10\" width=\"80\" border=\"0\" alt=\"\"></td>\n <td width=\"20\" bgcolor=\"#ffffff\"><img src=\"/images/blank_gif.gif\" height=\"10\" width=\"20\" border=\"0\" alt=\"\"></td>\n <td width=\"80\" bgcolor=\"#ffffff\"><img src=\"/images/blank_gif.gif\" height=\"10\" width=\"80\" border=\"0\" alt=\"\"></td>\n <td width=\"20\" bgcolor=\"#ffffff\"><img src=\"/images/blank_gif.gif\" height=\"10\" width=\"20\" border=\"0\" alt=\"\"></td>\n <td width=\"80\" bgcolor=\"#ffffff\"><img src=\"/images/blank_gif.gif\" height=\"10\" width=\"80\" border=\"0\" alt=\"\"></td>\n <td width=\"20\" bgcolor=\"#ffffff\"><img src=\"/images/blank_gif.gif\" height=\"10\" width=\"20\" border=\"0\" alt=\"\"></td>\n <td width=\"80\" bgcolor=\"#ffffff\"><img src=\"/images/blank_gif.gif\" height=\"10\" width=\"80\" border=\"0\" alt=\"\"></td>\n <td width=\"20\" bgcolor=\"#ffffff\"><img src=\"/images/blank_gif.gif\" height=\"10\" width=\"20\" border=\"0\" alt=\"\"></td>\n <td width=\"80\" bgcolor=\"#ffffff\"><img src=\"/images/blank_gif.gif\" height=\"10\" width=\"80\" border=\"0\" alt=\"\"></td>\n <td width=\"150\" bgcolor=\"#ffffff\" align=\"right\"><img src=\"/images/blank_gif.gif\" height=\"10\" width=\"150\" border=\"0\" alt=\"\"></td>\n ";
headerbar[headbcount++] = "</tr>\n<tr>\n";
headerbar[headbcount++] = "<td bgcolor=\"#e9e8b0\" colspan=\"11\"><img src=\"/images/blank_gif.gif\" width=\"1\" height=\"1\" border=\"0\" alt=\"\"></td>\n";
headerbar[headbcount++] = "</tr>\n<tr>\n";
headerbar[headbcount++] = " <td width=\"20\" bgcolor=\"#ffffdd\"><img src=\"/images/blank_gif.gif\" height=\"10\" width=\"20\" border=\"0\" alt=\"\"></td>\n <td width=\"80\" bgcolor=\"#ffffdd\"><a class=\"smallmenu\" href=\"/programming/\" onMouseOver=\"setLyr(this,'0'); window.status=''; return false;\">Programming</a></td>\n <td width=\"20\" bgcolor=\"#ffffdd\"><img src=\"/images/blank_gif.gif\" height=\"10\" width=\"20\" border=\"0\" alt=\"\"></td>\n <td width=\"80\" bgcolor=\"#ffffdd\"><a class=\"smallmenu\" href=\"/portfolio/\" onMouseOver=\"setLyr(this,'1'); window.status=''; return false;\">Portfolio</a></td>\n <td width=\"20\" bgcolor=\"#ffffdd\"><img src=\"/images/blank_gif.gif\" height=\"10\" width=\"20\" border=\"0\" alt=\"\"></td>\n <td width=\"80\" bgcolor=\"#ffffdd\"><a class=\"smallmenu\" href=\"/projects/\" onMouseOver=\"setLyr(this,'2'); window.status=''; return false;\">Projects</a></td>\n <td width=\"20\" bgcolor=\"#ffffdd\"><img src=\"/images/blank_gif.gif\" height=\"10\" width=\"20\" border=\"0\" alt=\"\"></td>\n <td width=\"80\" bgcolor=\"#ffffdd\"><a class=\"smallmenu\" href=\"/feedback.html\" >Contact</a></td>\n <td width=\"20\" bgcolor=\"#ffffdd\"><img src=\"/images/blank_gif.gif\" height=\"10\" width=\"20\" border=\"0\" alt=\"\"></td>\n <td width=\"80\" bgcolor=\"#ffffdd\"><a href=\"/cgi-bin/search.pl\" class=\"smallmenu\" onMouseOver=\"killMenus();\"></a></td>\n <td width=\"150\" bgcolor=\"#ffffdd\" align=\"right\"><a class=\"smallmenu\" href=\"/index.html\">Home</a>&nbsp;&nbsp;</td>\n ";
headerbar[headbcount++] = "</tr>\n<tr>\n";
headerbar[headbcount++] = "<td bgcolor=\"#e9e8b0\" colspan=\"11\"><img src=\"/images/blank_gif.gif\" width=\"1\" height=\"1\" border=\"0\" alt=\"\"></td>";
headerbar[headbcount++] = "</tr>\n<tr>\n";
headerbar[headbcount++] = "<td bgcolor=\"#ffffff\" colspan=\"11\"><img src=\"/images/blank_gif.gif\" width=\"1\" height=\"1\" border=\"0\" alt=\"\"></td>";
headerbar[headbcount++] = "<tr>\n"; // Extra one so we can get script valid

function makeHeaderMenu(){
	for (var i=0;i<headbcount;i++){
		document.write(headerbar[i]);
	}

document.write('<script type="text/javascript"> var woopra_id = "2502562541"; </scr' + 'ipt>');
document.write('<script src="http://static.woopra.com/js/woopra.js"></scr' + 'ipt>');

}

var menuitem = new Array();				

menuitem[0] = new Array();
menuitem[0][0] = "/programming/perl.html";		menuitem[0][1] = "Perl";
menuitem[0][2] = "/programming/php.html";		menuitem[0][3] = "PHP";
menuitem[0][4] = "/programming/java.html";		menuitem[0][5] = "Java";
menuitem[0][6] = "/programming/javascript.html";	menuitem[0][7] = "Javascript";
menuitem[0][8] = "/games/index.html";			menuitem[0][9] = "Games";

menuitem[1] = new Array();
menuitem[1][0] = "/portfolio/university.html";	menuitem[1][1] = "University";
menuitem[1][2] = "/portfolio/work.html";	menuitem[1][3] = "Work";
menuitem[1][4] = "/portfolio/cv.html";		menuitem[1][5] = "CV";

menuitem[2] = new Array();	
menuitem[2][0] = "/projects/makelive.html";	menuitem[2][1] = "Makelive";
menuitem[2][2] = "/projects/eventsdb.html";	menuitem[2][3] = "EventsDB";
menuitem[2][4] = "/projects/jobtrack.html";	menuitem[2][5] = "JobTrack";
menuitem[2][6] = "/projects/loonies.html";	menuitem[2][7] = "The Loony Bin";

//menuitem[3] = new Array();
//menuitem[3][0] = "/feedback.html";				menuitem[3][1] = "Contact Me";
//menuitem[3][2] = "/pgpkey.html";				menuitem[3][3] = "PGP Public Key";
//menuitem[3][4] = "/xxxxx.html";				menuitem[3][5] = "xxxxx";
//menuitem[3][4] = "xxxxxx";			menuitem[3][5] = "xxxx";

// You don't need to edit anything past this point

var isNS4 = (document.layers) ? true : false;

// Global layer stuff
var layer_tag = "div";
var layer_properties = 'style="position: absolute; background: #cc0000;	color: #ffffff;	font: 16px arial,helvetica;	top: 20px;z-index: 3;visibility: hidden;"';

function findPosX(obj)
{
	var curleft = 0;
	if (document.getElementById || document.all)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (document.layers)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (document.getElementById || document.all)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (document.layers)
		curtop += obj.y;
	return curtop;
}


function getObj(name)
{
 if (document.getElementById)
 {
	   this.obj = document.getElementById(name);
	   this.style = document.getElementById(name).style;
 }
 else if (document.all)
 {
	   this.obj = document.all[name];
	   this.style = document.all[name].style;
 }
 else if (document.layers)
 {
 alert(name);
	   if (document.layers[name])
	   {
	   	this.obj = document.layers[name];
	   	this.style = document.layers[name];
	   }
	   else
	   {
	    this.obj = document.layers.testP.layers[name];
	    this.style = document.layers.testP.layers[name];
	   }
 }
}

function showhide(obj)
{
	var x = new getObj(obj);
	if(x.style.visibility == 'hidden')
	{
		 x.style.visibility = 'visible';
	}
	else
	{
		x.style.visibility = 'hidden';
	}	
}

function invisible(obj)
{
	var x = new getObj(obj);
	x.style.visibility = 'hidden';
}

function is_invisible(obj)
{
	var x = new getObj(obj);
	return (x.style.visibility == 'hidden') ? 1 : 0;
}

function setLyr(obj,lyr)
{
	var newX = findPosX(obj);
	var newY = findPosY(obj);
	if (lyr == 'testP') newY -= 50;
	var x = new getObj(lyr);
	x.style.top = newY + 15;
	x.style.left = newX;

  	for (menu = 0; menu < menuitem.length; menu++)
	{
		invisible(menu);
	}
	showhide(lyr);
}

// build submenu system 
function makeSubmenus()
{
  	for (menu = 0; menu < menuitem.length; menu++)
	{
		// Build the surreounding html
		menuHTML = '<'	+ layer_tag	+ ' id="' + menu + '" ' + layer_properties
			+'>'
			+ '<table class="floatbox" border="0" cellspacing="1" cellpadding="0">'
			+ '<tr><td><table class="floatbody" border="0" cellspacing="1" cellpadding="2">'

		// Add the menu table rows to the inner table
		for (i = 0; i < menuitem[menu].length; i++)
		{
			menuHTML += '<tr><td width="134"><a class="mainmenu" href="' + menuitem[menu][i]
				+ '">' + menuitem[menu][++i] +'</a></td></tr>';
		}

		// Close the layer and print
		menuHTML += '</table></td></tr></table></' + layer_tag + '>'
		document.write(menuHTML);
	}
}

// Show submenu
function showMenu() 
{
	for (i = 0; i < menuitem.length; i++)
	{
		showhide(i);
	}
}

// Hide all submenus at once
function killMenus()
{
	for (i = 0; i < menuitem.length; i++)
	{
		invisible(i);
	}
}

if (isNS4) 
{
	window.captureEvents(Event.MOUSEDOWN)
	window.onmousedown=killMenus
}

makeSubmenus();
