User control(.ascx) and java script functions
===

In default.aspx page, there is a user control side_menu.ascx. 
This is part of the code in side_menu.ascx

    <script src="../library/scripts/side_menu.js" type="text/javascript"></script>
    <script src="../library/scripts/side_menu_items.js" type="text/jscript"></script>
    <script src="../library/scripts/side_menu_tpl.js" type="text/jscript"></script>

    <script language="JavaScript" type="text/javascript">
     <!--
     new menu(SIDE_MENU_ITEMS, SIDE_MENU_POS, SIDE_MENU_STYLES);
     // -->
    </script>
The funtion **menu** is defined in side_menu.js. SIDE_MENU_ITEMS is an array containing all the menu items and the path.

       var SIDE_MENU_ITEMS =[
	["Administration", null,
		["Report a Bug", "administration/bugs/report_bug.aspx"], // /TOrders/
		["Bug Tracker", "administration/bugs/bug_tracker.aspx?fmtid=bugs"], // /TOrders/
		["Feature Request", "administration/features/request_feature.aspx"], // /TOrders/
		["Feature Tracker", "administration/features/feature_tracker.aspx"] // /TOrders/
	]

When a menu item is clicked it, it loads the page **/localhost/administration/bugs/whateverpage.aspx.** This works fine. However, when a menu item is clicked the second time the path becomes **/localhost/administration/bugs/administration/bugs/whateverpage.aspx**. THE PATH is getting appended. I just cant figure out where to go and clear the array. When I click on the the menu item, the menu_onnclick() is called and this.item[id] is already populated with the wrong path. Not sure where to clear it.

Here are some of the function in side_menu.js

       function menu (item_struct, pos, styles) {
      	this.item_struct = item_struct;
	this.pos = pos;
	this.styles = styles;
	this.id = menus.length;
	this.items = [];
	this.children = [];
	
	this.add_item = menu_add_item;
	this.hide = menu_hide;
	
	this.onclick = menu_onclick;
	this.onmouseout = menu_onmouseout;
	this.onmouseover = menu_onmouseover;
	this.onmousedown = menu_onmousedown;
	
	var i;
	for (i = 0; i < this.item_struct.length; i++)
		new menu_item(i, this, this);
	for (i = 0; i < this.children.length; i++)
		this.children[i].visibility(true);
	menus[this.id] = this;
    }

      function menu_add_item (item) {
	var id = this.items.length;
	this.items[id] = item;
	return (id);
    }  

    function menu_onclick (id) {
	var item = this.items[id];
	return (item.fields[1] ? true : false);
    }
    
        function menu_item (path, parent, container) {
	this.path = new String (path);
	this.parent = parent;
	this.container = container;
	this.arrpath = this.path.split('_');
	this.depth = this.arrpath.length - 1;
	// get pointer to item's data in the structure
	var struct_path = '', i;
	for (i = 0; i <= this.depth; i++)
		struct_path += '[' + (Number(this.arrpath[i]) + (i ? 2 : 0)) + ']';
	eval('this.fields = this.container.item_struct' + struct_path);
	if (!this.fields) return;
	
	// assign methods	
	this.get_x = mitem_get_x;
	this.get_y = mitem_get_y;
	// these methods may be different for different browsers (i.e. non DOM compatible)
	this.init = mitem_init;
	this.visibility = mitem_visibility;
	this.switch_style = mitem_switch_style;
	
	// register in the collections
	this.id = this.container.add_item(this);
	parent.children[parent.children.length] = this;
	
	// init recursively
	this.init();
	this.children = [];
	var child_count = this.fields.length - 2;
	for (i = 0; i < child_count; i++)
		new menu_item (this.path + '_' + i, this, this.container);
	this.switch_style('onmouseout');
    }

    function mitem_init() {
	document.write (
		'<a id="mi_' + this.container.id + '_'
			+ this.id +'" class="m' + this.container.id + 'l' + this.depth 
			+'o" href="' + this.fields[1] + '" style="position: absolute; top: '
			+ this.get_y() + 'px; left: '	+ this.get_x() + 'px; width: '
			+ this.container.pos['width'][this.depth] + 'px; height: '
			+ this.container.pos['height'][this.depth] + 'px; visibility: hidden;'
			+' background: black; color: white; z-index: ' + (this.depth + 10000) + ';" ' // changed this.depth to (this.depth + 10000)
			+ 'onclick="return menus[' + this.container.id + '].onclick('
			+ this.id + ');" onmouseout="menus[' + this.container.id + '].onmouseout('
			+ this.id + ');window.status=\'\';return true;" onmouseover="menus['
			+ this.container.id + '].onmouseover(' + this.id + ');window.status=\''
			+ this.fields[0] + '\';return true;"onmousedown="menus[' + this.container.id
			+ '].onmousedown(' + this.id + ');"><div class="m'  + this.container.id + 'l'
			+ this.depth + 'i">' + this.fields[0] + "</div></a>\n"
		);
	    this.element = document.getElementById('mi_' + this.container.id + '_' + this.id);
	
    }