function AjaxRequest(type, url, id) { // create Ajax-Objects this.request = null; this.browser = navigator.userAgent; this.ie = (document.all)?1:0; this.opera = (this.browser.search(/opera/i) > 0)? 1 : 0; this.mozilla = (this.browser.search(/mozilla/i) > 0)? 1 : 0; this.IEXObjs = ["MSXML2.XMLHttp.5.0", "MSXML2.XMLHttp.4.0", "MSXML2.XMLHttp.3.0", "MSXML2.XMLHttp", "Microsoft.XMLHttp"]; this.version = parseFloat(navigator.appVersion); this.myEncodeURIComponent = function(s) { return((encodeURIComponent)? encodeURIComponent(s) : escape(s)); }; this.trim = function(s) { return(s.replace (/^\s+/,'').replace(/\s+$/,'')); }; this.getRequestObject = function() { var req = null; try { req = new XMLHttpRequest(); } catch(e) {} if (!req) { for (var i = 0; i < this.IEXObjs.length; i++) { try { req = new ActiveXObject(this.IEXObjs[i]); if (req != null) break; } catch (e) {} } } if (!req && window.createRequest) req = window.createRequest(); return req; }; this.formData = function(formname) { o = this.getNamedObj(formname); a = new Array(); for (var i = 0; i < o.length; i++) { a[i] = new Object(); switch (o.elements[i].type) { case "checkbox" : a[i][o.elements[i].name] = (o.elements[i].checked?1:0); break; default : a[i][o.elements[i].name] = o.elements[i].value; break; } } return(a); }; this.arrayData = function() { a = new Array(); for (var i = 0; i < arguments.length; i++) a[i] = arguments[i]; return(a); }; this.formatParams = function(aArgs) { var param = ""; if (typeof(aArgs) == 'string') { part = aArgs.match(/(\S.+)\[(\w.+)\]/gi); if (part) { param += "&" + this.myEncodeURIComponent(RegExp.$1) + "=" + this.myEncodeURIComponent(RegExp.$2); } else if (aArgs.name) { param += "&" + aArgs.name + "=" + aArgs.value; } else { param += "&args[]=" + this.myEncodeURIComponent(aArgs); } } else if (typeof(aArgs) == 'number') { param += "¶m=" + aArgs; } else if (typeof(aArgs) == 'object') { if (aArgs.elements == undefined) { param += "&" + aArgs.name + "=" + aArgs.value; } else { // scan form.inputs for (i = 0; i < aArgs.length; i++) { if (aArgs.elements[i].name == "") continue; param += "&" + aArgs.elements[i].name + "=" + aArgs.elements[i].value; } } } else { for (i = 0; i < aArgs.length; i++) { part = aArgs[i].match(/(\S.+)\[(\w.+)\]/gi); if (part) { param += "&" + this.myEncodeURIComponent(RegExp.$1) + "=" + this.myEncodeURIComponent(RegExp.$2); } else { param += "&args[]=" + this.myEncodeURIComponent(aArgs[i]); } } } return(param); }; function getFrameDoc(frameObj) { if (frameObj == null) { frameObj = top; } else if (typeof(frameObj) != "object") { frameObj = parent.frames[frameObj]; } try { // For IE5.5 and IE6, Mozilla, ... content = frameObj.contentWindow.document; } catch (e) { try { // For NS6 content = frameObj.contentDocument.document; } catch (e) { try { // IE 5 content = frameObj.document; } catch (e) { return(0); } } } return(content); }; function ext_include(sTarget, sFile) { var tar = (sTarget == null)? document : parent.frame[sTarget]; var oHead = tar.getElementsByTagName('head'); var oScript = tar.createElement('script'); oScript.type = 'text/javascript'; oScript.src = sFile; oHead[0].appendChild(oScript); }; function getDocObj(o, sId) { if (o == null) o = document; if (!sId) return null; var returnObj = o.getElementById(sId); if (!returnObj && document.all) { returnObj = o.all[sId]; } return returnObj; }; function getObj(sId) { if (!sId) return null; var returnObj = document.getElementById(sId); if (!returnObj && document.all) { returnObj = document.all[sId]; } return returnObj; }; // MPajax.getObj() get the Object for sId function getNamedObj(sName) { if (!sName) return null; var returnObj = document.getElementsByName(sName)[0]; if (!returnObj && document.all) { returnObj = document.all[sName]; } return returnObj; }; function putContent(ftarget, fid, content) { var t = (ftarget == null)? document : getFrameDoc(ftarget); if (fid == null) { t.body.innerHTML = content; } else { getDocObj(t, fid).innerHTML = content; } }; // process ajax request ---------------------------------------------------- // Sends a XMLHttpRequest to call the specified PHP function on the server this.call = function(type, uri, id, aArgs, onready, wait) { methode = type.toUpperCase(); if (this.ie && this.version < 7 && type != "UPLOAD") methode = "ACTIVEX"; uri += (uri.indexOf("?") == -1)? "?" : "&"; uri += "rnd=" + Math.random(); switch(methode) { case "GET" : // GET-Methode request.reqType = 0; if (aArgs != null) uri += this.formatParams(aArgs); postdata = null; break; case "POST" : request.reqType = 1; postdata = (aArgs != null)? this.formatParams(aArgs) : null; break; case "ACTIVEX" : if (aArgs != null) uri += this.formatParams(aArgs); postdata = null; break; case "UPLOAD" : // create dynamic iframe for upload if not exit if (this.ie && this.version < 7) { if ('undefined' == typeof("copyIframe")) { alert("CopyIframe Module nicht gefunden.\nUpload mittels Internet Explorer 6 nicht moeglich.\nDie Datei wird beim Speichern uebertragen."); return; } // dynamic creation of iframe for IE < 7 if ('undefined' == typeof(frames["ajaxuploadifr"])) { iframeHTML = '\