



/**
 * Display Debug Messages.
 * 
 * Requires a block-level element with the id of "dbg"
 */
function dbg(msg)
	{
	document.getElementById('dbg').innerHTML=msg;
	}


/**
 * Make navigation tab container (td) the same width as the navigation tabs.
 * This is so that we can force the other td to cover the rest of the area.
 */
function navMain_setWidth()
	{
	var obj_nav				= document.getElementById('nav');
	
	document.getElementById('id-navTabs').style.width=obj_nav.offsetWidth+"px";
	
	//navContainer_setWidth();
	}


/**
 * Make navigation tab container (td) the same width as the navigation tabs.
 * This is so that we can force the other td to cover the rest of the area.
 */
function navContainer_setWidth()
	{
	var obj_TD			= document.getElementById('id-nav_containerTD');
	var obj_cont		= document.getElementById('id-content_container');
	if (obj_TD != null && obj_cont != null)
		{
		obj_TD.style.width=obj_cont.offsetWidth+"px";
		}
	}



/**
 * This function is appended to the onLoad handler.
 *  - Initializes navigation tab rollover actions.
 *  - Sets tab GUI width.
 */
function navMain_initInstance()
	{
	
	//if (document.location.protocol != "https:")
	//	{
		if (document.getElementById('id-navMainExpMedical') != null)
			{
			var togExpMed			= document.getElementById('id-navMainExpMedical');
			togExpMed.onmouseover	= function() { togglePanel(togExpMed,'id-navSubExpMedical'); return false; }
			togExpMed.onmouseout	= function() { overlayclose('id-navSubExpMedical'); return false; }
		
			if (document.getElementById('id-navSubExpMedical') != null)
				{
				var togExpMedSub			= document.getElementById('id-navSubExpMedical');
				togExpMedSub.onmouseout	= function() { overlayclose('id-navSubExpMedical'); return false; }
				// Add iframe shim underneath overlay layer.
				initHideExplorerSelect(togExpMedSub, 'id-navSubExpMedical');
				}
			}
	
	
		if (document.getElementById('id-navMainExpNonMedical') != null)
			{
			var togExpNonMed			= document.getElementById('id-navMainExpNonMedical');
			togExpNonMed.onmouseover	= function() { togglePanel(togExpNonMed,'id-navSubExpNonMedical'); return false; }
			togExpNonMed.onmouseout		= function() { overlayclose('id-navSubExpNonMedical'); return false; }
		
			if (document.getElementById('id-navSubExpNonMedical') != null)
				{
				var togExpNonMedSub			= document.getElementById('id-navSubExpNonMedical');
				togExpNonMedSub.onmouseout	= function() { overlayclose('id-navSubExpNonMedical'); return false; }
				// Add iframe shim underneath overlay layer.
				initHideExplorerSelect(togExpNonMedSub, 'id-navSubExpNonMedical');
				}
			}
	
	
		if (document.getElementById('id-navMainExpLocation') != null)
			{
			var togLocation			= document.getElementById('id-navMainExpLocation');
			togLocation.onmouseover	= function()	{ togglePanel(togLocation,'id-navSubLocation'); return false; }
			togLocation.onmouseout	= function()	{ overlayclose('id-navSubLocation'); return false; }
		
			if (document.getElementById('id-navSubLocation') != null)
				{
				var togLocationSub			= document.getElementById('id-navSubLocation');
				togLocationSub.onmouseout	= function() { overlayclose('id-navSubLocation'); return false; }
				// Add iframe shim underneath overlay layer.
				initHideExplorerSelect(togLocation, 'id-navSubLocation');
				}
			}
	
	
	//	}
	// Make tabs container the same width as the tabs.
	//navMain_setWidth();
	}



/**
 * Wrapper for overlay() Panel.
 */
function togglePanel(togID, subID)
	{
	overlay(togID, subID, 'bottom');
	}



/**
 * Hide the overlay() Panel.
 */
function overlayclose(subobjstr)
	{
	//var subobj				= document.getElementById(subobjstr);
	//subobj.style.display	="none";
	document.getElementById(subobjstr).style.display	="none"
	}



/**
 * Adds iframe shim underneath overlay layers.
 * 
 * Avoids having select form elements in IE 6 show through the overlay.
 * Problem: http://blogs.msdn.com/ie/archive/2006/01/17/514076.aspx
 * Solution: http://tanny.ica.com/ICA/TKO/tkoblog.nsf/dx/select-tag-overlap-in-ie-part-iii
 */
