<!-- Start menu header -->
<!-- dropDownMenu -> Based on: PHP Layers Menu 2.2.1 -> Marco Pratesi (marco at telug dot it) -->
<!-- 1.0 --> 
<!-- (C) 2003 -->
<!-- Yanick Miron -->

<!-- Start browser detection -->

DOM = (document.getElementById) ? 1 : 0;
NS4 = (document.layers) ? 1 : 0;
// We need to explicitly detect Konqueror
// because Konqueror 3 sets IE = 1 ... AAAAAAAAAARGHHH!!!
Konqueror = (navigator.userAgent.indexOf("Konqueror") > -1) ? 1 : 0;
// We need to detect Konqueror 2.1 and 2.2 as they do not handle the window.onresize event
Konqueror21 = (navigator.userAgent.indexOf("Konqueror 2.1") > -1 || navigator.userAgent.indexOf("Konqueror/2.1") > -1) ? 1 : 0;
Konqueror22 = (navigator.userAgent.indexOf("Konqueror 2.2") > -1 || navigator.userAgent.indexOf("Konqueror/2.2") > -1) ? 1 : 0;
Konqueror2 = Konqueror21 || Konqueror22;
Opera5 = (navigator.userAgent.indexOf("Opera 5") > -1 || navigator.userAgent.indexOf("Opera/5") > -1) ? 1 : 0;
Opera6 = (navigator.userAgent.indexOf("Opera 6") > -1 || navigator.userAgent.indexOf("Opera/6") > -1) ? 1 : 0;
Opera = Opera5 || Opera6;
IE = (document.all) ? 1 : 0;
IE4 = IE && !DOM;

<!-- End browser detection -->

loaded = 0;
movedlayers = 0;

menuxleftshift = 6;
menuxrightshift = 10;

currentY = 0;
timeOutId = 0;
timeOutId1 = 0;

function delay(gap){ /* gap is in millisecs */
var then,now; then=new Date().getTime();
now=then;
while((now-then)<gap)
{now=new Date().getTime();}
}//

function grabMouse(e) {	// for NS4
	currentY = e.pageY;
}

if (NS4) {
	document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE);
	document.onmousemove = grabMouse;
}

function shutdown() {
	for (i=1; i<=numl; i++) {
		popUpL(listl[i], false);
	}
}

function hideImg() {
//  	for (i=1; i<=overc; i++) {
//		changeImage('',overl[i],'obj_' + overl[i]);
//	}  
    shutdown();
}

if (NS4) {
	//document.onmousedown = shutdown;
	document.onmousedown = hideImg;
} else {
	//document.onclick = shutdown;
	document.onclick = hideImg;
}

function preload(imgObj,imgSrc) {
	if (document.images) {
		eval(imgObj+' = new Image()')
		eval(imgObj+'.src = "'+imgSrc+'"')
	}
}

//function changeImage(layer,imgName,imgObj) {
//	if (document.images) {
//		  document.images[imgName].src = eval(imgObj+".src")
//	}
//}

function resizeHandler() {
	if (NS4) {
		window.location.reload();
	}
	shutdown();
	for (i=1; i<=numl; i++) {
		setleft(listl[i], 0);
		settop(listl[i], 0);
	}
	movedlayers = 0;
}

window.onresize = resizeHandler;

function yaresizeHandler() {
	if (window.innerWidth != origWidth || window.innerHeight != origHeight) {
		if (Konqueror2 || Opera5) {
			window.location.reload();	// Opera 5 often fails this
		}
		origWidth  = window.innerWidth;
		origHeight = window.innerHeight;
		resizeHandler();
	}
	setTimeout('yaresizeHandler()', 500);
}

function loadHandler() {
	if (Konqueror2 || Opera) {
		origWidth  = window.innerWidth;
		origHeight = window.innerHeight;
		yaresizeHandler();
	}
}
window.onload = loadHandler;

