




/* 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 == 1) ? "100px " :
			((oGroup.offsetWidth <= oItem.offsetWidth) ?
			oItem.offsetWidth : oGroup.offsetWidth - menuTrimConst) + "px";
		
		if (id == 3) oGroup.style.width = "195px";
		if (id == 4) oGroup.style.width = "120px";
		if (id == 5) oGroup.style.width = "115px"; 
		
		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 == 4001) ? "140px" : 
			((oGroup.offsetWidth <= oItem.offsetWidth) ?
			oItem.offsetWidth : oGroup.offsetWidth - menuTrimConst) + "px";
		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,'About Us','../../about/firm.asp',0,0,0,0,0],
	[3,'Expertise','../../expertise/expertise.asp',0,0,0,0,100],
	[4,'Our Team','../team.asp',0,0,0,0,200],
	[5,'Careers','../../careers/careers.asp',0,0,0,0,300],
	[6,'Publications','../../publications/publications.asp',0,0,0,0,400],
	[7,'News & Events','../../news/newsandevents.asp',0,0,0,0,500],
	[8,'Conntact','../../contact.asp',0,0,0,0,638],

//	[999,'','',2,['/resources/shim.gif',1,17,0],0,0],

	[2001,'The Firm','../../about/firm.asp',2,0,0,0],
	[2002,'Our Mission','../../about/mission.asp',2,0,0,0],
	[2003,'Our Values','../../about/values.asp',2,0,0,0],
	[2004,'Facts','../../about/facts.asp',2,0,0,0],
	
	[3001,'Corporate & Commercial','../../expertise/corporate_commercial.asp',3,0,0,0],
	[3002,'Mergers & Acquisitions/Privatisation','../../expertise/mergers_acquisitions_privatisation.asp',3,0,0,0],
	[3003,'Real Estate, Projects/PPP','../../expertise/real_estate_projects_ppp.asp',3,0,0,0],
	[3004,'Banking, Finance & Capital Markets','../../expertise/banking_finance_capital_markets.asp',3,0,0,0],
	[3005,'IT & Telecommunications','../../expertise/it_telecommunications.asp',3,0,0,0],
	[3006,'Power, Energy & Natural Resources','../../expertise/power_energy_natural_resources.asp',3,0,0,0],
	[3007,'Competition','../../expertise/competition.asp',3,0,0,0],
	[3008,'Employment','../../expertise/employment.asp',3,0,0,0],
	[3009,'Insurance','../../expertise/insurance.asp',3,0,0,0],
	[3010,'Litigation & Arbitration','../../expertise/litigation_arbitration.asp',3,0,0,0],
	[3011,'Intellectual Property & Copyright','../../expertise/intellectual_property_copyright.asp',3,0,0,0],
	[3012,'Regulatory','../../expertise/regulatory.asp',3,0,0,0],
				
	[4001,'Partners','../partn/partners.asp',4,0,0,0],
			[4101,'Ernest Popovici','../partn/ernest_popovici.asp',4001,0,0,0],
			[4102,'Florian Nitu','../partn/florian_nitu.asp',4001,0,0,0],
			//[4103,'Sorin Alazaroaie','../partn/sorin_alazaroaie.asp',4001,0,0,0],
			[4103,'Anca Irena Tudorie','../partn/anca_irena_tudorie.asp',4001,0,0,0],
			[4104,'Bogdan Constantin Stoica','../partn/bogdan_c_stoica.asp',4001,0,0,0],
			[4105,'Vlad Neacsu','../partn/vlad_neacsu.asp',4001,0,0,0],
			
			[4106,'Valentin Creata','../partn/valentin_creata.asp',4001,0,0,0],
			[4107,'Silviu Stoica','../partn/silviu_stoica.asp',4001,0,0,0],
			[4108,'Ciprian Dontu','../partn/ciprian_dontu.asp',4001,0,0,0],
			[4109,'Alexandru Ambrozie','../partn/alexandru_ambrozie.asp',4001,0,0,0],
	
	[4002,'Senior Associates','../senior/senior.asp',4,0,0,0],
			
			[4201,'Cristina Emilia Alexe','../senior/cristina_emilia_alexe.asp',4002,0,0,0],
			[4202,'Camelia Constantin','../senior/camelia_constantin.asp',4002,0,0,0],
			[4203,'Luana Dragomirescu','../senior/luana_dragomirescu.asp',4002,0,0,0],
			[4204,'Ioana Dumitru','../senior/ioana_dumitru.asp',4002,0,0,0],
			[4205,'Mihaela Ion','../senior/mihaela_ion.asp',4002,0,0,0],
			[4206,'Ela Marin','../senior/ela_marin.asp',4002,0,0,0],
			[4207,'Adrian Nica','../senior/adrian_nica.asp',4002,0,0,0],
			[4208,'Serban Patriciu','../senior/serban_patriciu.asp',4002,0,0,0],
			[4209,'Raluca Petrescu','../senior/raluca_vidru.asp',4002,0,0,0],
			[4210,'Cristian Popescu','../senior/cristian_popescu.asp',4002,0,0,0],
			[4211,'Ioana Postelnicu','../senior/ioana_postelnicu.asp',4002,0,0,0],
			[4212,'Ioana Sampek','../senior/ioana_sampek.asp',4002,0,0,0],
			[4213,'Ilinca Stefanescu','../senior/ilinca_stefanescu.asp',4002,0,0,0],
			
			
						
			
	[4003,'Associates','../asoc/asoc.asp',4,0,0,0],
			[4301,'Vlad Ambrozie','../asoc/vlad_ambrozie.asp',4003,0,0,0],
			[4302,'Dana Casandra','../asoc/dana_casandra.asp',4003,0,0,0],
			[4303,'Mirela Cazacu','../asoc/mirela_cazacu.asp',4003,0,0,0],
			[4304,'Irina Cerga','../asoc/irina_cerga.asp',4003,0,0,0],
			[4305,'Bianca Chiurtu','../asoc/bianca_chiurtu.asp',4003,0,0,0],
			[4306,'Gabriela Constantin','../asoc/gabriela_constantin.asp',4003,0,0,0],
			[4307,'Elena Crintea','../asoc/elena_crintea.asp',4003,0,0,0],
			[4308,'Lavinia Dinoci','../asoc/lavinia_dinoci.asp',4003,0,0,0],
			[4309,'Cristian Dranca','../asoc/cristian_dranca.asp',4003,0,0,0],
			[4310,'Andreea Grosu','../asoc/andreea_grosu.asp',4003,0,0,0],
			[4311,'Andreea Hulub','../asoc/andreea_hulub.asp',4003,0,0,0],
			[4312,'Tudor Naftica','../asoc/tudor_naftica.asp',4003,0,0,0],
			[4313,'Andrei Ormenean','../asoc/andrei_ormenean.asp',4003,0,0,0],
			[4314,'Madalina Panca','../asoc/madalina_panca.asp',4003,0,0,0],
			[4315,'Mihaela Paraschiv','../asoc/mihaela_paraschiv.asp',4003,0,0,0],
			[4316,'Camelia Patrascu','../asoc/camelia_patrascu.asp',4003,0,0,0],
			[4317,'Cristina Radu','../asoc/cristina_radu.asp',4003,0,0,0],
			[4318,'Bianca Solcan','../asoc/bianca_solcan.asp',4003,0,0,0],
			[4319,'Codrin Taralunga','../asoc/codrin_taralunga.asp',4003,0,0,0],
			[4320,'Artur Tintari','../asoc/artur_tintari.asp',4003,0,0,0],
			[4321,'Dragos Zorin','../asoc/dragos_zorin.asp',4003,0,0,0],
			
			
			
			

	
	/*		
	[5001,'Student internship','../../careers/student_intern.asp',5,0,0,0],
	[5002,'Available positions','../../careers/available.asp',5,0,0,0],	
	[5003,'Support staff','../../careers/support.asp',5,0,0,0],
	[5004,'Our values','../../about/values.asp',5,0,0,0],
	*/
	
	[6001,'Legal Update','../../publications/legalupd.asp',6,0,0,0],
	[6002,'Articles','../../publications/articles.asp',6,0,0,0],
	
	[7001,'News','../../news/news.asp',7,0,0,0],
	[7002,'Press Releases','../../news/press.asp',7,0,0,0],
	[7003,'Press Reviews','../../news/reviews.asp',7,0,0,0]
	
];

/* Create menu structure */
menu_write();

