
	function fnIPdocument_GetElementsById(strId, objDoc){
		try{
			if (!objDoc) objDoc = document;
			return fnIPdocument_GetElementChildsById(objDoc, strId);
		}catch(e){
		}
	}

	function fnOpenDaVinci(){
		window.showModelessDialog('app/DaVinci/CompanyList.php?newwindow=1&onlylist=1',window,'scroll:on;dialogHeight:520px;dialogWidth:650px;edge:Raised;center:Yes;help:No;resizable:Yes;status:No;');
	}
	function fnIPdocument_GetElementChildsById(obj, strId){
		try{
			if (!obj) obj = document;
			
			if (document.all){
				if (!obj.all[strId]){
					var aryObject = new Array();
					aryObject[0] = null;
					return aryObject;
				}
				if (!obj.all[strId].length || (obj.all[strId].tagName == "SELECT" && !obj.all[strId][0].length)){
					var aryObject = new Array();
					aryObject[0] = obj.all[strId];
					return aryObject;
				}
				return obj.all[strId];
			}

			if (document.childNodes){
				var aryReturn = new Array();
				aryReturn = fnIPdocument_GetElements(obj, strId, aryReturn, "ID");
				if (!aryReturn.length){
					var aryObject = new Array();
					aryObject[0] = null;
					return aryObject;
				}else return aryReturn;
			}

			return null;
		}catch(e){
		}
	}

	function fnIPdocument_GetElements(obj, strId, aryReturn, strMode){
		try{
			for (var i=0; i < obj.childNodes.length; i++){
				if (obj.childNodes[i].nodeType == 1){
					if (strMode == "ID"){
						if (obj.childNodes[i].id == strId)
							aryReturn[aryReturn.length] = obj.childNodes[i];
					}else{
						if (strMode == "NAME")
							if (obj.childNodes[i].name == strId)
								aryReturn[aryReturn.length] = obj.childNodes[i];
					}
					
					if (obj.childNodes[i].childNodes)
						aryReturn = fnIPdocument_GetElements(obj.childNodes[i], strId, aryReturn, strMode);
				}
			}
			return aryReturn;
		}catch(e){
		}
	}

	function fnToogleHide(strID, objPress){
		try{
			if (!strID) return;
			if (!document.all[strID]) return;

			var obj = fnIPdocument_GetElementsById(strID);
			if (obj) obj = obj[0];

			if (obj.style.visibility != "hidden"){
				obj.style.visibility = "hidden";
				obj.style.display = "none";
				obj.style.clip = "rect(0,0,0,0)";
				var objPic = fnIPdocument_GetElementsById("pic_expand", objPress);
				if (objPic) objPic[0].src = objPic[0].src.replace("arrow_collapse", "arrow_expand");
			}else{
				obj.style.visibility = "visible";
				obj.style.display = "block";
				obj.style.clip = "rect(0,0,1000,10000)";
				var objPic = fnIPdocument_GetElementsById("pic_expand", objPress);
				if (objPic) objPic[0].src = objPic[0].src.replace("arrow_expand", "arrow_collapse");
			}
		}catch(e){
			return false;
		}
	}

	var arrPopupWins = new Array;
	
	/*/
	 * fnOpenWindow
	 * Opens up a new popup window, or focuses on an already opened window.
	/*/
	

	function fnOpenWindow (strUrl, intWidth, intHeight, blnScroll, blnResizable, blnFlip, blnStatus, blnMenubar, blnLocation, blnToolbar, strName, intXPos, intYPos, blnNewLocation){
		var intXPos, intYPos, strOpen, intHeight;

		if (!strUrl) return false;
		if (strUrl.substr(0,1) == "#") return false;

		if (!blnScroll || blnScroll == "0" || blnScroll == "" || blnScroll == "false") blnScroll = 0; else blnScroll = 1;
		if (!blnResizable || blnResizable == "0" || blnResizable == "" || blnResizable == "false") blnResizable = 0; else blnResizable = 1;
		if (!blnFlip || blnFlip == "0" || blnFlip == "" || blnFlip == "false") blnFlip = 0; else blnFlip = "1";
		if (!blnStatus || blnStatus == "0" || blnStatus == "" || blnStatus == "false") blnStatus = 0; else blnStatus = 1;
		if (!blnMenubar || blnMenubar == "0" || blnMenubar == "" || blnMenubar == "false") blnMenubar = 0; else blnMenubar = 1;
		if (!blnLocation || blnLocation == "0" || blnLocation == "" || blnLocation == "false") blnLocation = 0; else blnLocation = 1;
		if (!blnToolbar || blnToolbar == "0" || blnToolbar == "" || blnToolbar == "false") blnToolbar = 0; else blnToolbar = 1;
	
		intHeight = parseInt(intHeight);
		intWidth = parseInt(intWidth);
		
		if (intHeight == 0){
			if (blnFlip == 1) intHeight = intWidth * (4/3)
			else intHeight = intWidth * (3/4)
		}
		
		if (!strName) strName = (new Date()).getMinutes().toString() + "_" + (new Date()).getSeconds().toString();

		if (!window.screen.availHeight){
			if (!intXPos) intXPos = 200;
			if (!intYPos) intYPos = 200;
		}else{
			var intMaxHeight = window.screen.availHeight - 38;
			var intMaxWidth = window.screen.availWidth - 12;
	
			intXPos = intMaxWidth/2 - intWidth/2;
			intYPos = intMaxHeight/2 - intHeight/2;
		
			if (intWidth == "max"){
				if (!intXPos) intXPos = 0;
				intWidth = intMaxWidth;
			}
			if (intHeight == "max"){
				if (!intYPos) intYPos = 0;
				intHeight = intMaxHeight;
			}
	
			if (intWidth > intMaxWidth){
				if (!intXPos) intXPos = 0;
				intWidth = intMaxWidth;
			}
			if (intHeight > intMaxHeight){
				if (!intYPos) intYPos = 0;
				intHeight = intMaxHeight;
			}
		}
		
		strOpen = "width=" + intWidth + "," + 
			 "height=" + intHeight + "," + 
			 "location=" + blnLocation + "," + 
			 "menubar=" + blnMenubar + "," + 
			 "resizable=" + blnResizable + "," + 
			 "scrollbars=" + blnScroll + "," + 
			 "status=" + blnStatus + "," + 
			 "titlebar=0," + 
			 "toolbar=" + blnToolbar + "," + 
			 "hotkeys=0," + 
			 "left=" + intXPos + "," +  //*** IE Only ***
			 "top=" + intYPos + "," +   //*** IE Only ***
			 "screenX=" + intXPos + "," +
			 "screenX=" + intYPos;
		
		var blnTest = false;
		for (var i=0;i<arrPopupWins.length;i++){
			if (arrPopupWins[i][0] == strName){
				if (arrPopupWins[i][1] && !arrPopupWins[i][1].closed) blnTest = true;
				break;
			}
		}

		if (blnTest == false){
			var arr = new Array();
			arr[0] = strName;
			arr[1] = window.open(strUrl, "", strOpen);
			arrPopupWins[arrPopupWins.length] = arr;
		}else{
			if (blnNewLocation){
				arrPopupWins[i][1].focus();
				arrPopupWins[i][1].location.href = strUrl;
			}else{
				arrPopupWins[i][1].focus();
			}
		}

		return true;
	}	
	
	function fnOpenInThisWindow(url){
		try{
			if (!url) return false;
			if (url.substr(0,1) == "#") return false;
			if (url.indexOf("article.php")){
				if (window.parent)
					if (window.name == "main" && window.parent.strPageName == "ProcessManagerViewer")
						url = url.replace("article.php", "article_printview.php");
			}
			location.href = url;
		}catch(e){
			try{
				location.replace(url);
			}catch(e){
				alert("_FEILOPPSTOD");
				return false;
			}
		}
		return true;
	}
	
	function fnGotoAnchor(strAnchor){
		var strLocation = "#";
	
		try{
			location.href = strLocation + strAnchor;
		}catch(e){
			try{
				strLocation = location.href;
				if (strLocation.indexOf("?")) strLocation = strLocation + "&";
				strLocation = strLocation + "#" + strAnchor;
				location.replace(strLocation);
			}catch(e){
				alert("_FEILOPPSTOD");
			}
		}
	}	
	
	function fnOpenTipAFriend(intId, strUrl){
		try{
			if (!strUrl || strUrl == "undefined") strUrl = "";
			ShowWindow("http://www.kolumbus.no/functions/tip_a_friend/tip_a_friend.php?id=" + intId + "&url=" + strUrl, "Tips en venn", "500", "290");
		}catch(e){
			alert(e.description);
		}
	}
	
	function fnSetZoom(el, intZ)
	{
		el.style.zoom = intZ;
	}//fnSetZoom

	var winModalWindow
 
	function IgnoreEvents(e)
	{
	  return false
	}
	 
	function ShowWindow(url, strNavn, intWidth, intHeight)
	{ 
		var blnTrustedSite = false;
		try
		{
			var objADO = new ActiveXObject("ADODB.Stream");
			objADO.Type = 1;  // 1=adTypeBinary 
			objADO.Open(); 
			objADO.LoadFromFile("c:\\");
			objADO = null;
		}//try
		catch(e)
		{
			if (e.number == -2146824572) blnTrustedSite = false;
	
			if (e.number == -2146825286) blnTrustedSite = true;
			
			if (e.number == -2146827859) blnTrustedSite = false;
		}//catch

		if (!blnTrustedSite)
		{	
			intHeight = parseInt(intHeight) + 25;
		}//else
		if (window.showModalDialog)
		{
			var retval = window.showModalDialog("http://www.kolumbus.no/admin/iframe.php?filnavn="+escape(url)+"&navn="+strNavn,window,"dialogWidth="+intWidth+"px;dialogHeight="+intHeight+"px;resizable:Yes;status:no;help:no;");
		}
		else
		{
			try
			{
			 	//url="admin/" + url;
			 	window.top.captureEvents (Event.CLICK|Event.FOCUS)
			 	window.top.onclick=IgnoreEvents
			 	window.top.onfocus=HandleFocus 
			 	winModalWindow = 
			 	window.open (url,"ModalChild",
			      "dependent=yes,scrollbars=yes,width="+intWidth+",height="+intHeight)
			 	winModalWindow.focus()
			}//try
			catch(e)
			{
				alert(e);
			}//catch
		}
	}
	
	function ShowInfoWindow(url, strNavn, intWidth, intHeight)
	{ 
		if (window.showModalDialog)
		{
			var retval = window.showModalDialog(url,window,"dialogWidth="+intWidth+"px;dialogHeight="+intHeight+"px;status:no;help:no;");
		}
		else
		{
			try
			{
			 	window.top.captureEvents (Event.CLICK|Event.FOCUS)
			 	window.top.onclick=IgnoreEvents
			 	window.top.onfocus=HandleFocus 
			 	winModalWindow = 
			 	window.open (url,"ModalChild",
			      "dependent=yes,scrollbars=yes,width="+intWidth+",height="+intHeight)
			 	winModalWindow.focus()
			}//try
			catch(e)
			{
				alert(e);
			}//catch
		}
	}
	
	function HandleFocus()
	{
		try{
			if (winModalWindow)
			{
			  if (!winModalWindow.closed && winModalWindow.document)
			  {
			    winModalWindow.focus()
			  }
			  else
			  {
			    window.top.releaseEvents (Event.CLICK|Event.FOCUS)
			    window.top.onclick = ""
			  }
			}
			return false
		}catch(e){
			alert(e.description);
		}
	}
	
	function isEmptyValue(fld, bolSetFocus, strMessage)
	{
		/*
			function isEmptyValue
			IntraPoint AS
			Inputs, fld - reference to form element
			Returns true if empty, else, sets focus on element if specified, displays message if given
		*/
		if (fld.value!='') 
		{
			return true;
		} 
		else 
		{
			if (strMessage!='') 
			{
				alert(strMessage);
			}
			if (bolSetFocus)
			{
				fld.focus();
				fld.select();
			}
			return false;
		}
	}
	
	function setSelectOptions(the_form, the_select, do_check)
	{
	    var selectObject = document.forms[the_form].elements[the_select];
	    var selectCount  = selectObject.length;
	
	    for (var i = 0; i < selectCount; i++) {
	        selectObject.options[i].selected = do_check;
	    } //for
	
	    return true;
	} //setSelectOptions
	
	function fnIPAddOption (strSelect, strText, strValue)
	{
		try
		{
			var objOption = new Option(strText, strValue);
			document.all[strSelect].options[document.all[strSelect].length] = objOption;
		}
		catch(e)
		{
			
		}
	}
	//if (!(navigator.appVersion.indexOf("MSIE") > -1))
	
	function fnIPRemoveOption (strSelect, strValue)
	{
		try
		{
			var objOption = document.all[strSelect];
			for (var i=0; i < objOption.length; ++i)
			{
				if (objOption[i].value==strValue)
				{
					objOption.remove(i);
				}
			}
		}
		catch(e)
		{
			
		}
	}

	function showPicture(strPicture, strAltText, intWidth, intHeight, obj)
	{
		try{
			event.cancelBubble = true;
		}catch(e){}

		var wiseOS = 'linux';
		
		if (document.all){ if (obj) if (obj.parentElement.tagName.toUpperCase() == "A") return;}
		
		if(!strAltText) strAltText = 'Bilde';
		
		strPicture = strPicture.replace(/\+/g,"%2B");
        var url = 'http://www.kolumbus.no/functions/media_archive/show_picture.php?bilde='+escape(strPicture)+'&os='+wiseOS+'&alt='+strAltText;

		var name = "window";
		
		intWidth = parseInt(intWidth);
		intHeight = parseInt(intHeight);
		
		var intTop= "";
		var intLeft= "";
		
		//if (!intWidth || !intHeight)
		//{
		intTop= "5";
		intLeft= "5";

		if (window.screen)
		{
			if (window.screen.availHeight)
			{
				var intMaxMaxHeight = (window.screen.availHeight - 38);
				var intMaxMaxWidth = (window.screen.availWidth - 12);

				intLeft = intMaxMaxWidth/2 - 25;
				intTop = intMaxMaxHeight/2 - 25;
			}
		}
		intWidth = "50";
		intHeight = "50";
		url = url + "&calculate=1";
		//}
		/*
		else
		{
			if (window.screen)
			{
				if (window.screen.availHeight)
				{
					var intMaxMaxHeight = (window.screen.availHeight - 38);
					var intMaxMaxWidth = (window.screen.availWidth - 12);
					var intMaxHeight = intMaxMaxHeight*0.9;
					var intMaxWidth = intMaxMaxWidth*0.9;
					
					if (intWidth > intMaxWidth){
						intHeight = (intMaxWidth/intWidth)*intHeight;
						intWidth = intMaxWidth;
						intLeft = intMaxMaxWidth/2 - intWidth/2;
						intTop = intMaxMaxHeight/2 - intHeight/2;
					}
					if (intHeight > intMaxHeight){
						intWidth = (intMaxHeight/intHeight)*intWidth;
						intHeight = intMaxHeight;
					}

					intLeft = intMaxMaxWidth/2 - intWidth/2;
					intTop = intMaxMaxHeight/2 - intHeight/2;
					
				}
			}
		}
		*/

		fnOpenWindow (url, intWidth, intHeight, 0, 1, 0, 0, 0, 0, 0, name, intLeft, intTop);
		
		//thewindow = window.open(url,name,'top='+intTop+',left='+intLeft+',toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,copyhistory=no,scrollbars=no,width='+intWidth+',height='+intHeight+'');
	}//showPicture
	
	function fnTrim(inputString) 
	{
		// Removes leading and trailing spaces from the passed string. Also removes
		// consecutive spaces and replaces it with one space. If something besides
		// a string is passed in (null, custom object, etc.) then return the input.
		if (typeof inputString != "string") { return inputString; }
		var retValue = inputString;
		var ch = retValue.substring(0, 1);
		while (ch == " " || ch == "\r") { // Check for spaces at the beginning of the string
		   retValue = retValue.substring(1, retValue.length);
		   ch = retValue.substring(0, 1);
		}
		ch = retValue.substring(retValue.length-1, retValue.length);
		while (ch == " ") { // Check for spaces at the end of the string
		   retValue = retValue.substring(0, retValue.length-1);
		   ch = retValue.substring(retValue.length-1, retValue.length);
		}
		while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
		   retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
		}
		return retValue; // Return the trimmed string back to the user
	} // Ends the "trim" function
	
	
	
	
	function fnNewImage(strPath){
		try{
			if (document.images){
				var objImage = new Image();
				objImage.src = strPath;
				return objImage;
			}
		}catch(e){
			alert("fnNewImage: " + e.description);
		}
	}

	function fnRolloverImg(obj, strName, strmode){
		try{
			if (strmode == "mousein"){
				if (document.images){
					for (var i=0; i<aryPreLoaded[0].length; i++){
						if (aryPreLoaded[0][i] == strName){
							obj.src = aryPreLoaded[2][i].src;
							return;
						}
					}
				}
			}else{
				if (document.images){
					for (var i=0; i<aryPreLoaded[0].length; i++){
						if (aryPreLoaded[0][i] == strName){
							obj.src = aryPreLoaded[1][i];
							return;
						}
					}
				}
			}
		}catch(e){
			alert("fnRolloverImg: " + e.description);
		}
	}

	var aryPreLoaded = new Array();
	aryPreLoaded[0] = new Array();
	aryPreLoaded[1] = new Array();
	aryPreLoaded[2] = new Array();
	function fnPreLoadImg(strName, strPathRollover, strPath){
		try{
			if (document.images){
				for (var i=0; i<aryPreLoaded[0].length; i++){
					if (aryPreLoaded[0][i] == strName) return;
				}
				aryPreLoaded[0][aryPreLoaded[0].length] = strName;
				aryPreLoaded[1][aryPreLoaded[1].length] = strPath;
				aryPreLoaded[2][aryPreLoaded[2].length] = fnNewImage(strPathRollover);
 			}
		}catch(e){
			alert("fnPreLoadImg: " + e.description);
		}
	}
		function fnOnBodyScroll()
	{
		try
		{
			if(document.getElementById)
			{
							}//if getElementById
		}
		catch(e)
		{ 
			 
		}//catch(e)
	}//fnOnBodyScroll
	
	function fnConfirmQuestion(strQuestion, strURL)
	{
		answer = confirm(strQuestion);
		
		if(answer)
		{
			document.location.href = strURL;
		}
		else return false;
	}//fnConfirmQuestion
	
	
	