function setX(menuName) {
	if (father[menuName] != "") {
		if (!Opera5 && !IE4) {
			width0 = lwidth[father[menuName]];
			width1 = lwidth[menuName];
		} else if (Opera5) {
			// Opera 5 stupidly and exaggeratedly overestimates layers widths
			// hence we consider a default value equal to $abscissa_step
			width0 = abscissa_step;
			width1 = abscissa_step;
		} else if (IE4) {
			width0 = getoffsetwidth(father[menuName]);
			width1 = getoffsetwidth(menuName);
		}
		onleft = getoffsetleft(father[menuName]) - width1 + menuxleftshift;
		onright = getoffsetleft(father[menuName]) + width0 - menuxrightshift;
		windowwidth = getwindowwidth();
		windowxoffset = getwindowxoffset();
		if (NS4 && !DOM) {
			windowxoffset = 0;
		}
		if (onleft < windowxoffset && onright + width1 > windowwidth + windowxoffset) {
			if (onright + width1 - windowwidth - windowxoffset > windowxoffset - onleft) {
				onleft = windowxoffset;
			} else {
				onright = windowwidth + windowxoffset - width1;
			}
		}
		if (back[father[menuName]]) {
			if (onleft < windowxoffset) {
				back[menuName] = 0;
			} else {
				back[menuName] = 1;
			}
		} else {
			if (onright + width1 > windowwidth + windowxoffset) {
				back[menuName] = 1;
			} else {
				back[menuName] = 0;
			}
		}
		if (back[menuName]) {
			setleft(menuName, onleft);
		} else {
			setleft(menuName, onright);
		}
	}
}

function menuTimeOut() {
  timeOutId = setTimeout('shutdown()',9000);
  timeOutId1= setTimeout('hideImg()',9000);
  /* delay(500); */
}

function resetTimeOut() {
  clearTimeout(timeOutId);
  clearTimeout(timeOutId1);
}

function moveLayerY(menuName, ordinate_margin) {
  clearTimeout(timeOutId);
  clearTimeout(timeOutId1);
  if (loaded) {
	if (!movedlayers) {
		moveLayers();
		movedlayers = 1;
	}
	if (!NS4) {
		newY = getoffsettop("ref" + menuName);
	} else {
		newY = currentY;
	}
	newY -= ordinate_margin;
	layerheight = getoffsetheight(menuName);
	windowheight = getwindowheight();
	windowyoffset = getwindowyoffset();
	if (newY + layerheight > windowheight + windowyoffset) {
		if (layerheight > windowheight) {
			newY = windowyoffset;
		} else {
			newY = windowheight + windowyoffset - layerheight;
		}
	}
	if (Math.abs(getoffsettop(menuName) - newY) > thresholdY) {
		settop(menuName, newY);
	}
  }
}

function popUp(menuName,first_level) {
  clearTimeout(timeOutId);
  clearTimeout(timeOutId1);
  if(first_level) {
	if(firstl[menuName]) {
	  hideImg();
	} else {
      	shutdown();
	}	
  } else {
    shutdown();
  }	
	setX(menuName);
	do {
		popUpL(menuName,true);
		menuName = father[menuName];
	} while (menuName != "")
}

function popUpL(menuName,on) {
	if (loaded) {
		if (!movedlayers) {
			moveLayers();
			movedlayers = 1;
		}

		if (on) {
			if (DOM) {
				document.getElementById(menuName).style.visibility = "visible";
			} else if (NS4) {
				document.layers[menuName].visibility = "show";
			} else {
				document.all[menuName].style.visibility = "visible";
			}
		} else {
			if (DOM) {
				document.getElementById(menuName).style.visibility = "hidden";
			} else if (NS4) {
				document.layers[menuName].visibility = "hide";
			} else {
				document.all[menuName].style.visibility = "hidden";
			}
		}
	} 
}

function setleft(layer,x) {
	if (DOM && !Opera5) {
		document.getElementById(layer).style.left = x + "px";
	} else if (Opera5) {
		document.getElementById(layer).style.left = x;
	} else if (NS4) {
		document.layers[layer].left = x;
	} else {
		document.all[layer].style.pixelLeft = x;
	}
}

function getoffsetleft(layer) {
	var value = 0;
	if (DOM) {	// Mozilla, Konqueror >= 2.2, Opera 5 and 6, IE
			// timing problems with Konqueror 2.1 ?
		object = document.getElementById(layer);
		value = object.offsetLeft;
		while (object.tagName != "BODY" && object.offsetParent) {
			object = object.offsetParent;
			value += object.offsetLeft;
		}
	} else if (NS4) {
		value = document.layers[layer].pageX;
	} else {	// IE4 IS SIMPLY A BASTARD !!!
		if (document.all["IE4" + layer]) {
			layer = "IE4" + layer;
		}
		object = document.all[layer];
		value = object.offsetLeft;
		while (object.tagName != "BODY") {
			object = object.offsetParent;
			value += object.offsetLeft;
		}
	}
	return (value);
}

function settop(layer,y) {
	if (DOM && !Opera5) {
		document.getElementById(layer).style.top = y + "px";
	} else if (Opera5) {
		document.getElementById(layer).style.top = y;
	} else if (NS4) {
		document.layers[layer].top = y;
	} else {
		document.all[layer].style.pixelTop = y;
	}
}

