




var menuBasePath = "/resources";
var menuDepthID = 1;
var menuPIDs = new Array();
var menuInited = 0;
var menuPendingEvent;
var menuPendingEventID;
var menuVisible = new Array();
var menuHysterisis = 200;
var menuIsIE = (navigator.appName == "Microsoft Internet Explorer");
var menuIsOpera = (navigator.appName == "Opera");
var menuTrimConst = (menuIsIE) ? 2 : 0;

/*	Find the offset of a given menu ID in the data array */
function menu_find_idx(id)
{
	for (idx = 0; idx < menuData.length; idx++) {
		if (menuData[idx][0] == id)
			return idx;
	}
	return false;
}
function array_contains(arr, key)
{
	for (acidx = 0; acidx < arr.length; acidx++) {
		if (arr[acidx] == key)
			return true;
	}
	return false;
}

/**
 *	Menu -> HTML generation functions
 */
function menu_write()
{
	var style, lastPID, lastDepth;

	/* Build parent ID list */
	menuPIDs = new Array();
	lastPID = -1;
	lastDepth = 0;
	for (n = 0; n < menuData.length; n++) {
		if (menuData[n][3] != lastPID) {
			/* Check if parent ID already in list */
			foundPID = false;
			for (ap = 0; ap < menuPIDs.length; ap++) {
				if (menuPIDs[ap] == menuData[n][3])
					foundPID = true;
			}
			if (!foundPID && menuData[n][3] != 0)
				menuPIDs[menuPIDs.length] = menuData[n][3];
			lastPID = menuData[n][3];

			parentIdx = menu_find_idx(lastPID);
			if (parentIdx) {
				lastDepth = menuData[parentIdx][6] + 1;
				menuData[parentIdx][5]++;
			}
		}
		menuData[n][6] = lastDepth;
	}

	/* Generate each block of data */
	//html = '<div class="topnavBar" id="topnav0">\n' + menu_write_group(0) + '</div>\n';
	html = '';
	for (pidx = 0; pidx < menuPIDs.length; pidx++) {
		pid = menuPIDs[pidx];
		style = "display: none; position: absolute; left: 20px; top: 20px; " + (menuIsIE ? " width: 1%;" : "");
		html += '<div class="topnavDrop" style="'+style+'" id="topnav'+pid+'"'+
			'+'+' onmouseover="menu_g_m_on('+pid+')" onmouseout="menu_g_m_out('+pid+')">\n' +
			menu_write_group(pid) + '</div>\n';
	}
	//ht_pre = '<pre>'+html.replace(/</g, "&lt;").replace(/>/g, "&gt;")+'</pre>';
	document.write(html);
}
function menu_write_group(pID)
{
	var lastID, startPos, cols, id, n, xdata, linkDest;

	lastID = 0;
	startPos = 0;
	cols = new Array();

	cols[0] = '';
	for (n = 0; n < menuData.length; n++) {
		if (menuData[n][3] == pID) {
			/* Split into next column if the IDs are non-sequential */
			if (lastID + 1 != menuData[n][0] && lastID != 0 && menuData[n][3] > 0)
				cols[cols.length] = '';
			lastID = menuData[n][0];

			id = menuData[n][0];
			xdata = (typeof(menuData[n][4]) == "object") ?
				'<img src="'+menuData[n][4][0]+'" width="'+menuData[n][4][1]+'" height="'+
				menuData[n][4][2]+'" border="0" align="top" id="topnavImg'+id+'">'
				: '';
			linkDest = (menuData[n][2].length > 0) ? menuData[n][2] : '#';
			cols[cols.length-1] += '\t<div>' +
				'<a id="topnavItem'+id+'" href="' + linkDest + '"' +
				(menuData[n][5] > 0 ? ' class="topnavArrow"' : '') +
				' onmouseover="menu_i_m_on('+id+')" onmouseout="menu_i_m_out('+id+')">' +
				'<span>' + menuData[n][1] + xdata + '</span></a></div>\n';
		}
	}
	if (cols.length > 1)
		return '<table><tr><td class="c1">' + cols.join('</td><td>') + '</td></tr></table>';
	else
		return cols[0];
}
function menu_init_stats()
{
	menuInited = 1;
}

/**
 *	Visibility control functions
 */

