/**********************/ /* Enviroment globals */ /**********************/ var APP_HTTP_ROOT = '//www.ewkunder.dk/sitemark/' var APP_WEBSITE_HTTP_ROOT = getPathToWebsiteRoot( getBaseURL() ) //***************************************** //Generel browserhandling //***************************************** var is is=new browserHandling() function browserHandling(){ this.IE=0 this.NS=0 this.element=(document.getElementById) ? 1 : 0 this.NSapp=(navigator.appName=="Netscape") ? 1 : 0 this.IEapp=(navigator.appName=="Microsoft Internet Explorer") ? 1 : 0 var ual=navigator.userAgent.toLowerCase() this.OPERAapp=(ual.indexOf("opera") != -1) this.MAC=(ual.indexOf("mac") != -1) this.WIN=(ual.indexOf("windows") != -1) this.appver=navigator.appVersion if(this.IEapp) this.IE=(document.all) ? 1 : 0 else if(this.NSapp && !this.element) this.NS=(document.layers) ? 1 : 0 if(this.NSapp) this.version=parseFloat(this.appver) else this.version=parseFloat(this.appver.substr(this.appver.indexOf("MSIE") + 5, 3)) this.GECKO=(ual.indexOf("gecko") != -1) this.FIREBIRD=(ual.indexOf("firebird") != -1) this.NS6=(ual.indexOf("netscape6/6") != -1) this.MEDIAPLAYER=(this.GECKO && ual.indexOf("(ax") != -1) || (this.IE && this.version >= 5 && !this.OPERAapp) } //**************** //Element handling //**************** // getEle - uses browserhandling function getEle(id){ if(is.NS) return document.layers[id] else if(is.element) return document.getElementById(id) else if(is.IE) return document.all[id] else return -1 } function getElePosY(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; } function getElePosX(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 } //***************************************** //Crossbrowser eventhandler //***************************************** function addEvent(obj, evType, fn, useCapture){ if (obj.addEventListener){ obj.addEventListener(evType, fn, useCapture) return true } else if (obj.attachEvent){ var r = obj.attachEvent("on"+evType, fn) return r } else { alert("Handler could not be attached"); return false } } function removeEvent(obj, evType, fn, useCapture){ if (obj.removeEventListener){ obj.removeEventListener(evType, fn, useCapture) return true; } else if (obj.detachEvent){ var r = obj.detachEvent("on"+evType, fn) return r } else { alert("Handler could not be removed") return false } } function getEventTarget(e){ var targ; if (!e) e = window.event; if (e.target) targ = e.target; else if (e.srcElement) targ = e.srcElement; if (targ.nodeType == 3) // defeat Safari bug targ = targ.parentNode; return targ } //***************************************** //Opens a new window //***************************************** function func_openWin(winURL, winName){ var myWin = window.open(winURL, winName) myWin.focus() } //***************************************** // Opens a popUp window >> deprecated //***************************************** function func_openPopUp(winURL,winName,winHeight,winWidth){ var winStats = 'toolbar=0,location=0,directories=0,menubar=0,status=1,scrollbars=0' if(winHeight) winStats = winStats + ',height='+winHeight if(winWidth) winStats = winStats + ',width='+winWidth myWin = window.open(winURL,winName,winStats) } /** * Opens a popUp */ var SiteMarkPopupWin function showPopup(sUrl, sWinName, iHeight, iWidth, iLeft, iTop, bToolbar, bLocation, bDirectories, bMenubar, bStatus, bScrollbars, bResizable ){ var sProps = "", sHtml = "" if( typeof(SiteMarkPopupWin) != "undefined"){ if( typeof(SiteMarkPopupWin.closed) != "undefined" && typeof(SiteMarkPopupWin.location) != "undefined" ) SiteMarkPopupWin.close() } if( typeof(sWinName) == "undefined" ) sWinName = "SiteMarkPopupWin" if( typeof(bToolbar) == "undefined" ) bToolbar = "no" if( typeof(bLocation) == "undefined" ) bLocation = "no" if( typeof(bDirectories) == "undefined" ) bDirectories = "no" if( typeof(bMenubar) == "undefined" ) bMenubar = "no" if( typeof(bStatus) == "undefined" ) bStatus ="no" if( typeof(bScrollbars) == "undefined" ) bScrollbars = "no" if( typeof(bResizable) == "undefined" ) bResizable = "no" sProps = 'toolbar='+bToolbar+',location='+bLocation+',directories='+bDirectories+',menubar='+bMenubar+ ',status='+bStatus+',scrollbars='+bScrollbars+',resizable='+bResizable //Check dynamic heigth and/or width. Image only if( isUrlImage(sUrl) && ( iHeight == "d" || iWidth == "d" ) ){ sProps += ',height=100px,width=100px' sProps += isNaN(iLeft) ? ',left='+((screen.width-100)/2)+'px' : ',left='+iLeft+'px' sProps += isNaN(iTop) ? ',top='+((screen.height-100)/2)+'px' : ',top='+iTop+'px' SiteMarkPopupWin = window.open("",sWinName, sProps); if( !SiteMarkPopupWin ) { return true; } //popup blockers should not cause errors sHtml = '