function getoffsettop(layer) {
// IE 5.5 and 6.0 behaviour with this function is really strange:
// in some cases, they return a really too large value...
// ... after all, IE is buggy, nothing new
	var value = 0;
	if (DOM) {
		object = document.getElementById(layer);
		value = object.offsetTop;
		while (object.tagName != "BODY" && object.offsetParent) {
			object = object.offsetParent;
			value += object.offsetTop;
		}
	} else if (NS4) {
		value = document.layers[layer].pageY;
	} else {	// IE4 IS SIMPLY A BASTARD !!!
		if (document.all["IE4" + layer]) {
			layer = "IE4" + layer;
		}
		object = document.all[layer];
		value = object.offsetTop;
		while (object.tagName != "BODY") {
			object = object.offsetParent;
			value += object.offsetTop;
		}
	}
	return (value);
}

function setwidth(layer,w) {
	if (DOM) {
		document.getElementById(layer).style.width = w;
	} else if (NS4) {
		// document.layers[layer].width = w;
	} else {
		document.all[layer].style.pixelWidth = w;
	}
}

function getoffsetwidth(layer) {
	var value = 0;
	if (DOM && !Opera) {
		value = document.getElementById(layer).offsetWidth;
		if (isNaN(value)) {
		// e.g. undefined on Konqueror 2.1
			value = abscissa_step;
		}
	} else if (NS4) {
		value = document.layers[layer].document.width;
	} else if (Opera) {
		value = document.getElementById(layer).style.pixelWidth;
	} else {	// IE4 IS SIMPLY A BASTARD !!!
		if (document.all["IE4" + layer]) {
			layer = "IE4" + layer;
		}
		value = document.all[layer].offsetWidth;
	}
	return (value);
}

function setheight(layer,h) {	// unused, not tested
	if (DOM) {
		document.getElementById(layer).style.height = h;
	} else if (NS4) {
		// document.layers[layer].height = h;
	} else {
		document.all[layer].style.pixelHeight = h;
	}
}

function getoffsetheight(layer) {
	var value = 0;
	if (DOM && !Opera) {
		value = document.getElementById(layer).offsetHeight;
		if (isNaN(value)) {
		// e.g. undefined on Konqueror 2.1
			value = 25;
		}
	} else if (NS4) {
		value = document.layers[layer].document.height;
	} else if (Opera) {
		value = document.getElementById(layer).style.pixelHeight;
	} else {	// IE4 IS SIMPLY A BASTARD !!!
		if (document.all["IE4" + layer]) {
			layer = "IE4" + layer;
		}
		value = document.all[layer].offsetHeight;
	}
	return (value);
}

function getwindowwidth() {
	var value = 0;
	if ((DOM && !IE) || Konqueror || Opera) {
		value = top.innerWidth;
	} else if (NS4) {
		value = document.width;
	} else {	// IE
		if (document.documentElement && document.documentElement.clientWidth) {
			value = document.documentElement.clientWidth;
		} else if (document.body) {
			value = document.body.clientWidth;
		}
	}
	if (isNaN(value)) {
		value = top.innerWidth;
	}
	return (value);
}

function getwindowxoffset() {
	var value;
	if ((DOM && !IE) || NS4 || Konqueror || Opera) {
		value = window.pageXOffset;
	} else {	// IE
		if (document.documentElement && document.documentElement.scrollLeft) {
			value = document.documentElement.scrollLeft;
		} else if (document.body) {
			value = document.body.scrollLeft;
		}
	}
	return (value);
}

function getwindowheight() {
	var value = 0;
	if ((DOM && !IE) || NS4 || Konqueror || Opera) {
		value = top.innerHeight;
	} else {	// IE
		if (document.documentElement && document.documentElement.clientHeight) {
			value = document.documentElement.clientHeight;
		} else if (document.body) {
			value = document.body.clientHeight;
		}
	}
	if (isNaN(value)) {
		value = top.innerHeight;
	}
	return (value);
}

function getwindowyoffset() {
	var value;
	if ((DOM && !IE) || NS4 || Konqueror || Opera) {
		value = window.pageYOffset;
	} else {	// IE
		if (document.documentElement && document.documentElement.scrollTop) {
			value = document.documentElement.scrollTop;
		} else if (document.body) {
			value = document.body.scrollTop;
		}
	}
	return (value);
}

function fixieflm(menuName) {
	if (DOM) {
		setwidth(menuName, "100%");
	} else {	// IE4 IS SIMPLY A BASTARD !!!
		document.write("</div>");
		document.write("<div id=\"IE4" + menuName + "\" style=\"position: relative; width: 100%; visibility: visible;\">");
	}
}

