
var aAllHideObjects	= new Array();
var aAllMenus			= new Array();
var bReleaseMenus		= false;
var bMenuAutoAssign	= false;
var iMenuCloseDelay	= 0;
var oMenuCloseTimer	= null;
var iMenuPageStartX	= 0;
var iMenuPageStartY	= 0;
var iMenuContentX		= 0;
var iMenuContentY		= 0;
var sLastSubmenu		= "";

// er flyttet til lib/new_js.asp
//window.onload	= _unlockLayerMenus;
//window.onresize	= _recalculateMenus;


// --- -----------------------------------------------------------------------
// --- User functions
// --- -----------------------------------------------------------------------

function setMenuDelay(iDelay) {
	// User-definable delay before closing menus.
	//
	// iDelay == 0 : Close menus immediately.
	// iDelay >= 1 : Wait specified number of milliseconds before closing menus

	iMenuCloseDelay = iDelay;
}


function setContentDimensions(iX, iY) {
	// UPDATE: This function is obsolete if used with the CMS. Set dimensions 
	//         with setLayoutDimensions() in functionpublic.js instead.

	// If specified, the popup menus will be offset to adjust for variations
	// in screen width and height. The offset will be added to any specified
	// x/y coordinates on the showLayerMenu calls.

	// Specify zero (0) if the contents have no specific width or height.
	
	iMenuContentX = iX;
	iMenuContentY = iY;
}


function setMenuAutoAssign(bMode) {
	// If specified, all registered menus will be parsed and have events
	// attached to cells. Cells must be of type DIV and have
	// the "lmcell" attribute != null.
	
	bMenuAutoAssign = bMode;
}


function showLayerMenu(sName) {
	// Show menu, referenced by its name. Additional arguments dictates:
	// - location on screen, (x-coordinate first, then y)
	// - popup relative to (0: nothing, 1: pointer, 2: trigger (OBSOLETE), this: trigger)
	// - popup on pointer (0: offset SE, 1: offset NW, 2: offset NE, 3: offset SW, 4: center).
	// - popup transition (0: none, 1: reveal)

	// Example: showLayerMenu('divMenu1', 100, 50);
	// Example: showLayerMenu('divMenu1', 8, 16, 2, 2);
	// Example: showLayerMenu('divMenu1', 0, 12, this);

	if (!bReleaseMenus)
		return;
	
	_closeMenus();
	_displayHideObjects(false);

	if ((oStyle = getStyle(sName)) != null) {
		var iPageOffsetX = iMenuPageStartX;
		var iPageOffsetY = iMenuPageStartY;

		if (arguments.length > 1)
			iPageOffsetX = iPageOffsetX + arguments[1];

		if (arguments.length > 2)
			iPageOffsetY = iPageOffsetY + arguments[2];

		if (arguments.length > 3) {
			
			if (typeof arguments[3] == "number") {
				// Keyword: number
				switch (arguments[3]) {
					case 1: // Offset to pointer	
						iPageOffsetX = arguments[1] + getMouseX();
						iPageOffsetY = arguments[2] + getMouseY();
					break;

					case 2: // Offset to trigger object
						if (isNetscape4()) {
							iPageOffsetX = arguments[1] + getMouseX();
							iPageOffsetY = arguments[2] + getMouseY();
						} else {
							iPageOffsetX = arguments[1] + getAbsoluteLeft(event.srcElement);
							iPageOffsetY = arguments[2] + getAbsoluteTop(event.srcElement);
						}
					break;

					default: // No relative offset
				}
			} else {
				// Keyword: this (object)
				if (isNetscape4()) {
					iPageOffsetX = arguments[1] + getMouseX();
					iPageOffsetY = arguments[2] + getMouseY();
				} else {
					iPageOffsetX = new Number(arguments[1]) + new Number(getAbsoluteLeft(arguments[3]));
					iPageOffsetY = new Number(arguments[2]) + new Number(getAbsoluteTop(arguments[3]));
				}
			}
		}

		if (arguments.length > 4) {
			var iPX, iPY, iMHeight, iMWidth = 0;
			if ((oLayer = getElementByIdNew(sName)) != null) {
				iMHeight = getElementHeight(oLayer);
				iMWidth = getElementWidth(oLayer);
			}

			switch (arguments[4]) {
				case 1: // offset NW
					iPageOffsetX = iPageOffsetX + (iMWidth * -1);
					iPageOffsetY = iPageOffsetY + (iMHeight * -1);
				break;

				case 2: // offset NE
					iPageOffsetY = iPageOffsetY + (iMHeight * -1);
				break;

				case 3: // offset SW
					iPageOffsetX = iPageOffsetX + (iMWidth * -1);
				break;

				case 4: // Center
					iPageOffsetX = iPageOffsetX + (Math.round(iMWidth / 2) * -1);
					iPageOffsetY = iPageOffsetY + (Math.round(iMHeight / 2) * -1);
				break;

				default: // offset SE
			}
		}

		if (arguments.length > 5) {
			oMam = getElementByIdNew(sName);
			oMam.style.overflow = 'hidden';
			oMam.style.height = 5;
		}

		// Remember arguments used to show the layer-menu
		if ((oTemp = getElementByIdNew(sName)) != null) {
			if (arguments.length > 3)
				oTemp._popuprelative = arguments[3];
			if (arguments.length > 4)
				oTemp._popuppointer = arguments[4];
			if (arguments.length > 5)
				oTemp._popuptransition = arguments[5];
			oTemp._popupAsSubmenu = false;
		}

		oStyle.left = iPageOffsetX;
		oStyle.top = iPageOffsetY;

		oStyle.visibility = (isNetscape4()) ? "show" : "visible";
	}
}


