var menuBasePath = "/careers/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[n][6] = lastDepth;
}
/* Generate each block of data */
//html = '
\n' + menu_write_group(0) + '
\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 += '\n' +
menu_write_group(pid) + '
\n';
}
//ht_pre = ''+html.replace(//g, ">")+'
';
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") ?
'
'
:
/*(menuData[n][5] > 0 && menuData[n][3] != 0) ? ' >' :*/ '';
linkDest = (menuData[n][2].length > 0) ? menuData[n][2] : '#';
cols[cols.length-1] += '\t\n';
}
}
if (cols.length > 1)
return '';
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 = ((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 == 11) oGroup.style.width = "160px";
//if (id == 14) oGroup.style.width = "150px";
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 - 2;
oGroup.style.left = oPGroup.offsetLeft + oPGroup.offsetWidth - menuTrimConst;
oGroup.style.width = oGroup.offsetWidth - menuTrimConst;
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
[11,'Us','/careers/us/',0,0,0,0,195],
[12,'You','/careers/you/',0,0,0,0,388],
[1758,'Clerkships_graduates','/careers/clerkships_graduates/',0,0,0,0,582],
[21,'Where are we?','/careers/us/wherearewe.cfm',11,0,0,0],
[22,'Practice Areas','/careers/us/7780221w.htm',11,0,0,0],
[23,'Our People','/careers/us/profiles.cfm',11,0,0,0],
[24,'Your Career','/careers/us/7780232w.htm',11,0,0,0],
[25,'In the community','/careers/us/7780320w.htm',11,0,0,0],
[20,'Benefits','/careers/us/7780172w.htm',11,0,0,0],
[26,'Contact us','/contact_lists/C/9806480w.htm',11,0,0,0],
[30,'Lawyers','/careers/you/7780336w.htm',12,0,0,0],
[32,'Paralegals','/careers/you/7780351w.htm',12,0,0,0],
[33,'Shared Services','/careers/you/7780356w.htm',12,0,0,0],
[34,'Legal Support','/careers/you/7780736w.htm',12,0,0,0],
[247,'Asia','/careers/you/8546601w.htm',12,0,0,0],
[248,'Privacy Statement','/careers/opportunities/privacy.cfm?',12,0,0,0],
[249,'Job search','/careers/opportunities/job-search.cfm?',12,0,0,0],
[1712,'Clerkships','/careers/you/7780346w.htm',1758,0,0,0],
[1720,'Graduates','/careers/you/8612990w.htm',1758,0,0,0]
];
/* Create menu structure */
menu_write();