var NN = document.layers? true : false;
var IE = document.all? true : false;
var DOM = document.getElementById? true : false;
var menutimeout;
var menutimeoutNew;
var closeTime=500;
var hideMenuDisp=false;
var SearchBar_shiftTop=6;
var SearchBar_shiftWidth=-2;
var arrMenuName = new Array ();
function SearchBar_menuitemover(from) {
	from.className = 'SearchBarPopupHover';
}
function SearchBar_menuitemout(from) {
	from.className = 'SearchBarPopup';
}
function getelement(id) {
  if (DOM) { return document.getElementById(id) }
  else if (NN) { return document.layers[id] }
  else { return document.all[id] };
}
function getelementstyle(id) {
    if (DOM) { return document.getElementById(id).style }
    else if (NN) { return document.layers[id] }
    else { return document.all[id].style };
}
function shiftto(obj, x, y,moveYPosition) {
  if (DOM) {
    obj.style.left = x+3;
    obj.style.top = y-moveYPosition;
  } else if (NN) { obj.moveTo(x,y);
  } else {
    obj.style.pixelLeft = x+2;
    obj.style.pixelTop = y-180;
  }
}
function setshow() {
  if (DOM) { return "visible";
  } else if (NN) { return "show";
  } else { return "visible";}
}
function sethide() {
  if (DOM) { return "hidden"; }
  else if (NN) { return "hide"; }
  else { return "hidden"; }
}
function getleft(obj) {
  if (DOM || IE) {
    for (var lx=0; obj!=null; lx+=obj.offsetLeft, obj=obj.offsetParent);
    return lx;
  } else { return obj.top;}
}

function gettop(obj) {
  if (DOM || IE) {
    for (var ly=0; obj!=null; ly+=obj.offsetTop, obj=obj.offsetParent);
    return ly;
  } else { return obj.top; }
}