function showSubmenu(sName, oTriggerCell) {
	if (!bReleaseMenus)
		return;

	_displayHideObjects(false);
	
	if ((oStyle = getStyle(sName)) != null) {
		var subX = getAbsoluteLeft(oTriggerCell) + Math.round(getElementWidth(oTriggerCell) - getElementWidth(oTriggerCell) / 3);
		var subY = getAbsoluteTop(oTriggerCell) + getElementHeight(oTriggerCell) - 7;
		
		if ((oTemp = getElementByIdNew(sName)) != null)
			oTemp._popupAsSubmenu = true;

		oStyle.left = subX;
		oStyle.top = subY;
		
		oStyle.visibility = (isNetscape4()) ? "show" : "visible";
	}
}


function holdLayerMenus() {
	_cancelMenuTimeout();
}


function hideLayerMenus() {
	if (!bReleaseMenus)
		return;

	if (iMenuCloseDelay > 0) {
		_cancelMenuTimeout();
		oMenuCloseTimer = setTimeout("_closeMenus();", iMenuCloseDelay);
	} else {
		_closeMenus();
	}
}


function registerLayerMenu(sName) {
	// Register a layer menu by its name/id
	var i = 0;

	while (aAllMenus[i] != null)
		i++;

	aAllMenus[i] = sName;
}


function registerHideObject(sName) {
	// Register an object that must be hidden when a layermenu is open.
	var i = 0;
	
	while (aAllHideObjects[i] != null)
		i++;
		
	aAllHideObjects[i] = sName;
}


function openLink(sUrl, sPrivData) {
	if (sPrivData != "") {
		if (sPrivData != "_blank") {
			openPopupwindow(sUrl, sPrivData);
		} else {
			window.open(sUrl)
		}
	} else {
		location.href = sUrl;
	}
}


function lockMenus() {
	bReleaseMenus	= false;
}


function unlockMenus() {
	if (!bReleaseMenus) {
		bReleaseMenus	= true;
		_closeMenus();
	} else {
		bReleaseMenus = false;
	}
}


// --- -----------------------------------------------------------------------
// --- Internal functions
// --- -----------------------------------------------------------------------

function _closeMenus() {
	// Immediately closes all open layer menus

	_cancelMenuTimeout();
	_displayHideObjects(true);

	for (var i = 0; i < aAllMenus.length; i++) {
		if ((oStyle = getStyle(aAllMenus[i])) != null) {
			oStyle.visibility = (isNetscape4())?"hide":"hidden";
		}
	}
}


function _cancelMenuTimeout() {
	// Cancels a timed request to close any open layer menus, effectively
	// holding them open indefinitely.

	if (oMenuCloseTimer != null) {
		clearTimeout(oMenuCloseTimer);
		oMenuCloseTimer = null;
	}
}


