function _UserAgent() { var b = navigator.appName; var v = this.version = navigator.appVersion; var ua = navigator.userAgent.toLowerCase(); this.v = parseInt(v); this.safari = ua.indexOf("safari")>-1; // always check for safari & opera this.opera = ua.indexOf("opera")>-1; // before ns or ie this.ns = !this.opera && !this.safari && (b=="Netscape"); this.ie = !this.opera && (b=="Microsoft Internet Explorer"); this.gecko = ua.indexOf('gecko')>-1; // check for gecko engine if (this.ns) { this.ns4 = (this.v==4); this.ns6 = (this.v>=5); this.b = "Netscape"; }else if (this.ie) { this.ie4 = this.ie5 = this.ie55 = this.ie6 = false; if (v.indexOf('MSIE 4')>0) {this.ie4 = true; this.v = 4;} else if (v.indexOf('MSIE 5')>0) {this.ie5 = true; this.v = 5;} else if (v.indexOf('MSIE 5.5')>0) {this.ie55 = true; this.v = 5.5;} else if (v.indexOf('MSIE 6')>0) {this.ie6 = true; this.v = 6;} this.b = "MSIE"; }else if (this.opera) { this.v=parseInt(ua.substr(ua.indexOf("opera")+6,1)); // set opera version this.opera6=(this.v>=6); this.opera7=(this.v>=7); this.b = "Opera"; }else if (this.safari) { this.ns6 = (this.v>=5); // ns6 compatible correct? this.b = "Safari"; } this.dom = (document.createElement && document.appendChild && document.getElementsByTagName)? true : false; this.def = (this.ie||this.dom); this.win32 = ua.indexOf("win")>-1; this.mac = ua.indexOf("mac")>-1; this.other = (!this.win32 && !this.mac); this.supported = (this.def||this.ns4||this.ns6||this.opera)? true:false; this.broadband=false; this._bws=new Date; // bandwidth timer start }; // Browserdetection var ua = new _UserAgent(); var js_activeField = ""; function setActiveField(value) { js_activeField = value; } function submitForm(url, formname){ if(document.forms[formname]){ form = document.forms[formname]; } else{ form = document.masterForm; } form.action = url; form.target = ""; form.submit(); } var popuphandler; function closePopupIfExists(){ if(typeof(popuphandler) == "object" && popuphandler != null){ if(typeof(popuphandler.window)=="object"){ popuphandler.window.close(); } } } function getTopLeft(popupWidth, popupHeight){ return ",top=" + (screen.height - popupHeight)/2 + ",left=" + (screen.width-popupWidth)/2; } function openWindow(url,name,parameter) { closePopupIfExists(); // Wenn ein Name uebergeben wird --> Voreinstellungen setzen if (name == "popup") { size = "width=537,height=400,screenX=200,screenY=30,resizable=yes,scrollbars=yes,status=no" + getTopLeft(537, 200); } if (name == "small"){ size = "width=537,height=250,screenX=200,screenY=30,resizable=yes,scrollbars=yes,status=no"+ getTopLeft(537, 250); } if (name == "large"){ size = "width=537,height=570,screenX=200,screenY=30,resizable=yes,scrollbars=yes,status=no"+ getTopLeft(537, 570); } if (name == "extraLarge"){ size = "width=951,height=650,screenX=200,screenY=30,resizable=yes,scrollbars=yes,status=no"+ getTopLeft(951, 570); } if ( (name == "nup") || (name == "slideshow") || (name == "postcard") || (name == "themecard")){ var popupHeight = 570; if(name == "themecard"){ var popupHeight = 682; } size = "width=757,height=" + popupHeight + ",screenX=200,screenY=30,resizable=yes,scrollbars=yes,status=no"+ getTopLeft(757, 570); } if (name == "upload"){ size = "width=256,height=189,screenX=200,screenY=30,resizable=no,scrollbars=no,status=no"+ getTopLeft(256, 190); } if (name == "uploadstatus"){ size = "width=537,height=250,screenX=200,screenY=30,resizable=yes,scrollbars=yes,status=no"+ getTopLeft(537, 310); } if (name == "guide_tour"){ size = "width=741,height=530,screenX=200,screenY=30,resizable=yes,scrollbars=yes,status=no"+ getTopLeft(741, 310); } if (name == "customize"){ size = "width=537,height="+parameter+",screenX=200,screenY=30,resizable=yes,scrollbars=yes,status=no"+ getTopLeft(537, 520); parameter = ""; } if (name == "editText"){ size = "width=987,height=750,screenX=100,screenY=30,resizable=yes,scrollbars=yes,status=no"+ getTopLeft(987, 750); } if (name == "loc_help"){ size = "width=487,height=250,screenX=100,screenY=30,resizable=yes,scrollbars=yes,status=no"+ getTopLeft(487, 250); } if (name == "tracking") { size = "width=490,height=480,scrollbars=yes,resizable=yes"+ getTopLeft(490, 480); } // Wenn ein Parameter uebergeben wird --> diesen uebernehmen if (parameter) { size = parameter; } popuphandler = window.open(url,name,size); if (popuphandler) { popuphandler.window.focus(); } } function openAdditionalWindow(url,name,parameter) { // Wenn ein Name uebergeben wird --> Voreinstellungen setzen if (name == "popup") { size = "width=537,height=400,screenX=200,screenY=30,resizable=yes,scrollbars=yes,status=no"; } if (name == "small"){ size = "width=537,height=250,screenX=200,screenY=30,resizable=yes,scrollbars=yes,status=no"; } if (name == "large"){ size = "width=537,height=570,screenX=200,screenY=30,resizable=yes,scrollbars=yes,status=no"; } if (name == "full"){ size = "width=757,height=570,screenX=200,screenY=30,resizable=yes,scrollbars=yes,status=no"; } if (name == "editText"){ size = "width=866,height=750,screenX=100,screenY=30,resizable=yes,scrollbars=yes,status=no"; } if (name == "tracking") { size = "width=490,height=480,scrollbars=yes,resizable=yes"+ getTopLeft(490, 480); } // Wenn ein Parameter uebergeben wird --> diesen uebernehmen if (parameter) { size = parameter; } tmppopuphandler = window.open(url,'additional'+name,size); tmppopuphandler.window.focus(); } function submitFormToPopup(href, name, parameter, formname) { if(formname){ form = document.forms[formname]; } else{ form = document.masterForm; } StrUserAgent = navigator.userAgent; isMAC_MSIE = StrUserAgent.match(/.*Mozilla.*MSIE 5.*Mac/gi); if (isMAC_MSIE) { openWindow("", name, parameter); // wait for popup (because IE on a -slow- MAC may have a problem otherwise) while (typeof(popuphandler.window)!= "object"){ } oldHref = form.action; form.action = href; form.target = name; form.submit(); } else { openWindow("", name, parameter); oldHref = form.action; form.action = href; form.target = name; form.submit(); if(navigator.appVersion.substring(0,3) != "4.7") { form.action = oldHref; } } } function reloadOpener(){ if(typeof(top.kpco) != "object"){ opener.top.kpco.location.reload(); //opener.top.edit.location.reload(); } else{ top.kpco.location.reload(); } } function checkFormElements(){ enterFields = new Array( 'tpl_sys_statusbar[password]', 'password', 'orderid', 'labpassword'); for (var i=0; i < enterFields.length; ++i) { if (js_activeField == enterFields[i]) { document.masterForm.activeField.value = js_activeField; return true; } } return true; } function resetForm(formName){ if(document[formName]){ var i = 0; while (document[formName].elements[i]){ if(document[formName].elements[i].value){ document[formName].elements[i].value = ""; } i++; } } } function getWindowWidth() { var browserWinWidth = 0 if( typeof( window.innerWidth ) == 'number' ) { //Non-IE browserWinWidth = window.innerWidth; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' browserWinWidth = document.documentElement.clientWidth; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible browserWinWidth = document.body.clientWidth; } return browserWinWidth; } // start a script // // If you call the function more then one time you must generate every time // other url string, to get around cache problem. The best way is to set // a random GET parameter. In the end of the script you must send an image. // // @access public // @param string url to script. // @param function responseHandler callback function // it will be called on response with image.width param // // @return - function requestUrl(url, responseHandler) { requestUrl_image = new Image(); requestUrl_image.src = url; requestUrl_interval = window.setInterval('check_response('+responseHandler+')', 250); } // check if the script is already finished. It means an image is loaded // // is called only by function requestUrl. // callback function (responseHandler) // // @access private // @param function responseHandler callback function // it will be called on response with image.width param // @return - function check_response(responseHandler) { if (requestUrl_image.width) { top.clearInterval(requestUrl_interval); responseHandler(requestUrl_image.width, requestUrl_image.height); } }