function initHideExplorerSelect(obj_parent, id_child)
	{
	if (BrowserDetect.browser == "Explorer")
		{
		if (BrowserDetect.version > "5.0" && BrowserDetect.version < "7.0" && document.location.protocol != "https:")
			{
			// IE script to cover <select> elements with <iframe>s
			
			// Create an iframe.
			var ieMat=document.createElement('iframe');
			
			// Create the iframe src attribute.
			if(document.location.protocol == "https:")
				{
				//ieMat.src="//0";
				ieMat.src="/empty.txt";
				}
			else if(window.opera != "undefined")
				ieMat.src="";
			else
				ieMat.src="robots.txt";
			
			
			var obj_child		= document.getElementById(id_child);
			togglePanel(obj_parent,id_child);
			
			// Create an iframe the width and height of the nav?
			ieMat.scrolling		= "no";
			ieMat.frameBorder	= "0";
			ieMat.style.width	= obj_child.offsetWidth+"px";
			ieMat.style.height	= obj_child.offsetHeight+"px";
			ieMat.style.zIndex	= "-1";
				
				
			obj_child.insertBefore(ieMat, obj_child.childNodes[0]);
			
			// Set the zIndex of the hover panels to 101.
			obj_child.style.zIndex="101";
			
			overlayclose(id_child);
			}
		
		// IE 5.0
		else
			{
			// IE 5.0 doesn't support iframes so hide the select statements on hover and show on mouse out.
			// IE script to change class on mouseover
			var ieLIs = document.getElementById('nav').getElementsByTagName('li');
			for (var i=0; i<ieLIs.length; i++) if (ieLIs[i])
				{
				ieLIs[i].onmouseover=function() {this.className+=" sfhover";hideSelects();}
				ieLIs[i].onmouseout=function() {this.className=this.className.replace(' sfhover', '');showSelects()}
				}
			}
		}
	}



/**
 * If IE 5.0 hide and show the select statements.
 */
function hideSelects()
	{
	// Collect the Select Items.
	var oSelects=document.getElementsByTagName("select");
	// Loop through them.
	for(var i=0;i<oSelects.length;i++)
		{
		// Hide them.
		oSelects[i].className+=" hide";
		}
	}
function showSelects()
	{
	// Collect the Select Items.
	var oSelects=document.getElementsByTagName("select");
	// Loop through them.
	for(var i=0;i<oSelects.length;i++)
		{
		// Show them.
		oSelects[i].className=oSelects[i].className.replace(" hide","");
		}
	}



/**
 * Add functions into window.load / onload event handler,
 * rather than writing over it.
 */
addLoadListener(navMain_initInstance);


/**
 * http://www.quirksmode.org/js/detect.html
 */
var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();



/***********************************************
* Drop Down/ Overlapping Content- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
/**/
var cm=null;

// FF - this gives the left edge of the screen to the right edge of the parent.
function getPos(el,sProp)
	{
	// init
	var iPos = 0
	
	iPos+=el["offset" + sProp];
	el = el.offsetParent;
	
	iPos+=el["offset" + sProp];
	el = el.offsetParent;
	return iPos
	}

function getleft(el,m)
	{
	if (m)
		{
		m.style.pixelLeft = getPos(el,"Left");
		}
	cm=m
	}
function findPos(obj)
	{
	var curleft = curtop = 0;
	if (obj.offsetParent)
		{
		curleft = obj.offsetLeft;
		curtop = obj.offsetTop;
		while (obj = obj.offsetParent)
			{
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
			}
		}
	return [curleft,curtop];
	}

function voidx() { }

function getposOffset(obj_overlay, offsettype)
	{
	// In IE, overlay.offsetLeft gives us the number of pixels from the left edge of the
	// parent element to the left edge of "this" element.
	// FF appears to give us the total length of the parent element.
	var totaloffset		=(offsettype=="left") ? obj_overlay.offsetLeft : obj_overlay.offsetTop;
	
	var parentEl	= obj_overlay.offsetParent;
	
	while (parentEl!=null)
		{
		totaloffset	= (offsettype=="left") ? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl	= parentEl.offsetParent;
		}
	return totaloffset;
	}

function overlay(obj_parent, childId, opt_position)
	{
	if (document.getElementById)
		{
		var obj_child				= document.getElementById(childId);
		
		// Toggle Display.
		obj_child.style.display	= "block";
		
		// X Coordinate.
		var xpos				= getposOffset(obj_parent, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1) ? -(obj_child.offsetWidth-obj_parent.offsetWidth) : 0) ;
		
		// Y Coordinate.
		var ypos				= getposOffset(obj_parent, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1) ? obj_parent.offsetHeight : 0);
		//dbg(xpos);
		obj_child.style.left		= (xpos-15)+"px";
		//obj_child.style.left		= "10px";
		
		obj_child.style.top		= (ypos-1)+"px";
		
		
		return false;
		}
	else
		return true
	}