function _unlockLayerMenus() {
	// Unlock the layer menus
	var oTemp;
	bReleaseMenus = true;

	// Check if contentdimensions are set in functionpublic.js
	if ((_pagelayoutWidth != null) && (_pagelayoutHeight != null)) {
		iMenuContentX = _pagelayoutWidth;
		iMenuContentY = _pagelayoutHeight;
	}

	for (var i = 0; i < aAllMenus.length; i++) {
		if ((oTemp = getElementByIdNew(aAllMenus[i])) != null) {
			oTemp.onmouseover = _cancelMenuTimeout;
			oTemp.onmouseout = hideLayerMenus;

			if (bMenuAutoAssign) {

				if (!isExplorer4() && !isNetscape()) {
					for (var j = 0; j < oTemp.all.length; j++)
						if ((oTemp.all[j].tagName == "DIV") && (oTemp.all[j].LMCELL != null)) {
							oTemp.all[j].onmouseover = _lmOnMouseOver;
							oTemp.all[j].onmouseout = _lmOnMouseOut;
						}

				} else if (!isExplorer4() && !isNetscape4()) {
					var oTableRows = oTemp.childNodes[0].rows;
					for (var j = 0; j < oTableRows.length; j++) {
						var oFindDiv = oTableRows[j].childNodes[0];
						if (oFindDiv.childNodes[0] != null)
							if ((oFindDiv = oFindDiv.childNodes[0]) != null)
								if ((oFindDiv.tagName == "DIV") && (oFindDiv.getAttribute("lmcell").length > 0)) {
									oFindDiv.onmouseover = _lmOnMouseOver;
									oFindDiv.onmouseout = _lmOnMouseOut;
								}
					}
				}
				
			} // END bMenuAutoAssign
		}
	}

	_closeMenus();
	_recalculateMenus();
}


function _recalculateMenus() {
	var iExcessWidth	= (iMenuContentX >= getDocumentWidth())? 0 : getDocumentWidth() - iMenuContentX;
	var iExcessHeight	= (iMenuContentY >= getDocumentHeight())? 0 : getDocumentHeight() - iMenuContentY;

	// Values are subtracted by 0.25, to ensure correct rounding
	if (iMenuContentX > 0) {
		iMenuPageStartX = (iExcessWidth == 0) ? 0 : Math.round((iExcessWidth / 2) - 0.25);
	}

	if (iMenuContentY > 0) {
		iMenuPageStartY = (iExcessHeight == 0) ? 0 : Math.round((iExcessHeight / 2) - 0.25);
	}
}


function getLayerFromCell(oCell) {
	// Returns the base menu layer (DIV) that holds
	// the specified [object] oCell, as an [object].
	var oNode = oCell.parentNode;
	while ((oNode != null) && (oNode.tagName != "DIV"))
		oNode = oNode.parentNode;
		
	return oNode;
}


function closeSubmenus(oLayer) {
	// Closes any and all SUBMENUS that have sprung
	// from a cell, held by the specified menu-layer.
	
	if (oLayer == null)
		return;

	// Check if this layer has any open submenus.
	if ((oLayer._submenuOpen != undefined) && (oLayer._submenuOpen != null))
		closeSubmenus(oLayer._submenuOpen);

	// Close this layer.
	oLayer.style.visibility = (isNetscape4()) ? "hide" : "hidden";
	oLayer._submenuOpen = null;
}


function _lmOnMouseOver() {
	
	//Midlertidig insat pga. "kort info" funktion på forsiden af unique-ts.dk
	if("518ve" == "250un" && "pagelayout002.asp" == "pagelayout001.asp"){
		showPageInfo(this.getAttribute("ID"));
		}
	
	if (isNetscape4())
		return;

	var oMenuLayer = null;
	
	if (this._rollover3 == null) {
		if (oMenuLayer == null)
			oMenuLayer = getLayerFromCell(this);

		if (oMenuLayer != null) {
			this._rollover3 = oMenuLayer.getAttribute("autorollover").split(";")[0];
			this._rollover4 = oMenuLayer.getAttribute("autorollover").split(";")[1];
		}
	}

	if (this._rollover1 == null) {
		this._rollover1 = this.style.backgroundColor;
		this._rollover2 = this.style.color;
	}

	this.style.backgroundColor = this._rollover3;
	this.style.color = this._rollover4;

	if (DOMAvailable()) {
		// We've just moved onto a menu-cell. Check if the layer containing the
		// cell has any submenus open and recursively close them if so.
		
		if (oMenuLayer == null)
			oMenuLayer = getLayerFromCell(this);
		
		if (oMenuLayer != null)
			if ((oMenuLayer._submenuOpen != undefined) && (oMenuLayer._submenuOpen != null))
				closeSubmenus(oMenuLayer._submenuOpen);

	}


	if (this.LMSUB != undefined) {
		// Current menu-cell must open a submenu on rollover.
		if (DOMAvailable()) {
			if ((oTemp = document.getElementById(this.LMSUB)) != null) {
				showSubmenu(this.LMSUB, this);

				// The layer contanining the cell that just opened a submenu, must
				// remember the ID of that submenu.
				if (oMenuLayer == null)
					oMenuLayer = getLayerFromCell(this);

				if (oMenuLayer != null)
					oMenuLayer._submenuOpen = oTemp;
			}
		}
	}
}


