function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
		}
	}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
			}
		}
	}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		nav_02_over = newImage("images/nav_02-over.gif");
		nav_03_over = newImage("images/nav_03-over.gif");
		nav_04_over = newImage("images/nav_04-over.gif");
		nav_05_over = newImage("images/nav_05-over.gif");
		nav_06_over = newImage("images/nav_06-over.gif");
		nav_07_over = newImage("images/nav_07-over.gif");
		
		subnav_what_02_over = newImage("images/subnav_what_02-over.gif");
		subnav_what_03_over = newImage("images/subnav_what_03-over.gif");
		
		subnav_who_02_over = newImage("images/subnav_who_02-over.gif");
		subnav_who_03_over = newImage("images/subnav_who_03-over.gif");
		subnav_who_04_over = newImage("images/subnav_who_04-over.gif");
		
		subnav_about_02_over = newImage("images/subnav_about_02-over.gif");
		subnav_about_03_over = newImage("images/subnav_about_03-over.gif");
		
		preloadFlag = true;
		}
	}

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_showHideLayers() { //v6.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; }
	}

function changeSelects( valSel1, valToEnable, div ) {
	var boolDisable = ( valSel1 != valToEnable );
	var strShowHide = ( !boolDisable ) ? "show" : "hide";
	
	MM_showHideLayers( div, '', strShowHide );
				
	return boolDisable;
	}

function jumpTO( strURL ) {
	if( strURL != "" )
		window.location.href = strURL;
	}

function submitForm( valSel1, valToEnable, sel2, div ) {
	var boolDisable = changeSelects( valSel1, valToEnable, div );
	if( valSel1 != "" ) {
		var strURL = ( boolDisable ) ? valSel1 : sel2.value;
		jumpTO( strURL );
		}
	}

var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])
function fixPNG(myImage) {
	if ((version >= 5.5) && (version < 7) && (document.body.filters))	{
		var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
		var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
		var imgTitle = (myImage.title) ? "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' "
		var imgStyle = "display:inline-block;" + myImage.style.cssText
		var strNewHTML = "<span " + imgID + imgClass + imgTitle
			+ " style=\"" + "width:" + myImage.width 
			+ "px; height:" + myImage.height 
			+ "px;" + imgStyle + ";"
			+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
			+ "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>"
		myImage.outerHTML = strNewHTML
		}
	}

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
		} 
	else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
				}
			func();
			}
		}
	}

//addLoadEvent(preloadImages);

/* Setup for drop down menu
 * - Listners are attached to each LI such that sub img elements
 *   image is changed on mouseover and mouseout events
 * - New widths are set for each div.mega based on the width of the
 *   child ul.  If the width of the child ul is less than the parent li
 *   both the div.mega and div.mega-b are set to the larger width (the
 *   parent li width)
 * - EffectMenu takes care of absolute position for each div.mega and
 *   several other cross browser problems (e.g. ie flicker)
 */
var gevoMenu = null;
var mainNavImgTimeout = [];
function dropDownSetup() {
	$('mainmenu').select('li.main-navigation-item').each(function(liElm) {
		divMega = liElm.down('div');
		/* Attach event listeners for over images */
		if (!liElm.hasClassName('nohover')) {
			liElm.observe('mouseover', function(evt) {
				var imgElm = this.down('img');
				if (mainNavImgTimeout[imgElm.name]) {
					window.clearTimeout(mainNavImgTimeout[imgElm.name]);
					mainNavImgTimeout[imgElm.name] = null;
					}
				imgElm.src = 'images/' + imgElm.name + '-over.gif';
				});
			liElm.observe('mouseout', function(evt) {
				var imgElm = this.down('img');
				mainNavImgTimeout[imgElm.name] = setTimeout(function() {
					imgElm.src = 'images/' + imgElm.name + '.gif';
					}, 100);
				});
			}
		/* Set new width and position absolute */
		if (divMega != undefined) {
			var newWidth = divMega.down('ul').getWidth();
			if (newWidth < liElm.getWidth()) {
				newWidth = liElm.getWidth();
				divMega.down('div.mega-b').setStyle({width: newWidth + 'px'});
				}
			divMega.setStyle({width: newWidth + 'px'});
			divMega.hide().setStyle({visibility: 'visible'});
			}
		});

	/* Preload images */
	preloadImages();
	
	/* Setup Menu */
	document.loaded = true;
	gevoMenu = new EffectMenu('mainmenu', {
		'hidePause': 0.2, 'displayAction': 'none',
		'firstLevelBelow': true, 'subElementType': 'div',
		'firstLevelOffsetX': 1, 'firstLevelOffsetY': -12});
	/* Align right (eg careers) */
	$('mainmenu').select('li.align-right').each(function(liElm) {
		divMega = liElm.down('div');
		styleOpts = {
			position: 'absolute',
			left: (liElm.positionedOffset().left + liElm.getWidth() - divMega.getWidth()) + 'px',
			top: (liElm.positionedOffset().top + liElm.getHeight() - 12) + 'px'
			};
		divMega.setStyle(styleOpts);
		});
	}
if (document.loaded == true) {dropDownSetup();} else {document.observe('dom:loaded', dropDownSetup);}