function getheight(obj) {
  if (DOM) {return obj.offsetHeight }
  else if (NN)  { return obj.clip.height }
  else { return obj.clientHeight }
}
function menuDropPopupLevel2(menulevel,id, from,menuName,lang,picName) {
	window.clearTimeout(menutimeoutNew);
	eval("document['"+menuName+"'].src = '/customcf/pics/"+lang+"/"+picName+".gif';");
	SearchBar_menuitemover(from);
	elem = getelement(id);
	hideMenuDisp=false;
	window.clearTimeout(menutimeout);
	if (menulevel < arrMenuName.length) {
		var arrCnt = arrMenuName.length-1;
		while (arrCnt > menulevel) {
			if (getelement(arrMenuName[arrCnt]) != null) {
				elemstyle = getelementstyle(arrMenuName[arrCnt]);
				elemstyle.visibility=sethide();	
				arrMenuName[arrCnt] = "";
			}
			arrCnt--;
		}
	}
	if (id != null) {
		if (arrMenuName[menulevel] != id) {
			if (getelement(arrMenuName[arrCnt]) != null) {	
				elemstyle = getelementstyle(arrMenuName[arrCnt]);
				elemstyle.visibility=sethide();
			}	
		}
		arrMenuName[menulevel] = id;
		shiftto(elem, getleft(from)+SearchBar_shiftWidth, gettop(from)+getheight(from)+SearchBar_shiftTop);
		elemstyle = getelementstyle(id);
		elemstyle.visibility=setshow();
	} else {
			if (getelement(arrMenuName[arrCnt]) != null) {	
				elemstyle = getelementstyle(arrMenuName[arrCnt]);
				elemstyle.visibility=sethide();
}	}	}
function menuDropPopupTemp(menulevel,id, from,moveYPosition,menuName,lang,picName,selectedPic){
	menutimeoutNew = window.setTimeout(function () {menuDropPopup(menulevel,id, from,moveYPosition,menuName,lang,picName,selectedPic)},200);
}
function menuDropPopup(menulevel,id, from,moveYPosition,menuName,lang,picName,selectedPic) {
	var checkMenuName = eval("document['"+menuName+"'].src");
	checkMenuName = checkMenuName.substring(checkMenuName.lastIndexOf("/")+1,checkMenuName.length);
	checkMenuName = checkMenuName.substring(0,checkMenuName.indexOf("."));
	if(checkMenuName!=picName)
		eval("document['"+menuName+"'].src = '/customcf/pics/"+lang+"/"+picName+".gif';");
	if(id=="beiManorDropdown"){
		if(selectedPic=='onlineShop')
			document['onlineShopImg'].src = eval("'/customcf/pics/"+lang+"/manor_header_3_sel.gif'");
		else
			document['onlineShopImg'].src = eval("'/customcf/pics/"+lang+"/manor_header_3.gif'");
		if(selectedPic=='kundenService')
			document['kundenServiceImg'].src = eval("'/customcf/pics/"+lang+"/manor_header_4_sel.gif'");
		else
			document['kundenServiceImg'].src = eval("'/customcf/pics/"+lang+"/manor_header_4.gif'");
	}
	else if(id=="onlineShopDropdown"){
		if(selectedPic=='')
			document['beiManorImg'].src = eval("'/customcf/pics/"+lang+"/manor_header_2_sel.gif'");
		else
			document['beiManorImg'].src = eval("'/customcf/pics/"+lang+"/manor_header_2.gif'");
		if(selectedPic=='kundenService')
			document['kundenServiceImg'].src = eval("'/customcf/pics/"+lang+"/manor_header_4_sel.gif'");
		else
			document['kundenServiceImg'].src = eval("'/customcf/pics/"+lang+"/manor_header_4.gif'");
	}
	else{
		if(selectedPic=='')
			document['beiManorImg'].src = eval("'/customcf/pics/"+lang+"/manor_header_2_sel.gif'");
		else
			document['beiManorImg'].src = eval("'/customcf/pics/"+lang+"/manor_header_2.gif'");
		if(selectedPic=='onlineShop')
			document['onlineShopImg'].src = eval("'/customcf/pics/"+lang+"/manor_header_3_sel.gif'");
		else
			document['onlineShopImg'].src = eval("'/customcf/pics/"+lang+"/manor_header_3.gif'");
	}
elem = getelement(id);
	hideMenuDisp=false;
	window.clearTimeout(menutimeout);
	var arrCnt = arrMenuName.length-1;
	while (arrCnt >= 0) {
		if (getelement(arrMenuName[arrCnt]) != null) {
			elemstyle = getelementstyle(arrMenuName[arrCnt]);
			elemstyle.visibility=sethide();	
			arrMenuName[arrCnt] = "";
		}
		arrCnt--;
	}

	if (id != null) {
		arrMenuName[menulevel] = id;
		if(id == 'kundenServiceDropdown')
			shiftto(elem, getleft(from)+SearchBar_shiftWidth-200, gettop(from)+getheight(from)+SearchBar_shiftTop, moveYPosition);
		else
			shiftto(elem, getleft(from)+SearchBar_shiftWidth, gettop(from)+getheight(from)+SearchBar_shiftTop, moveYPosition);
		elemstyle = getelementstyle(id);
		elemstyle.visibility=setshow();
}	}
function menuDropPopdownLevel2(menulevel, from,menuName,lang,picName) {
	window.clearTimeout(menutimeoutNew);
	eval("document['"+menuName+"'].src = '/customcf/pics/"+lang+"/"+picName+".gif';");
	SearchBar_menuitemout(from);
	hideMenuDisp=true;
	menutimeout = window.setTimeout("hidemenuNew("+menulevel+")", closeTime);
}
function menuDropPopdown(menulevel, from,menuName,lang,picName) {
	//menuitemout(from);
	window.clearTimeout(menutimeoutNew);
	eval("document['"+menuName+"'].src = '/customcf/pics/"+lang+"/"+picName+".gif';");
	hideMenuDisp=true;
	menutimeout = window.setTimeout("hidemenuNew("+menulevel+")", closeTime);
}
function hidemenuNew(menulevel) {
  if (hideMenuDisp) {
    var arrCnt = arrMenuName.length-1;
    while (arrCnt >= 0) {
      if (getelement(arrMenuName[arrCnt]) != null) {
        elemstyle = getelementstyle(arrMenuName[arrCnt]);
        elemstyle.visibility=sethide();
        arrMenuName[arrCnt] = "";
      }
      arrCnt--;
    }
  }
}
