var onLoadFunctions=""; function initOnLoadEvent(){ eval(onLoadFunctions); } function addOnLoadEvent(functionString){ if(functionString.lastIndexOf(';')!=functionString.length-1)functionString += ';'; onLoadFunctions += functionString; } window.onload =initOnLoadEvent;var ajaxReqURLs = new Array(); var runningAjaxReqs = new Array(); var ajaxReqFunctions = new Array(); var nextFunctionAJAX = new Array(); var lastMouseX = 0; var lastMouseY = 0; var MouseXAJAX = new Array(); var MouseYAJAX = new Array(); var ajaxLoader =""; function AJAXgetForm(formName){ var elements = document.forms[formName].elements; var url=elements["AJAXURL"]!=null?elements["AJAXURL"].value:''; if(url.indexOf('?')==-1){url+='?';} return url+AJAXgetParameter(formName); } function AJAXgetParameter(formName){ var and=true;var url=''; var elements = document.forms[formName].elements; for(var i=0;i-1){ var errorText =text.substr(text.indexOf("-1){ window.location.reload(); return; }else{ req = runningAjaxReqs[url]; eval(ajaxReqFunctions[url]); hideDiv("ajaxLoaderDiv"); if(nextFunctionAJAX[url]!=null)eval(nextFunctionAJAX[url]); } runningAjaxReqs[url]=null; ajaxReqFunctions[url]=null; }else if(curReq.status == 503){//server down window.location.reload(); }else if(curReq.status == 0){//auch server down??? window.location.reload(); }else{ alert("Request Fail: Statustext:"+curReq.statustext+" Status:"+curReq.status+" readyState"+curReq.readyState+"\nText:"+curReq.responseText); } }else{ runningCount++; } } if(runningCount==0){ ajaxReqURLs = new Array(); ajaxReqFunctions = new Array(); runningAjaxReqs[url]=new Array(); } } function AJAXsendRequest(url,processReq,nextFunction,target_id,e){ if(!e)e = window.event; var curReq = AJAXcreateXMLHttpRequest(); if(url.indexOf("?")<0){ url+="?"; }else{url+="&";} url+="rand="+(new Date()).getTime(); ajaxReqURLs.push(url); runningAjaxReqs[url]=curReq; ajaxReqFunctions[url]=processReq; if(e!=null){ MouseXAJAX[url]=e.clientX; MouseYAJAX[url]=e.clientY; lastMouseX=e.clientX; lastMouseY=e.clientY; } if(nextFunction!=null)nextFunctionAJAX[url]=nextFunction; var ajaxLoaderDiv = document.getElementById("ajaxLoaderDiv"); if(ajaxLoaderDiv==null){ ajaxLoaderDiv = document.createElement("div"); ajaxLoaderDiv.id="ajaxLoaderDiv"; document.getElementsByTagName("body")[0].appendChild(ajaxLoaderDiv); } if(ajaxLoaderDiv!=null){ var top=0; var left=0; if(window.innerHeight !=null){ top= (window.innerHeight/2) ; left= (window.innerWidth/2) -150; }else{ top= (screen.availHeight/3+ document.body.scrollTop) ; left= (document.body.clientWidth/2) ; } for(var i=0;i200)targetHeight=200; if(targetWidth>0){ tempAjaxLoader +="width:"+targetWidth+"px;"; } if(targetHeight>0){ tempAjaxLoader +="height:"+targetHeight+"px;"; } tempAjaxLoader +="' >"+""; document.getElementById(target_id).innerHTML=tempAjaxLoader; }else{ ajaxLoaderDiv.innerHTML+="
RQ"+url; ajaxLoaderDiv.innerHTML=ajaxLoader; ajaxLoaderDiv.style.position="absolute"; ajaxLoaderDiv.style.top=top+"px"; ajaxLoaderDiv.style.left=left+"px"; showDiv("ajaxLoaderDiv"); } } curReq.onreadystatechange=AJAXsetRequestRunning; curReq.open("GET",url,true); curReq.send(null); } var edit=0; var a_links = new Array(document.getElementsByTagName("a").length); function AJAXsetFormReadOnly(form){ if(form.elements["oid_form"].value=="-1"){ if(document.getElementById("ChangeButton")!=null)hideDiv("ChangeButton"); if(document.getElementById("SaveButton")!=null)showDiv("SaveButton"); return; } for(var i=0;i0){ scrollPos +=top; }else{ scrollPos+=100; } offerDiv.style.top=scrollPos+"px"; if(left<=0){ if(window.innerWidth)left = ((window.innerWidth-width)/2); else left = ((document.body.clientWidth -width)/2); } offerDiv.style.left=left+"px"; offerDiv.style.width=width+"px"; if(height>0)offerDiv.style.height=height+"px"; showDiv(windowName); } function setBgBlack(divName){ var bodyhight=document.getElementsByTagName('body')[0].scrollHeight; var bodywidth=document.getElementsByTagName('body')[0].scrollWidth; document.getElementById(divName).style.width=bodywidth+'px'; document.getElementById(divName).style.height=bodyhight+'px'; showDiv(divName); } function closeLightWindow(top,left,width,height){ closeAJAXWindow('LightWindow'); } function closeAJAXWindow(windowName){ if(document.getElementById("BlackBackground"))hideDiv("BlackBackground"); hideDiv(windowName); } function stopEvent(event){ if(!event)event=window.event; if (!event.stopPropagation) { event.cancelBubble = true; event.returnValue = false; }else{ event.stopPropagation(); event.preventDefault(); } } function loadAJAXWindow(url,curWindow){ curWindow.setAjaxContent(url, { evalJS:'force',method: 'get',evalJSON:false, onCreate: function() {this.setContent('
Please wait...
');}, onComplete: function(){evalAJAXScripts(this.content);} }); }function submitAJAXForm(formName,curWindow){ var url = AJAXgetForm(formName); loadAJAXWindow(url,curWindow); } function evalAJAXScripts(html){ var scripts = html.getElementsByTagName("pre"); for(var i=0;i