function _lmOnMouseOut() {
	if (isNetscape4())
		return;
		
	this.style.backgroundColor = this._rollover1;
	this.style.color = this._rollover2;
}


function _displayHideObjects(bShow) {
	for (var i = 0; i < aAllHideObjects.length; i++) {
		if ((oStyle = getStyle(aAllHideObjects[i])) != null)
			if (bShow)
				oStyle.visibility = (isNetscape4()) ? "show" : "visible"
			else
				oStyle.visibility = (isNetscape4()) ? "hide" : "hidden"
	}
}

var platform		= navigator.platform;
var browser			= navigator.appName;
var version			= navigator.appVersion;
var agent			= navigator.userAgent;
var idbrowser		= "iepc";

// This part is obsolete - left in to support old sites.
if (platform=="MacPPC") {
	if (browser=="Microsoft Internet Explorer") {
		if (version=="4.0 (compatible; MSIE 5.0; Macintosh; I; PPC)") { idbrowser = "iepc" }
		else { idbrowser = "iemac" }
	}
	if (browser=="Netscape") { idbrowser = "nsmac" }
}

if (platform=="Win32") {
	if (browser=="Microsoft Internet Explorer") { idbrowser = "iepc" }
	if (browser=="Netscape") { idbrowser = "nspc" }
}

var id = idbrowser;



function DOMAvailable() {
	return (document.getElementById ? true : false);
}

function isNetscape() {
	if (browser.toLowerCase().indexOf("netscape") != -1)
		return true
	else
		return isGecko();
}

function isNetscape4() {
	return (isNetscape() && !DOMAvailable());
}

function isExplorer() {
	return ((browser == "Microsoft Internet Explorer") && (!isOpera()));
}

function isExplorer4() {
	return (isExplorer() && !DOMAvailable())
}

function isOpera() {
	return (agent.toLowerCase().indexOf("opera", 0) != -1);
}

function isGecko() {
	return (agent.toLowerCase().indexOf("gecko") != -1);
}

function isMac() {
	return (platform == "MacPPC");
}

function isPC() {
	return (platform == "Win32");
}

function isDynamic() {
	return (DOMAvailable() || isExplorer4() || isNetscape())
}



function getBrowserVersion() {
	var sVersion = "6";
	
	if (isOpera()) {
		iStart = agent.toLowerCase().indexOf("opera") + 6;
		iEnd = iStart + 3;
		sVersion = agent.substr(iStart, (iEnd - iStart));
		
	} else if (isExplorer()) {
		iStart = version.indexOf("MSIE") + 5;
		iEnd = version.indexOf(";",iStart);
		sVersion = version.substr(iStart, (iEnd - iStart));

	} else if (isNetscape()) {
		if (isNetscape4()) {
			iEnd = version.toLowerCase().indexOf(" ");
			sVersion = version.substr(0, iEnd);

		} else {
			iStart = agent.toLowerCase().indexOf("netscape");
			iStart = agent.toLowerCase().indexOf("/", iStart) + 1;
			iEnd = ((iStart + 3) < agent.length) ? (iStart + 3) : agent.length;
			sVersion = agent.substr(iStart, (iEnd - iStart));
		}

	} else {
		// Grasp blindly for a version string
		sVersion = version.substr(0, 2);
	}

	if (isNaN(new Number(sVersion))) {
		// If nothing works, assume we're on MSIE6.0
		return new Number("6");
	} else {
		return new Number(sVersion);
	}
}