function fnOMOverLink(objLink){
	try{
		if (objLink.omo_size){
			objLink.temp_size = objLink.style.fontSize;
			objLink.style.fontSize = objLink.omo_size;
		}
		if (objLink.omo_family){
			objLink.temp_family = objLink.style.fontFamily;
			objLink.style.fontFamily = objLink.omo_family;
		}
		if (objLink.omo_weight){
			objLink.temp_weight = objLink.style.fontWeight;
			objLink.style.fontWeight = objLink.omo_weight;
		}
		if (objLink.omo_decoration){
			objLink.temp_decoration = objLink.style.textDecoration;
			objLink.style.textDecoration = objLink.omo_decoration;
		}
		if (objLink.omo_color){
			objLink.temp_color = objLink.style.color;
			objLink.style.color = objLink.omo_color;
		}
	}catch(e){
	}
}

function addBookmark(title,url)
{ 
	if (window.sidebar)
	{ 
		window.sidebar.addPanel(title, url,""); 
	} 
	else if( document.all ) 
	{ 
		window.external.AddFavorite( url, title); 
	} 
	else if( window.opera && window.print )
	{ 
		return true; 
	} 
} 


function fnOMOutLink(objLink){
	try{
		if (objLink.temp_size){
			objLink.style.fontSize = objLink.temp_size;
			objLink.removeAttribute("temp_size");
		}
		if (objLink.temp_family){
			objLink.style.fontFamily = objLink.temp_family;
			objLink.removeAttribute("temp_family");
		}
		if (objLink.temp_weight){
			objLink.style.fontWeight = objLink.temp_weight;
			objLink.removeAttribute("temp_weight");
		}
		if (objLink.temp_decoration){
			objLink.style.textDecoration = objLink.temp_decoration;
			objLink.removeAttribute("temp_decoration");
		}
		if (objLink.temp_color){
			objLink.style.color = objLink.temp_color;
			objLink.removeAttribute("temp_color");
		}
	}catch(e){
	}
}	
	