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];}}
}

function MM_findObj(n, d) { //v4.01
  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);
  if(!x && d.getElementById) x=d.getElementById(n); 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];}
}

var menuFlag = 0, holdFlag = false, slm_hold = false;

			
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_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}


// We assign parentage of the 2nd-layer dropdown menus here, so we don't have to re-establish it every time.
var parentMenusHash = new Array();
parentMenusHash["about"] = "about";
parentMenusHash["markets"] = "markets";
parentMenusHash["expertise"] = "expertise";
parentMenusHash["newsletters"] = "newsletters";
parentMenusHash["ourwork"] = "ourwork";
parentMenusHash["conferences"] = "conferences";
parentMenusHash["careers"] = "careers";

var menu_button_on = "";

function showhidelayers(obj,sh) { //v3.0
    var stro = obj;
	obj = MM_findObj(obj);
	if (obj) {
		if (obj.style) {
			if (sh > 0) { menu_button_on = "";
				obj.style.visibility = 'visible'; }
			else { obj.style.visibility = "hidden";
				if (parentMenusHash[stro] != "") {
					menu_button_on = stro;
					//setTimeout("if (menu_button_on != '') { MM_swapImage('n_'+parentMenusHash[menu_button_on],'','/images/menubar/'+parentMenusHash[menu_button_on]+'_clear.gif'); }",2);  (real one with good buttons)
					//fake one with current buttons
					setTimeout("if (menu_button_on != '') { MM_swapImage('n_'+parentMenusHash[menu_button_on],'','/images/menubar/'+parentMenusHash[menu_button_on]+'_clear.gif'); }",2);
				}
			}
		}
	}
	//else { debug(obj+" does not have style property"); }
}



function showhide2layers(obj,sh) {
 showhidelayers(obj,sh);
 var underscore = obj.indexOf("_");
 var head = obj.substr(0,underscore);
 showhidelayers(head,sh);
}

function startMenuTimer(){ return 1; }
function stopMenuTimer(){ return 1; }


function preload_tab_img() {
 MM_preloadImages(
'/images/menubar/about_clear.gif',
'/images/menubar/about_solid.gif',
'/images/menubar/careers_clear.gif',
'/images/menubar/careers_solid.gif',
'/images/menubar/conferences_clear.gif',
'/images/menubar/conferences_solid.gif',
'/images/menubar/expertise_clear.gif',
'/images/menubar/expertise_solid.gif',
'/images/menubar/markets_clear.gif',
'/images/menubar/markets_solid.gif',
'/images/menubar/newsletters_clear.gif',
'/images/menubar/newsletters_solid.gif',
'/images/menubar/ourwork_clear.gif',
'/images/menubar/ourwork_solid.gif'
);
}


//MM_swapImage('n_about','','/images/menubar/about_clear.gif','n_markets','','/images/menubar/markets_clear.gif','n_expertise','','/images/menubar/expertise_clear.gif','n_newsletters','','/images/menubar/newsletters_clear.gif','n_ourwork','','/images/menubar/ourwork_clear.gif','n_conferences','','/images/menubar/conferences_clear.gif',1);


/// old clunky show/hide menus
/*
function menuTimeout(){ //v1.2
	if (menuFlag > 0){
		menuFlag-- //flag is add to everytime a button is rolled over, subtract one from each timeout until none are left
		if (menuFlag == 0 && holdFlag == false && slm_hold == false) {
			//timed out-- revert to idle states
MM_showHideLayers('about','','hide','markets','','hide','expertise','','hide','newsletters','','hide','ourwork','','hide','conferences','','hide');
		}
	}
}

function startMenuTimer(){ //v1.2
	debugmsg('START');
	var verStr=navigator.appVersion, app=navigator.appName, version = parseFloat(verStr);
	menuFlag++;
	holdFlag = false;
	if (app.indexOf('Netscape') != -1 && version < 5){
		setTimeout('menuTimeout()',900);
	} else {
	//must have a tiny delay as user leaves menu button and goes to div
	setTimeout('menuTimeout()',1);
	}
}

function stopMenuTimer(){ //v1.1
	debugmsg('STOP');
	holdFlag = true;
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}
*/