// --- -----------------------------------------------------------------------
// --- Layout dimension functions
// --- -----------------------------------------------------------------------

var _pagelayoutWidth, _pagelayoutHeight = 0;

function setLayoutDimensions(iWidth, iHeight) {
	_pagelayoutWidth = new Number(iWidth);
	_pagelayoutHeight = new Number(iHeight);
}


function getLayoutTop() {
	if (_pagelayoutHeight >= 0)
		return Math.round((getDocumentHeight() - _pagelayoutHeight) / 2)
	else
		return 1;
}


function getLayoutLeft() {
	if (_pagelayoutWidth >= 0)
		return Math.round((getDocumentWidth() - _pagelayoutWidth) / 2)
	else
		return 1;
}


function positionLayer(sName, iPosX, iPosY) {
	var oTemp = getStyle(sName);
	if (oTemp != null) {
		oTemp.left = (getLayoutLeft() + iPosX);
		oTemp.top = (getLayoutTop() + iPosY);
	}
}


function setElementVisible(sName, bVisible) {
	var oTemp = getStyle(sName);
	if (oTemp != null)
		if (bVisible)
			oTemp.visibility = (isNetscape4()) ? "show" : "visible"
		else
			oTemp.visibility = (isNetscape4()) ? "hide" : "hidden"
}



// --- -----------------------------------------------------------------------
// --- Netscape compatible mouse location reader
// --- 
// --- Use getMouseX() and getMouseY() to retrieve coordinates.
// ---
// --- Compatibility:
// --- IE4		Unconfirmed
// --- IE4.5+	OK
// --- NS4		OK
// --- NS6		OK
// --- Opera	Unconfirmed
// --- -----------------------------------------------------------------------

var _iMouseX, _iMouseY = 0;
var _oMouseT = null;

if (isNetscape()) {
	document.captureEvents(Event.MOUSEMOVE)
}

document.onmousemove = _updateMouseLocation;

function _updateMouseLocation(e) {
	if (isNetscape()) {
		_iMouseX = e.pageX;
		_iMouseY = e.pageY;
		if (e.target.tagName != null)
			_oMouseT = e.target;
	} else {
		_iMouseX = (event.clientX + document.body.scrollLeft);
		_iMouseY = (event.clientY + document.body.scrollTop);
		_oMouseT = event.srcElement;
	}
}



// --- -----------------------------------------------------------------------
// --- Info retrieval functions
// --- -----------------------------------------------------------------------

function getDocumentHeight() {
	if (isOpera())
		return window.innerHeight;
	else if (isNetscape())
		return window.innerHeight;
	else
		return document.body.clientHeight;
}


function getDocumentWidth() {
	if (isOpera())
		return window.innerWidth;
	else if (isNetscape())
		return window.innerWidth;
	else
		return document.body.clientWidth;
}



function getDocumentFullHeight() {
	if (isNetscape4()) {
		return window.innerHeight + window.pageYOffset;
	} else if (isGecko()) {
		return window.innerHeight + window.pageYOffset;
	} else {
		return document.body.offsetHeight;
	}
}


function getDocumentFullWidth() {
	if (isNetscape4()) {
		return window.innerWidth + window.pageXOffset;
	} else if (isGecko()) {
		return window.innerWidth + window.pageXOffset;
	} else {
		return document.body.offsetWidth;
	}
}



function getScreenHeight() {
	return screen.height;
}


function getScreenWidth() {
	return screen.width;
}



function getScreenDepth() {
	return screen.colorDepth;
}



function getAbsoluteTop(elem) {
	var topPosition = 0;

	while (elem) {
		if (elem.tagName == 'BODY')
			break;
		topPosition += elem.offsetTop;
		elem = elem.offsetParent;
	}
	return topPosition;
}

function getAbsoluteLeft(elem) {
	var leftPosition = 0;

	while (elem) {
		if (elem.tagName == 'BODY')
			break;
		leftPosition += elem.offsetLeft;
		elem = elem.offsetParent;
	}
	return leftPosition;
}

function getElementWidth(oElement) {
	if (isNetscape())
		return (DOMAvailable()) ? oElement.offsetWidth : oElement.document.width;
	else
		return oElement.clientWidth;
}

