function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

var ns = (navigator.appName.indexOf('Netscape')>-1);
var ie = (navigator.appName.indexOf('Microsoft Internet Explorer')>-1);
var serviceMenuItems = new Array(
   ["Cases", "about.html", "Case Studies"],
   ["Articles", "about-pr.html", "Articles & Press Releases"]);
var clientMenuItems = new Array(
   ["Consulting", "client-consult.html", "Consulting"],
   ["People", "client-rec.html", "Recruitment"],
   ["Services", "client-hr.html", "HR Services"],
   ["Clients", "client-assess.html", "Assessment Centre"],
   ["Articles", "client-acq.html", "Acquisition & Disposal"],
   ["Planning", "client-exit.html", "Exit Planning & Implementation"]);
var candidateMenuItems = new Array(
   ["Five", "cands-commit.html", "Our Commitment"],
   ["Six", "jobs.php", "Job Board"],
   ["Contact", "cands-contact.html", "Contact Details"],
   ["Seven", "cands-consult.html", "Speak to a Consultant"]);
var anotherMenuItems = new Array(
   ["Eight", "page.htm", "Option 8"],
   ["Nine", "page.htm", "Option 9"],
   ["Ten", "page.htm", "Option 10"]);
var contactMenuItems = new Array(
   ["Enquiries", "contact.html", "Contact Details"],
   ["Consultant", "map.html", "Location Map"]);

function createMenu(menuName, menuItems)
{
   var divHTML = '<DIV ID="' + menuName + 'MenuDiv" CLASS="DivMenu"';
   divHTML = divHTML + 'onmouseout="return hideMenu(this, ' + menuName.length + ',event)">';

   var tableHTML = '<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" ID="' + 
      menuName + 'Table" align="center"><TBODY ID="' + menuName + 'TableBody">';
   var tableRowHTML = "";
   var rowCount;
   var totalNoRows = menuItems.length;
   for (rowCount = 0; rowCount < totalNoRows; rowCount++)
   {
      tableRowHTML = tableRowHTML + '<TR ID="' + menuName + menuItems[rowCount][0] +  'TR"><TD ID="' + menuName + menuItems[rowCount][0];
      tableRowHTML = tableRowHTML + '" onclick="goPage(\'' + menuItems[rowCount][1] + '\')"';
      tableRowHTML = tableRowHTML + 'CLASS="TDMenu" onmouseover="this.className=\'TDMenuOver\';" onmouseout="this.className=\'TDMenu\';">' + menuItems[rowCount][2] + '</TD></TR>';
   }
  
   return divHTML + tableHTML + tableRowHTML + '</TBODY></TABLE></DIV>';
}

function showMenu(menuToShow, e)
{
   if (ns)
   {
      var srcElement = e.target;
   } 
   else
   {
      var srcElement = event.srcElement; 
   }
   var xPos = parseInt(srcElement.style.left);
   var yPos = parseInt(srcElement.style.top); 
   menuToShow.style.left = xPos // + (srcElement.width)
   menuToShow.style.top = yPos + srcElement.height;
}

function hideMenu(menuToHide, menuIDLength, e)
{   
   var toElementID;
   if (ns)
   {
      var mouseLastIn = e.relatedTarget;       
   }
   else
   {
      var mouseLastIn =  event.toElement; 
   }
   if (mouseLastIn != null)
   {
      if (mouseLastIn.nodeType == 3)
      {
         mouseLastIn = mouseLastIn.parentNode; 
      }
      toElementID = mouseLastIn.id;
   }
   else 
   {  
       return false;
   }

   if (typeof(toElementID) == "undefined")
   {
      toElementID = "UNDEF";
   }
   toElementID = toElementID.substr(0,menuIDLength);
   var divMenuID = menuToHide.id;
   divMenuID = divMenuID.substr(0,menuIDLength);
   if (toElementID != divMenuID)
   {
      menuToHide.style.left = -200 + 'px';
      menuToHide.style.top = -1000 + 'px';
   }
}

function goPage(src)
{
   window.location.href = src;
}