var thresholdY = 20;
var abscissa_step = 540;

listl = new Array();
listl[1] = "L2";
listl[2] = "L11";
listl[3] = "L15";
listl[4] = "L24";
listl[5] = "L35";
listl[6] = "L42";

var numl = 6;

overl = new Array();
overl[1] = "home";
overl[2] = "company";
overl[3] = "doctors";
overl[4] = "staff";
overl[5] = "financial";
overl[6] = "cosmetic";
overl[7] = "family";
overl[8] = "";

var overc = 8; 

firstl = new Array();
firstl['L1'] = true;
firstl['L2'] = true;
firstl['L3'] = false;
firstl['L4'] = false;
firstl['L5'] = false;
firstl['L6'] = false;
firstl['L7'] = false;
firstl['L8'] = false;
firstl['L9'] = false;
firstl['L10'] = false;
firstl['L11'] = true;
firstl['L12'] = false;
firstl['L13'] = false;
firstl['L14'] = false;
firstl['L15'] = true;
firstl['L16'] = false;
firstl['L17'] = false;
firstl['L18'] = false;
firstl['L19'] = false;
firstl['L20'] = false;
firstl['L21'] = false;
firstl['L22'] = false;
firstl['L23'] = true;
firstl['L24'] = true;
firstl['L25'] = false;
firstl['L26'] = false;
firstl['L27'] = false;
firstl['L28'] = false;
firstl['L29'] = false;
firstl['L30'] = false;
firstl['L31'] = false;
firstl['L32'] = false;
firstl['L33'] = false;
firstl['L34'] = false;
firstl['L35'] = true;
firstl['L36'] = false;
firstl['L37'] = false;
firstl['L38'] = false;
firstl['L39'] = false;
firstl['L40'] = false;
firstl['L41'] = false;
firstl['L42'] = true;
firstl['L43'] = false;
firstl['L44'] = false;
firstl['L45'] = true;

father = new Array();
for (i=1; i<=45; i++) {
	father["L" + i] = "";
}

father['L3'] = "L2";
father['L4'] = "L2";
father['L5'] = "L2";
father['L6'] = "L2";
father['L7'] = "L2";
father['L8'] = "L2";
father['L9'] = "L2";
father['L10'] = "L2";
father['L12'] = "L11";
father['L13'] = "L11";
father['L14'] = "L11";
father['L16'] = "L15";
father['L17'] = "L15";
father['L18'] = "L15";
father['L19'] = "L15";
father['L20'] = "L15";
father['L21'] = "L15";
father['L22'] = "L15";
father['L25'] = "L24";
father['L26'] = "L24";
father['L27'] = "L24";
father['L28'] = "L24";
father['L29'] = "L24";
father['L30'] = "L24";
father['L31'] = "L24";
father['L32'] = "L24";
father['L33'] = "L24";
father['L34'] = "L24";
father['L36'] = "L35";
father['L37'] = "L35";
father['L38'] = "L35";
father['L39'] = "L35";
father['L40'] = "L35";
father['L41'] = "L35";
father['L43'] = "L42";
father['L44'] = "L42";

lwidth = new Array();
var lwidthdetected = 0;

function moveLayers() {
	if (!lwidthdetected) {
		for (i=1; i<=numl; i++) {
			lwidth[listl[i]] = getoffsetwidth(listl[i]);
		}
		lwidthdetected = 1;
	}
	var mainTOP = getoffsettop('mainL1');
	var mainHEIGHT = getoffsetheight('mainL1');
	setleft('L2', getoffsetleft('mainL1'));
	settop('L2', mainTOP + mainHEIGHT);
	if (IE4) setwidth('L2',540);
	setleft('L11', getoffsetleft('mainL1'));
	settop('L11', mainTOP + mainHEIGHT);
	if (IE4) setwidth('L11',540);
	setleft('L15', getoffsetleft('mainL1'));
	settop('L15', mainTOP + mainHEIGHT);
	if (IE4) setwidth('L15',540);
	setleft('L24', getoffsetleft('mainL1'));
	settop('L24', mainTOP + mainHEIGHT);
	if (IE4) setwidth('L24',540);
	setleft('L35', getoffsetleft('mainL1'));
	settop('L35', mainTOP + mainHEIGHT);
	if (IE4) setwidth('L35',540);
	setleft('L42', getoffsetleft('mainL1'));
	settop('L42', mainTOP + mainHEIGHT);
	if (IE4) setwidth('L42',540);
}

back = new Array();
for (i=1; i<=44; i++) {
	back["L" + i] = 0;
}

<!-- End menu  header -->