function getElementHeight(oElement) {
	if (isNetscape()) {
		return (DOMAvailable()) ? oElement.offsetHeight : oElement.document.height;
	} else {
		return oElement.clientHeight;
	}
}



function getMouseX() {
	return _iMouseX;
}

function getMouseY() {
	return _iMouseY;
}

function getElementUnderMouse() {
	return _oMouseT;
}



// --- -----------------------------------------------------------------------
// --- Document object functions
// --- -----------------------------------------------------------------------

function getElementByIdNew(sName) {
	if (DOMAvailable())
		return document.getElementById(sName);

	if (isExplorer4())
		return document.all[sName];

	if (isNetscape4())
		return document.layers[sName];

	return null;
}



function getStyle(sName) {
	if (isNetscape4())
		return getElementByIdNew(sName);
	else
		if ((oTemp = getElementByIdNew(sName)) != null)
			return getElementByIdNew(sName).style
		else
			return null;
} 



// --- -----------------------------------------------------------------------
// --- Window popup functions
// --- -----------------------------------------------------------------------

function openPopupwindow(sUrl, sPrivData) {
	var iWidth = 350;
	var iHeight = 250;
	var sScroll, sResize, sStatus, sMenu, sToolbar = "no";

	if (sPrivData.length > 0) {
		var aPrivData = sPrivData.split(";");
		for (var i = 0; i < aPrivData.length; i++)
			switch (aPrivData[i].split(":")[0]) {
				case "width":		iWidth	= new Number(aPrivData[i].split(":")[1]); break;
				case "height":		iHeight	= new Number(aPrivData[i].split(":")[1]); break;
				case "scroll":		sScroll	= "yes"; break;
				case "resize":		sResize	= "yes"; break;
				case "status":		sStatus	= "yes"; break;
				case "menu":		sMenu		= "yes"; break;
				case "toolbar":	sToolbar	= "yes"; break;
			}
	}
	openPopupFull(sUrl, "", iWidth, iHeight, 16, 16, sScroll, sResize, sStatus, sMenu, sToolbar, "no")
}



function openPopupFull(popUrl, winName, width, height, top, left, scrollbars, resizable, status, menubar, toolbar, directories) {
	switch (id) {
		case "iepc":
			winWidth = (width + 16);
			break;
		case "iemac":
			winWidth = (width + 20);
			break;
		case "nspc":
			winWidth = (width + 4);
			break;
		case "nsmac":
			winWidth = (width + 4);
			break;
		default:
			winWidth = width;
	}

	winWidth		= "width=" + winWidth;
	winHeight		= "height=" + height;
	winTop			= "top=" + top;
	winLeft			= "left=" + left;
	winScrollbars	= (scrollbars == "yes") ? ",scrollbars=" + scrollbars : "";
	winResizable	= (resizable == "yes") ? ",resizable=" + resizable : "";
	winStatus		= (status == "yes") ? ",status=" + status : "";
	winMenubar		= (menubar == "yes") ? ",menubar=" + menubar : "";
	winToolbar		= (toolbar == "yes") ? ",toolbar=" + toolbar : "";
	winDirectories	= (directories == "yes") ? ",directories=" + directories : "";

	arguments = winWidth + "," + winHeight + "," + winTop + "," + winLeft + winScrollbars + winResizable + winStatus + winMenubar + winToolbar + winDirectories;

	window.open(popUrl,winName,arguments);
}


// --- -----------------------------------------------------------------------
// --- Cookie-related functions
// --- -----------------------------------------------------------------------

function getCookie(Name) {
	var search = Name + "=";

	if (document.cookie.length > 0) {
		// if there are any cookies
		offset = document.cookie.indexOf(search);

		if (offset != -1) {
			// if cookie exists
			offset += search.length;

			// set index of beginning of value
			end = document.cookie.indexOf(";", offset);

			// set index of end of cookie value
			if (end == -1)
				end = document.cookie.length;
			return unescape(document.cookie.substring(offset, end));
		}
	}
}


function setCookie(sName, sValue) {
	document.cookie = "@" + sName + "=" + sValue;
}



// --- -----------------------------------------------------------------------
// --- Form and Input tools
// --- -----------------------------------------------------------------------

