function fuPopWin(myUrl,myWidth,myHeight){ var winWidth = screen.width; var winHeight= screen.height; var myX= (screen.availWidth/2) - (winWidth/2); var myY= (screen.availHeight/2) - (winHeight/2); var myWin= window.open(myUrl,'winpop','screenX=0,screenY=0,left=0,top=0 ,width='+winWidth+',height='+winHeight+',toolbar=1,location=1,directories=1,status=1,scrollbars=1,resizable=1'); } function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { oldonload(); func(); } } } function showPicJQ (whichpic) { $j("#placeholder").attr("src",whichpic); } function clearDefault(el) { if (el.defaultValue==el.value) el.value = "" } 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 -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.norgeshus.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