var isDOM = (document.getElementById ? true : false); 
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);

var nsArray = new Array();

function getRef(id) {
if (isDOM) return document.getElementById(id);
if (isIE4) return document.all[id];
if (isNS4) return document.layers[id];
}
function getSty(id) {
return (isNS4 ? getRef(id) : getRef(id).style);
} 

//function dbgclr() {
//document.frm.dbg.value = '';
//}

function dbg(txt) {
document.frm.dbg.value = document.frm.dbg.value + '\n' + txt
}

function popup(target) {
  exWin = window.open(target,"Draegerwerke","width=400,height=300,left=0,top=0, scrollbars=yes");
  exWin.focus();
}

function popupPure(target) {
  exWin = window.open(target,"Draegerwerke","width=400,height=300,left=0,top=0,scrollbars=yes,menubar=no");
  exWin.focus();
}

function popupZoom(target) {
  exWin = window.open(target,"Draegerwerke","width=400,height=400,left=0,top=0,scrollbars=no,menubar=no");
  exWin.focus();
}

// Hide timeout.
var popTimer = 0;
// Array showing highlighted menu items.
var litNow = new Array();
var litNowL = new Array();
var litNowLT = new Array();
var selectedItem = new Array();
var selectedItemL = new Array();

function findPosX(obj)
{

	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}


// *** MENU CONSTRUCTION FUNCTIONS ***

function Menu(isVert, popInd, x, y, width, overCol, backCol, borderClass, textClass) {
// True or false - a vertical menu?
this.isVert = isVert;
// The popout indicator used (if any) for this menu.
this.popInd = popInd
// Position and size settings.
this.x = x;
this.y = y;
this.width = width;
// Colours of menu and items.
this.overCol = overCol;
this.backCol = backCol;
// The stylesheet class used for item borders and the text within items.
this.borderClass = borderClass;
this.textClass = textClass;
// Parent menu and item numbers, indexed later.
this.parentMenu = null;
this.parentItem = null;
// Reference to the object's style properties (set later).
this.ref = null;
// Menu object to get Height/width
this.obj=null;
}

function Item(text, href, frame, length, spacing, target) {
this.text = text;
this.href = href;
this.frame = frame;
this.length = length;
this.spacing = spacing;
this.target = target;
// Reference to the object's style properties (set later).
this.ref = null;
this.reftd = null;
}