function inputPermitNumeric() {
	oEvent	= event;
	oInput	= oEvent.srcElement;

	if ((oEvent.keyCode >= 48) && (oEvent.keyCode <= 57)) {
	} else {
		oEvent.returnValue = false;
		return;
	}
}



function inputPermitAlphanumeric() {
	oEvent	= event;
	oInput	= oEvent.srcElement;

	if (((oEvent.keyCode >= 48) && (oEvent.keyCode <= 57))
		|| ((oEvent.keyCode >= 97) && (oEvent.keyCode <= 102))
		|| ((oEvent.keyCode >= 65) && (oEvent.keyCode <= 70))) {
	} else {
		oEvent.returnValue = false;
		return;
	}
}



// - CensorWord filter
//var swear_words_arr=new Array("hi","hello","cheers"); 
var swear_alert_arr=new Array(); 
var swear_alert_count=0; 

function reset_alert_count() { 
	swear_alert_count=0; 
} 

function wordFilter(form,fields,censoredwords) { 
	reset_alert_count(); 
	var compare_text; 
		
	for(var i=0; i<fields.length; i++) {
		eval('compare_text=document.' + form + '.' + fields[i] + '.value;');
		var arrCompareWords = compare_text.split(' ');
		for(var j=0; j<arrCompareWords.length; j++) {
			var compareWord = arrCompareWords[j]
			for(var k=0; k<censoredwords.length; k++){
				//alert(compareWord.toLowerCase() + ":" + censoredwords[k].toLowerCase());
				if(compareWord.toLowerCase() == censoredwords[k].toLowerCase()){
					swear_alert_count++;
				}
			}
		}
	}
	
	if(swear_alert_count > 0){
		alert("Der optræder " + swear_alert_count + " ord i teksten, som ikke er tilladt.");
		return false;
	}else{
		return true;
	}
}

//Function to show/hide tablerow
function toggleTR(target) {
	obj=(document.all) ? document.all[target] : document.getElementById(target);
    obj.style.display=(obj.style.display=='none') ? 'inline' : 'none';
}

//Function to toggle 2 pieces of graphic
function toggleImage(name) {
	filename = document.images[name].src;
	if(filename.indexOf("_r0") >= 0){
		newfilename = filename.replace(/_r0./gi, '_r1.');
		document.images[name].src = newfilename;
	}else{
		newfilename = filename.replace(/_r1./gi, '_r0.');
		document.images[name].src = newfilename;
	}
}
setLayoutDimensions(794,-1);
setMenuDelay(750);
setMenuAutoAssign(true);


function onOver(name) {
	filename = document.images[name].src;
	newfilename = filename.replace(/_r0./gi, '_r1.');
	document.images[name].src = newfilename;
}

function onOut(name) {
	filename = document.images[name].src;
	newfilename = filename.replace(/_r1./gi, '_r0.');
	document.images[name].src = newfilename;
}

function preload() {
	var d=document;
	if (d.images) {
		var j = 0;
		if (!d.preimgs)
			d.preimgs = new Array();
		for (i=0; i<d.images.length; i++) {
			str = d.images[i].src;
			if (str.search('_r0.') != -1) {
				d.preimgs[j]       = new Image;
				d.preimgs[j++].src = str;
				filename = str.replace(/_r0./gi, '_r1.');
				d.preimgs[j]       = new Image;
				d.preimgs[j++].src = filename;
			}
		}
	}
}

function _onLoad() {
	_unlockLayerMenus();
	preload();
	
	// render popup if set in pageproperties
	if('' == 'y' && '' != '') {
		var str_link = '';
		var str_linktype = '';
		var str_target = '';
		var int_targetLength = 0;
		
		// it´s a external link, so there has to be http:// before URL
		if(str_linktype.indexOf("archive") == 0){
			str_link = 'http://' + str_link;
		}
		
		if(str_target.indexOf("_blank") == 0) {
			window.open(str_link,'popUpWindow');
		} else {
			str_target = str_target.replace(/:/g,"=");
			str_target = str_target.replace(/;/g,",");
			targetLength = str_target.length - 1;
			str_target = str_target.substr(0,targetLength);
			window.open(str_link,'popUpWindow',str_target);
		}
		
	}

}

function _onResize() {
	_recalculateMenus();
	location.href=location.href;

}

window.onload = _onLoad;
window.onresize = _onResize;