// JS for Lufthansa Prehomepage 
// For layer handling
var timer = 100;
// Shows the <div>
function lh_show(e, strDivId,strPAry)
{
	// clear delay
	if (typeof delayhide!="undefined")clearTimeout(delayhide);
	// route event to next dom element
	if (window.event) event.cancelBubble=true;
	else if (e.stopPropagation) e.stopPropagation()
	// display <div> with dropdown list.
	obj = document.getElementById(strDivId);
	obj.style.visibility="visible";
	// change the css-class for the mouseover area (not realy a link)
	aryStr = strPAry.split("|");
	obj = document.getElementById(aryStr[1]);
	cssClassChanger(aryStr[0],obj,aryStr[2]); // using 'cssClassChanger' in 'scripts.js'
}
// Prepare and test for hiding the <div>
function lh_hide(e, objCaller, strDivId,strPAry)
{
	// route event to next dom element, important here !
	if (window.event) event.cancelBubble=true
	else if (e.stopPropagation) e.stopPropagation()
	if(e.toElement) {
		/* if the element which fired the event is not part of the content div the content div must fade out */
		if (!objCaller.contains(e.toElement))delayhide=setTimeout("lh_hideout('"+strDivId+"','"+strPAry+"')",timer);
	}
	else if (e.currentTarget!= e.relatedTarget&& !lh_objcontains(e.currentTarget, e.relatedTarget)) {
		/* same as above, but for the gecko based browser */
		delayhide=setTimeout("lh_hideout('"+strDivId+"','"+strPAry+"')",timer);
	}
	return false;
}
// Hides the <div>
function lh_hideout(strDivId,strPAry)
{
	document.getElementById(strDivId).style.visibility="hidden";
	// change the css-class for the mouseover area (not realy a link)	
	aryStr = strPAry.split("|");
	obj = document.getElementById(aryStr[1]);
	cssClassChanger(aryStr[0],obj,aryStr[2]);
}
// Checks if a given element (rt) is part of an other element (ct)
// Used for browser who don't know the '.toElement'-methode.
function lh_objcontains(ct, rt)
{
	if(rt){
		while (rt.parentNode)
		if ((rt = rt.parentNode) == ct)
		return true;
		return false;
	}
	else return true;
}