function menu_show(id)
{
	var mh_ix, r_ix, oGroup, oItem, oPGroup;

	if (menuInited == 0)
		menu_init_stats();

	/* Ensure parent nodes are shown */
	mh_ix = menu_find_idx(id);
	if (menuData[mh_ix][3] != 0)
		menu_show(menuData[mh_ix][3]);

	if (array_contains(menuVisible, id) || id == 0)
		return;

	oBannerWrap = document.getElementById("bannerWrapper");
	oBanner = document.getElementById("banner");
	oGroup = document.getElementById("topnav"+id);
	oItem = document.getElementById("topnavItem"+id);

	if (menuData[mh_ix][3] == 0) {
		/* Making this visible means we should cleanup any already exposed nodes */
		for (r_ix = 0; r_ix < menuVisible.length; r_ix++)
			menu_hide(menuVisible[r_ix]);

		/* This is a 2nd-level menu group */
		oItem.className = "mmSelected";
		iTop = oItem.offsetTop + oItem.offsetHeight;
		if (!menuIsOpera) iTop += oBannerWrap.offsetTop;
		oGroup.style.top = iTop + "px";
		oGroup.style.left = (menuData[mh_ix][7] + oBanner.offsetLeft) + "px";
		oGroup.style.display = "block";
		oGroup.style.width = (id == 2) ? "98px " :
			((oGroup.offsetWidth <= oItem.offsetWidth) ?
			oItem.offsetWidth : oGroup.offsetWidth - menuTrimConst) + "px";

		//Set the width (if required) of the drop down boxes in the Nav
		if (id == 2) oGroup.style.width = "170px";//our firm
		if (id == 5) oGroup.style.width = "155px";//community
		if (id == 4) oGroup.style.width = "122px";//our people
		if (id == 6) oGroup.style.width = "118px";//technology
		if (id == 10) oGroup.style.width = "145px";//careers
		if (id == 300) oGroup.style.width = "170px";//news and pubs

		if (document.getElementById("topnavImg"+id)) {
			r_ix = menu_find_idx(id);
			oImg = document.getElementById("topnavImg"+id);
			oImg.src = menuData[r_ix][4][0].replace(/\./, "_on.");
		}
	}
	else {
		/* This is a 3rd-level or deeper menu group */
		oPGroup = oItem.parentNode.parentNode;
		oGroup.style.display = "block";
		oPGroup.style.display = "block";	// must be block to ensure the oPGroup.offset* props are set
		oGroup.style.top = (oItem.parentNode.offsetTop + oPGroup.offsetTop) + "px";
		oGroup.style.left = (oPGroup.offsetLeft + oPGroup.offsetWidth) + "px";
		//oGroup.style.width = oGroup.offsetWidth - menuTrimConst;

		

		oGroup.style.width = (id == 1010) ? "485px" : "200px";

		oItem.parentNode.className = "mmSelected";
	}

	menuVisible.push(id);
//	document.getElementById("dbg").innerHTML = menuVisible.join(";");
}
function menu_hide(id)
{
	var mh_ix, oGroup, oItem;

	if (!array_contains(menuVisible, id) || id == 0)
		return;

	oGroup = document.getElementById("topnav"+id);
	oItem = document.getElementById("topnavItem"+id);
	menuPendingEventID = 0;

	mh_ix = menu_find_idx(id);
	if (menuData[mh_ix][3] == 0) {
		/* This is a 2nd-level menu group */
		oItem.className = "";
		oGroup.style.display = "none";
		if (document.getElementById("topnavImg"+id)) {
			ix = menu_find_idx(id);
			oImg = document.getElementById("topnavImg"+id);
			oImg.src = menuData[ix][4][0];
		}
	}
	else {
		/* This is a 3rd-level or deeper menu group */
		oGroup.style.display = "none";
		oItem.parentNode.className = "";

		//menuPendingEventID = menuData[mh_ix][3];
		//menuPendingEvent = window.setTimeout("menu_hide("+menuData[mh_ix][3]+")", menuHysterisis);
	}

	/* Pop this menu ID from the visibility list - push it up to the end of the list */
	for (mh_ix = 0; mh_ix < menuVisible.length - 1; mh_ix++) {
		if (menuVisible[mh_ix] == id) {
			menuVisible[mh_ix] = menuVisible[mh_ix+1];
			menuVisible[mh_ix+1] = id;
		}
	}
	menuVisible.pop();
//	document.getElementById("dbg").innerHTML = menuVisible.join(";");

	/* Ensure necessary parent nodes remain shown */
	for (mh_ix = 0; mh_ix < menuVisible.length; mh_ix++)
		menu_show(menuVisible[mh_ix]);
}
function menu_hide_all()
{
	var mh_ix;
	for (mh_ix = 0; mh_ix < menuVisible.length; mh_ix++)
		menu_hide(menuVisible[mh_ix]);
}

