	//arrays for menus and close timeouts
	var menuIdArray = new Array();
	var menuArray = new Array();
	var menuDownArray = new Array();
	var menuCloseTimeout = new Array();
	//document object
	var menuHTML = "";
	//time to wait until close menu (miliseconds)
	var menuTimeout = 250;
	//menu speed 1 = instantanious - no animation
	var menuSpeed = 0.18;
	//menu colours
	var menuBorderColor = "#000000";
	var menuBgColor = "#ffffff";
	var menuBgColorOver = "#ffffff";
	var menuTextColor = "#000000";
	var menuTextColorOver = "#ffffff";
	
	
	//function for creating the html to write the individual menus. This method does not work in Netscape 4. Use ASP/PHP/HTML instead
	function writeMenu(id, x, y, itemArray, hrefArray) {
		menuHTML+= ('<div class="holder" name="menuholder' + id + '" id="menuholder' + id + '" style="position: absolute; left: ' + x + 'px; top: ' + y + 'px;">');
		menuHTML+= ('<div id="menu' + id + '" name="menu' + id + '" style="position: relative; left: 0px; top: 0px;">');
		menuHTML+= ('<table border="0" cellspacing="0" cellpadding="1" bgcolor="' + menuBorderColor + '"><tr><td><table border="0" cellspacing="0" cellpadding="4" width="100%" bgcolor="' + menuBgColor + '">');
		//write the menu items
		for(i=0; i<itemArray.length; i++) {
			menuHTML+= ('<tr><td>');
			menuHTML+= ('<a onmouseover="parentOver(this);" onmouseout="parentOut(this);" style="font-family: Verdana;	font-size: 11px; color: #000033; text-decoration: none; width:100%;" href="' + hrefArray[i] + '">' + itemArray[i] + '</a>');
			menuHTML+= ('</td></tr>');
		}
		menuHTML+= ('</table></td></tr></table></div></div>');
		
		//add the menu to the menuId array
		menuIdArray[id] = id;
	}
	
	//function to actually write the menus using javascript. This method does not work in Netscape 4. Use ASP/PHP/HTML instead
	function initMenus() {
		//get the document object
		d = document;
		//write the HTML to the document
		d.write(menuHTML);
		
		for(id in menuIdArray) {
			//initialize each of the menus individually
			initMenu(id);
		}
	}
	
	function initMenu(id) {
		
		//assign the menu to a uslLayer object
		menu = new uslLayer('menu' + id, 'menuholder' + id);
		//implement the mouseover/out routines
		if (document.layers) {
			menu.layer.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT);
		}
		menu.layer.onmouseover = new Function('menuShowTime("' + id + '");');
		menu.layer.onmouseout = new Function('menuHideTime("' + id + '");');
		//hide the menu
		menu.hide();
		//return the menu uslLayer object
		menuArray[id] = menu;
	}
	
	//functions for showing/hiding the menus
	function menuShow(id, img_name) {
		if (menuArray[id])	{
			//close all other menus
			for(menu in menuDownArray) {
				if (menu != id) menuHide(menu);
			}
			
			
			//show the menu holder
			menuHolder = new uslLayer('menuholder' + id);
			menuHolder.show();
			//show the menu
			menuArray[id].show();
			//cancel the closing timeout if one exists
			menuShowTime(id);
			//if the menu is not already down
			if(menuArray[id].y != 0) {
				//put the menu to the top
				menuArray[id].moveTo(0, -menuArray[id].height, menuSpeed);
				//slide the menu into view
				menuArray[id].glideTo(0, 0, menuSpeed);
			}
			//set the down flag
			menuDownArray[id] = true;
		}
	}
	function menuHide(id) {
		//hide the menu holder
		menuHolder = new uslLayer('menuholder' + id);
		menuHolder.hide();
		//due to problems with opera menu height cannot always be calculated
		//slide the menu away
		if(menuArray[id].height) {
			menuArray[id].glideTo(0, -menuArray[id].height - 5, menuSpeed);
		}
		else {
			menuArray[id].glideTo(0, -300, menuSpeed / 2);
		}
		//remove the down flag
		menuDownArray[id] = false;
		
		
	}
	function menuHideTime(id, img_name) {
		
		//start the timeout to hide the menu
		menuCloseTimeout[id] = setTimeout("menuHide(" + id + ");", menuTimeout);
	}
	function menuShowTime(id) {
		//cancel the timeout to hide the menu
		clearTimeout(menuCloseTimeout[id]);
	}
	
	//functions for showing the row highlights IE5/N6 only
	function parentOver(el, id) {
		//CSS properties not modifyable in Opera
		if(document.getElementById) {
			el.parentNode.style.backgroundColor = menuBgColorOver;
			el.style.color = menuTextColorOver;
		}
	}
	function parentOut(el) {
		//CSS properties not modifyable in Opera
		if(document.getElementById) {
			el.parentNode.style.backgroundColor = menuBgColor;
			el.style.color = menuTextColor;
		}
	}