/* Item mouse over/out functions */
function menu_i_m_on(id)
{
	var ix, oImg;
	if (document.getElementById("topnav"+id))
		menu_show(id);
	else if (document.getElementById("topnavImg"+id)) {
		r_ix = menu_find_idx(id);
		oImg = document.getElementById("topnavImg"+id);
		if (menuData[r_ix][4][3] == 1)
			oImg.src = menuData[r_ix][4][0].replace(/\./, "_on.");
	}
}
function menu_i_m_out(id)
{
	if (document.getElementById("topnav"+id))
		menu_hide(id);
	else if (document.getElementById("topnavImg"+id)) {
		ix = menu_find_idx(id);
		oImg = document.getElementById("topnavImg"+id);
		if (menuData[r_ix][4][3] == 1)
			oImg.src = menuData[ix][4][0];
	}
}

/* Group mouse over/out functions */
function menu_g_m_on(id)
{
	if (menuPendingEventID == id)
		window.clearTimeout(menuPendingEvent);

	menu_show(id);
}
function menu_g_m_out(id)
{
	menuPendingEventID = id;
	menuPendingEvent = window.setTimeout("menu_hide("+id+")", menuHysterisis);
}


var menuData = [
	// 0=id, 1=title, 2=link_url, 3=parent_id, 4=image_data (src,width,height,is_rollover), 5=child_count, 6=depth, [set on load:] 7=Xcoord

	[2,'Our Firm','/our_firm/',0,0,0,0,0],
	[3,'Expertise','/expertise/',0,0,0,0,77],
	[4,'Our People','/our_people/',0,0,0,0,161],
	[10,'Careers','/careers/',0,0,0,0,253],
	[5,'Community','/community/',0,0,0,0,330],
	[6,'Technology','/online_products/',0,0,0,0,425],
	[300,'News and Pubs','/counsels_compass/',0,0,0,0,520],

//	[999,'','',2,['/resources/shim.gif',1,17,0],0,0],

	[1000,'Firm profile','/our_firm/5501503W.htm',2,0,0,0],
	[1001,'Executive team','/our_firm/9565093W.htm',2,0,0,0],
	[1002,'Shared services','/our_firm/9169208W.htm',2,0,0,0],
	[1003,'Recent advisory roles','/our_firm/9146144w.htm',2,0,0,0],
	[1004,'Reputation','/our_firm/5501514W.htm',2,0,0,0],
	[1005,'Market leadership','/our_firm/9357144w.htm',2,0,0,0],
	[1006,'Our offices','/our_firm/5501519W.htm',2,0,0,0],
	[1007,'History','/our_firm/5501521W.htm',2,0,0,0],
	[1008,'Mallesons Engaging Women','/our_firm/9426187w.htm',2,0,0,0],
	[1009,'Quick links','/expertise/9768502W.htm',3,0,0,0],
	[1010,'Australia','/expertise/7716642W.htm',3,0,0,0],
	[1011,'Asia','/expertise/9470890W.htm',3,0,0,0],
	[1012,'UK','/expertise/london/7539759W.htm',3,0,0,0],
	[1013,'Search','/our_people/ourpeople.htm',4,0,0,0],
	[1014,'Alumni','/careers/alumni/',4,0,0,0],
	[1015,'Our program','/community/5502397W.htm',5,0,0,0],
	[1016,'Pro bono advice','/community/5502317W.htm',5,0,0,0],
	[1017,'Charitable donations','/community/5502399W.htm',5,0,0,0],
	[1018,'Volunteering','/community/5502390W.htm',5,0,0,0],
	[1019,'Community reports','/community/5502402W.htm',5,0,0,0],
	[1020,'Human Rights Law Group','/community/9137706W.htm',5,0,0,0],
	[1021,'Contact us','/community/5502393W.htm',5,0,0,0],
	[1022,'Our technology','/online_products/8592412W.htm',6,0,0,0],
	[1023,'Online services','/online_products/8592419w.htm',6,0,0,0],
	[1024,'Us','/careers/us/',10,0,0,0],
	[1025,'Opportunities','/careers/opportunities/',10,0,0,0],
	[1026,'Clerkships & Graduates','/careers/clerkships_graduates/',10,0,0,0],
	[1027,'Media contact','/news/5502616w-08.htm',300,0,0,0],
	[1028,'News','/news/',300,0,0,0],
	[1029,'Publications','/publications/publications.htm',300,0,0,0],
	[1030,'Caselaw and legislation','/news_publications/8906924w.htm',300,0,0,0],
	[1031,'Seminars','/news/articles/10021055w.htm',300,0,0,0],
	[1032,'Overview','/expertise/7716642W.htm',1010,0,0,0],
	[1033,'Advertising and marketing','/expertise/trade_practices_and_marketing/5501638W.htm',1010,0,0,0],
	[1034,'Anti-money laundering','/expertise/anti-money laundering/7858853W.htm',1010,0,0,0],
	[1035,'Applied legal technology','/expertise/applied_legal_technology/5501527W.htm',1010,0,0,0],
	[1036,'Asset finance','/expertise/asset_finance/5501548W.htm',1010,0,0,0],
	[1037,'Asia funds','/expertise/asia_funds/9984922W.htm',1010,0,0,0],
	[1038,'Aviation','/expertise/aviation/5501551W.htm',1010,0,0,0],
	[1039,'Banking and finance','/expertise/banking_and_finance/5501554W.htm',1010,0,0,0],
	[1040,'Capital markets','/expertise/capital_markets/5501557W.htm',1010,0,0,0],
	[1041,'Climate change and clean energy','/expertise/renewable_energy/7141322W.htm',1010,0,0,0],
	[1042,'Commercial property','/expertise/commercial_property/5501560W.htm',1010,0,0,0],
	[1043,'Competition/antitrust','/expertise/competition/5501565W.htm',1010,0,0,0],
	[1044,'Construction','/expertise/construction/5501567W.htm',1010,0,0,0],
	[1045,'Copyright','/expertise/copyright/8361960W.htm',1010,0,0,0],
	[1046,'Corporate and commercial','/expertise/corporate_and_commercial/9677019W.htm',1010,0,0,0],
	[1047,'Defence','/expertise/defence/7141065W.htm',1010,0,0,0],
	[1048,'Derivatives','/expertise/derivatives/9408041w.htm',1010,0,0,0],
	[1049,'Dispute resolution','/expertise/dispute_resolution/5501573W.htm',1010,0,0,0],
	[1050,'Employment law and industrial relations','/expertise/labour_law/5501612W.htm',1010,0,0,0],
	[1051,'Executive compensation and employee benefits','/expertise/Executive_compensation_employee_benefits/9974840w.htm',1010,0,0,0],
	[1052,'Energy and resources','/expertise/energy_resources_projects/5501580W.htm',1010,0,0,0],
	[1053,'Environment and planning','/expertise/environment/5501583W.htm',1010,0,0,0],
	[1054,'Food','/expertise/food_and_drug_law/5501586W.htm',1010,0,0,0],
	[1055,'Foreign investment','/expertise/foreign_investment/9644560w.htm',1010,0,0,0],
	[1056,'Funds','/expertise/funds_management/5541919W.htm',1010,0,0,0],
	[1057,'Government business','/expertise/government_business/5501589W.htm',1010,0,0,0],
	[1058,'Hybrid securities','/expertise/hybrid_securities/7141103W.htm',1010,0,0,0],
	[1059,'Information technology','/expertise/information_technology/5501593W.htm',1010,0,0,0],
	[1060,'Information technology disputes','/expertise/IT_disputes/9740346w.htm',1010,0,0,0],
	[1062,'Infrastructure','/expertise/infrastructure/5501597W.htm',1010,0,0,0],
	[1063,'Insurance','/expertise/insurance/5501605W.htm',1010,0,0,0],
	[1064,'Intellectual property','/expertise/intellectual_property/5501609W.htm',1010,0,0,0],
	[1065,'International arbitration','/expertise/international_arbitration/7141112W.htm',1010,0,0,0],
	[1066,'International trade','/expertise/international_trade/7804119W.htm',1010,0,0,0],
	[1067,'Islamic finance','/expertise/islamic_finance/9700176W.htm',1010,0,0,0],
	[1068,'Life sciences','/expertise/life_sciences/5501556W.htm',1010,0,0,0],
	[1069,'Market regulation','/expertise/market_regulation/9931118W.htm',1010,0,0,0],
	[1070,'Media and entertainment','/expertise/media/5501614W.htm',1010,0,0,0],
	[1071,'Mergers and acquisitions','/expertise/mergers_and_acquisitions/5501617W.htm',1010,0,0,0],
	[1072,'Occupational health & safety','/expertise/occupational_health_and_safety/9557510w.htm',1010,0,0,0],
	[1073,'Outsourcing','/expertise/outsourcing/9732340W.htm',1010,0,0,0],
	[1074,'Patents','/expertise/patents/5501618W.htm',1010,0,0,0],
	[1075,'Privacy','/expertise/privacy/5501621W.htm',1010,0,0,0],
	[1076,'Private equity','/expertise/private_equity/5501623W.htm',1010,0,0,0],
	[1077,'Privatisation','/expertise/privatisation/5501624W.htm',1010,0,0,0],
	[1078,'Product liability','/expertise/product_liability/5501626W.htm',1010,0,0,0],
	[1079,'Project finance','/expertise/project_finance/5501627W.htm',1010,0,0,0],
	[1080,'Public private partnerships','/expertise/public_private_partnerships/7141207W.htm',1010,0,0,0],
	[1081,'Restructuring and insolvency','/expertise/insolvency_and_reconstruction/5501600W.htm',1010,0,0,0],
	[1082,'Securitisation','/expertise/securitisation/5501628W.htm',1010,0,0,0],
	[1083,'Structured real property finance','/expertise/struc_real_property_finance/7440827W.htm',1010,0,0,0],
	[1084,'Superannuation, life insurance and pensions','/expertise/superannuation_and_pensions/5501629W.htm',1010,0,0,0],
	[1085,'Sustainable enterprises','/expertise/sustainable_enterprises/9526969w.htm',1010,0,0,0],
	[1086,'Taxation','/expertise/taxation/5501631W.htm',1010,0,0,0],
	[1087,'Telecommunications','/expertise/telecommunications/5501632W.htm',1010,0,0,0],
	[1088,'Water','/expertise/water/7141741W.htm',1010,0,0,0],
	[1089,'Trade marks','/expertise/trade_marks/5501636W.htm',1010,0,0,0],
	[1090,'China','/expertise/China/7539608W.htm',1011,0,0,0],
	[1091,'Hong Kong','/expertise/Hong_Kong/7539603W.htm',1011,0,0,0],
	[1092,'Overview','/expertise/london/7539759W.htm',1012,0,0,0],
	[1093,'Initial contacts','/expertise/london/7539759W-01.htm',1012,0,0,0],
	[1094,'Recent matters','/expertise/london/7539759W-02.htm',1012,0,0,0],
	[1095,'Reputation','/expertise/london/7539759W-03.htm',1012,0,0,0],
	[1096,'Publications','/expertise/london/7539759W-04.htm',1012,0,0,0]
/*
	[1510,'','',2,['/resources/navbar/ourfirm_trad.gif',62,18,0],0,0],
	[1511,'','/our_firm/5955168W.htm',2,['/resources/navbar/firmpro_trad.gif',61,15,0],0,0],
	[1512,'','/our_firm/5955151W.htm',2,['/resources/navbar/reputation_trad.gif',27,15,0],0,0],
	[1513,'','/our_firm/5980261W.htm',2,['/resources/navbar/comm_trad.gif',27,15,0],0,0],
	[1514,'','/our_firm/5955153W.htm',2,['/resources/navbar/tech_trad.gif',75,15,0],0,0],
	[1515,'','/our_firm/5955162W.htm',2,['/resources/navbar/offices_trad.gif',75,15,0],0,0],
	[1516,'','/our_firm/5955161W.htm',2,['/resources/navbar/history_trad.gif',26,15,0],0,0],
	[1520,'','',2,['/resources/navbar/ourfirm_sim.gif',54,18,0],0,0],
	[1521,'','/our_firm/5955071W.htm',2,['/resources/navbar/firmpro_sim.gif',61,15,0],0,0],
	[1522,'','/our_firm/5955139W.htm',2,['/resources/navbar/reputation_sim.gif',26,15,0],0,0],
	[1523,'','/our_firm/5980234W.htm',2,['/resources/navbar/comm_sim.gif',26,15,0],0,0],
	[1524,'','/our_firm/5955157W.htm',2,['/resources/navbar/tech_sim.gif',65,15,0],0,0],
	[1525,'','/our_firm/5955166W.htm',2,['/resources/navbar/offices_sim.gif',75,15,0],0,0],
	[1526,'','/our_firm/5955089W.htm',2,['/resources/navbar/history_sim.gif',26,15,0],0,0],
	[1527,'','/our_firm/Our_Hong_Kong_office_January_2005.pdf',2,['/resources/navbar/hongkong_sim.gif',75,15,0],0,0]
*/
];

/* Create menu structure */
menu_write();




