if(typeof shRpc=="undefined")var shRpc={};shRpc.sTitle=null;shRpc.sStatusHandler=null;shRpc.sFctParseErrorFields=null;shRpc.hRetryCodes={c_0:1,c_503:1,c_504:1,c_509:1,c_12029:1};
shRpc.hashToParams=function(a,b,c){c=c||"";if(typeof a=="object"&&typeof a.length!="undefined")for(var e=0;e<a.length;e++){sNext=c+"["+e+"]";if(typeof a[e]=="object")shRpc.hashToParams(a[e],b,sNext);else b[sNext]=a[e].toString()}else for(e in a){sNext=c+"["+e+"]";if(typeof a[e]=="object"&&a[e]!=null)shRpc.hashToParams(a[e],b,sNext);else b[sNext]=a[e]!=null?a[e].toString():"null"}};
shRpc.convertParams=function(a){var b="&js_call=1";if(typeof a!="undefined"&&a!=null){if(typeof a.nodeName=="string"&&a.nodeName=="FORM")for(var c=0;c<a.elements.length;c++){if(a.elements[c].name&&!a.elements[c].disabled&&(a.elements[c].type!="checkbox"&&a.elements[c].type!="radio"||a.elements[c].checked))b+="&"+a.elements[c].name+"="+escape(a.elements[c].value)}else if(typeof a.nodeName=="string"&&a.nodeName=="MIRL_FORM")b=a.toGetParams();else{c=0;for(var e in a)if(typeof a[e]=="object"&&a[e]!=null){c=
1;break}if(c)a=jsHelper.param(a);for(e in a)b+="&"+e+"="+escape(a[e])}b=b.replace(/\+/g,"%2B").replace(/%u20AC/g,"%80")}return b};
shRpc.parseResult=function(a,b,c,e,i){function k(){var o=null;if(o=jQuery.data(b.elements[g],"mirl_tab"))return o;var n=jsHelper.getTable(b.elements[g]);if(n.id&&n.id.match(/^(tab_form_|tab_form_([^_]+_)+)entry_/))o=n.id.replace(/^(tab_form_|tab_form_([^_]+_)+)entry_/,"");else{n=jsHelper.getTable(n.parentNode);if(n!=undefined&&n.id&&n.id.match(/^(tab_form_|tab_form_([^_]+_)+)entry_/))o=n.id.replace(/^(tab_form_|tab_form_([^_]+_)+)entry_/,"")}return o}if("_parseResult_callback"in a&&a._parseResult_callback){var d=
1;delete a._parseResult_callback}else d=0;if(typeof c!="undefined"&&typeof c.msg_replace!="undefined")var h=c.input_replace,l=c.msg_replace;else{h=c;l={}}if(typeof h=="undefined")h={};var f=null;if(typeof a._sid!="undefined")f=a._sid;else if(jsHelper.arrayKeyExists(["_mirl","globals","sid"],a))f=a._mirl.globals.sid;if(f!=null&&f!=_sid){_sid=f;if(_auth.uid!="2"){bfDialog.showGhost(1,1);shRpc.loadLibs({libs:["/schemes/default/java/bf.mirl.class.js"],callback:"shRpc.viewLogin"});return}}if(a._maintenance==
"1"){bfDialog.showGhost(1,1);shRpc.loadLibs({libs:["/schemes/default/java/bf.mirl.class.js"],callback:"shRpc.viewMaintenance"})}else{var g="";if(!d)if(shRpc.sStatusHandler==null)if(a._status&&a._status.length)for(g=0;g<a._status.length;g++){d=a._status[g];shStatus.add(d.typ,d.msg,l,"lang"in d?d.lang:undefined,"parent_key"in d?d.parent_key:undefined)}else for(g in a._status){d=a._status[g];shStatus.add(d.typ,d.msg,l,"lang"in d?d.lang:undefined,"parent_key"in d?d.parent_key:undefined)}else getFunction(shRpc.sStatusHandler).apply(this,
[a._status==null?[]:a._status]);if(!(typeof a._stop!="undefined"&&a._stop)){l={};if(typeof a._mirl!="undefined"&&a._mirl!=null){d=a._mirl;if("tmpl_configs"in d&&jQuery.isArray(d.tmpl_configs)&&d.tmpl_configs.length){bfMirl.prepareMirlMods(d.tmpl_configs);delete a._mirl.tmpl_configs}if(d.jlibs&&d.jlibs.length>0){h=[];for(g=0;g<d.jlibs.length;g++)h.push(d.jlibs[g]);d.jlibs=null;h=[{libs:h,callback:"shRpc.parseResult",callback_args:[]}];arguments[0]._parseResult_callback=1;for(g=0;g<arguments.length;g++)h[0].callback_args.push(arguments[g]);
shRpc.loadLibs.apply(this,h);return}bfMirl.process(d,d._need_result?a.result:undefined);for(var m in bfMirl.hAssign.opt)l[m]=bfMirl.hAssign.opt[m];if(typeof bfMirl.hAssign[bfMirl.sLastPage]!="undefined"){for(m in bfMirl.hAssign[bfMirl.sLastPage])l[m]=bfMirl.hAssign[bfMirl.sLastPage][m];delete bfMirl.hAssign[bfMirl.sLastPage]}}if(shRpc.sFctParseErrorFields!=null)getFunction(shRpc.sFctParseErrorFields)(a._error_fields);else if(typeof b!="undefined"&&b&&typeof b.nodeName=="string"&&b.nodeName=="MIRL_FORM")b.markError(a._error_fields);
else if(typeof b!="undefined"&&b&&typeof b.nodeName=="string"&&b.nodeName=="FORM")for(g=0;g<b.elements.length;g++){d=typeof b.elements[g].name!="undefined"?b.elements[g].name:"";var j;if(d.length&&(j=typeof h[d]=="undefined"?b.elements[g]:h[d])){j.className.indexOf("_mirl")>=0?jQuery.data(j,"mirlObj").markError(0):jsHelper.setClass(j,0,"form_error");m=null;f=d.split("[");d=f[f.length-1].substr(0,f[f.length-1].length-1);if(d.match(/^[0-9]+$/)&&f.length>1){m=d;d=f[f.length-2].substr(0,f[f.length-2].length-
1)}else if(f.length>1&&(d=="land"&&typeof b.elements[g+1]!="undefined"&&b.elements[g+1].name.substr(b.elements[g+1].name.length-7)=="prefix]"||d=="prefix"&&typeof b.elements[g-1]!="undefined"&&b.elements[g-1].name.substr(b.elements[g-1].name.length-5)=="land]"||d=="number"&&typeof b.elements[g-1]!="undefined"&&b.elements[g-1].name.substr(b.elements[g-1].name.length-7)=="prefix]"))d=f[f.length-2].substr(0,f[f.length-2].length-1);else if(d.length==2&&jQuery.inArray(d,jsHelper.getLangPrefixs())>-1)d=
f[f.length-2].substr(0,f[f.length-2].length-1);if(a._error_fields&&a._error_fields[d])if(typeof a._error_fields[d].row=="object"){if(m==null){m=f.length>1?f[f.length-2].substr(0,f[f.length-2].length-1):null;var t=f.length>2?f[f.length-3].substr(0,f[f.length-3].length-1):null}f=0;for(var s in a._error_fields[d].row){if(m==a._error_fields[d].row[s]||t==a._error_fields[d].row[s])if(typeof a._error_fields[d].tab=="object"){var p=0,r=k(),q;for(q in a._error_fields[d].tab){if(r==a._error_fields[d].tab[q])j.className.indexOf("_mirl")>=
0?jQuery.data(j,"mirlObj").markError(1):jsHelper.setClass(j,1,"form_error");p++}if(p==0)j.className.indexOf("_mirl")>=0?jQuery.data(j,"mirlObj").markError(1):jsHelper.setClass(j,1,"form_error")}else j.className.indexOf("_mirl")>=0?jQuery.data(j,"mirlObj").markError(1):jsHelper.setClass(j,1,"form_error");f++}if(f==0)if(typeof a._error_fields[d].tab=="object"){p=0;r=k();for(q in a._error_fields[d].tab){if(r==a._error_fields[d].tab[q])j.className.indexOf("_mirl")>=0?jQuery.data(j,"mirlObj").markError(1):
jsHelper.setClass(j,1,"form_error");p++}if(p==0)j.className.indexOf("_mirl")>=0?jQuery.data(j,"mirlObj").markError(1):jsHelper.setClass(j,1,"form_error")}else j.className.indexOf("_mirl")>=0?jQuery.data(j,"mirlObj").markError(1):jsHelper.setClass(j,1,"form_error")}}}if(e){h=[];for(g=5;g<arguments.length;g++)h.push(arguments[g]);h.push(a.result);h.push(l);h.push("action"in a&&a.action!==null?a.action:null);if(typeof i=="string")getFunction(i).apply(this,h);else typeof i=="function"&&i.apply(null,h)}else return"action"in
a&&a.action!==null?{$$action:a.action,$$data:a.result}:a.result}}};
shRpc.parseJSON=function(a){var b=a.indexOf("{"),c={};if(b>-1){var e=b>0?a.substr(0,b-1):"";a=a.substr(b);if(a.substr(a.length-1,1)!="}")__error("shRpc.parseJSON(): Daten enden nicht mit '}'","sh.rpc.class.js","259");else{try{c=(new Function("return "+a))()}catch(i){__error("shRpc.parseJSON(): konnte Daten nicht parsen","sh.rpc.class.js","264");return}if(e.length)c._status={"0":{typ:"err",msg:e}};return c}}else return{_status:{"0":{typ:"err",msg:a}},_error_fields:{},result:""}};
shRpc.jsCall=function(a,b){for(var c=shRpc.convertParams(b),e={},i=0;i<shRpc.iMaxRetries;){i++;if(window.ActiveXObject)var k=new ActiveXObject("Msxml2.XMLHTTP");else if(window.XMLHttpRequest)k=new XMLHttpRequest;if(k){try{k.open("POST",escape(a),false);k.setRequestHeader("Content-type","application/x-www-form-urlencoded");k.send(c)}catch(d){}if(k.status==200){i=shRpc.iMaxRetries;e=shRpc.parseJSON(k.responseText)}else if("c_"+k.status in shRpc.hRetryCodes){if(i==shRpc.iMaxRetries)e={request_error:1}}else{i=
shRpc.iMaxRetries;shRpc.requestError();e={request_error:1}}}}return e};shRpc.getHeaderContentLength=function(a){if(typeof a.getAllResponseHeaders!="undefined"){a=a.getAllResponseHeaders();for(var b=a.indexOf("Content-Length: ")+16,c=1,e="";(e=a.substr(b,c))&&!isNaN(e)&&c<20;)c++;return parseInt(a.substr(b,c-1))}};
shRpc.jsAsyncCall=function(a,b,c,e,i){var k=shRpc.convertParams(b);i&&shRpc.queueGetById(i);var d={};if(window.ActiveXObject)var h=new ActiveXObject("Msxml2.XMLHTTP");else if(window.XMLHttpRequest)h=new XMLHttpRequest;if(h){h.onreadystatechange=function(){if(h.readyState==4)if(h.status==200){typeof i!="undefined"&&shRpc.queueCallDone(i);if(typeof(d=shRpc.parseJSON(h.responseText))!="undefined")shRpc.parseResult(d,b,{},1,"shRpc.jsAsyncCallback",c,e)}else"c_"+h.status in shRpc.hRetryCodes&&typeof i!=
"undefined"?shRpc.queueCallRetry(i):shRpc.requestError()};try{h.open("POST",escape(a),true);h.setRequestHeader("Content-type","application/x-www-form-urlencoded");h.send(k);typeof i!="undefined"&&shRpc.queueSetRqHdl(i,h)}catch(l){if(BrowserDetect.browser=="Explorer")throw l;else __error(l)}}else typeof i!="undefined"&&shRpc.queueCallDone(i)};
shRpc.jsAsyncCallback=function(a,b,c,e,i){if(typeof a!="undefined")if(typeof a=="function"){c={data:c,assigns:e,action:i};if(typeof b!="undefined")c.params=b;a(c)}else{c={data:c,assigns:e,action:i};if(typeof b!="undefined")c.params=b;getFunction(a).apply(this,[c])}else a&&shStatus.add("err","Worker-Function: "+a+" not valid")};shRpc.bQueueRunning=0;shRpc.iQueueCalls=0;shRpc.iMaxCalls=2;shRpc.rTimeout=null;shRpc.ahQueue=[];shRpc.iQueueCount=0;
shRpc.queueAdd=function(a,b){a=a||{};var c=typeof a.name!="undefined"?a.name:"default";a.func=typeof a.func!="undefined"?a.func:"";a.params=typeof a.params!="undefined"?a.params:{};a.worker=typeof a.worker!="undefined"?a.worker:undefined;a.worker_params=typeof a.worker_params!="undefined"?a.worker_params:undefined;c={id:shRpc.iQueueCount,tries:0,status:"queue_wait",name:c,params:a,req:null,mod:_mod};shRpc.iQueueCount++;b?shRpc.ahQueue.unshift(c):shRpc.ahQueue.push(c);shRpc.bQueueRunning||shRpc.queueRun()};
shRpc.queueRmvAll=function(a){a=a||"default";if(shRpc.rTimeout!=null){window.clearTimeout(shRpc.rTimeout);shRpc.rTimeout=null}for(var b=shRpc.ahQueue.length-1;b>=0;b--){var c=shRpc.ahQueue[b];c.name==a&&shRpc.queueRmv(c.id)}shRpc.ahQueue.length>0&&shRpc.queueRun()};shRpc.queueRmv=function(a){var b=shRpc.queueGetById(a);b.req&&b.req.abort();shRpc.queueCallDone(a)};shRpc.queueSetRqHdl=function(a,b){shRpc.queueGetById(a).req=b};
shRpc.queueCallRetry=function(a){a=shRpc.queueGetById(a);a.status="queue_retry";if(a.tries<shRpc.iMaxRetries)a.tries++;else{shRpc.queueRmvAll();shRpc.requestError()}};shRpc.queueCallDone=function(a){a=shRpc.queueGetById(a,1);var b=a.queue;shRpc.ahQueue.splice(a.index,1);b.status!="queue_wait"&&shRpc.iQueueCalls--;if(shRpc.ahQueue.length==0)shRpc.bQueueRunning=0};
shRpc.queueGetById=function(a,b){for(var c=0;c<shRpc.ahQueue.length;c++)if(shRpc.ahQueue[c].id==a){var e=shRpc.ahQueue[c];break}return b?{index:c,queue:e}:e};shRpc.queueGetNext=function(){for(var a=null,b=0;b<shRpc.ahQueue.length;b++)if(shRpc.ahQueue[b].status=="queue_wait"||shRpc.ahQueue[b].status=="queue_retry"){a=shRpc.ahQueue[b];break}return a};
shRpc.queueRun=function(){if(shRpc.ahQueue.length)shRpc.bQueueRunning=1;var a=shRpc.queueGetNext();if(a&&(shRpc.iQueueCalls<shRpc.iMaxCalls||a.status=="queue_retry")){a.status!="queue_retry"&&shRpc.iQueueCalls++;a.status="queue_call";var b=a.params;shRpc.aCall(b.func,b.params,b.worker,b.worker_params,a.id)}shRpc.rTimeout=shRpc.ahQueue.length>0?window.setTimeout(shRpc.queueRun,0):null};
shRpc.call=function(a,b,c,e){a=typeof b=="undefined"?shRpc.jsCall("/"+_sid+"/"+a,undefined):shRpc.jsCall("/"+_sid+"/"+a,b);if(a!=null&&typeof a=="object"&&"request_error"in a&&a.request_error)shRpc.requestError();else if(typeof a!="undefined")return shRpc.parseResult(a,b,{input_replace:c,msg_replace:e},0)};shRpc.aCall=function(a,b,c,e,i){typeof i=="undefined"?shRpc.queueAdd({func:a,params:b,worker:c,worker_params:e}):shRpc.jsAsyncCall("/"+_sid+"/"+a,b,c,e,i)};
shRpc.setSessionVal=function(a){shRpc.aCall("_system/setSession/",a)};shRpc.viewMaintenance=function(){shRpc.aCall("data/getMaintenance",{},"shRpc.showMaintenance")};shRpc.showMaintenance=function(){bfDialog.showGhost(1,0);bfDialog.getTop()==""?bfDialog.show(1,"_maintenance"):bfDialog.sub.show(1,"_maintenance")};shRpc.viewLogin=function(){shRpc.aCall("data/getLogin",{},"shRpc.showLogin")};
shRpc.showLogin=function(){bfDialog.showGhost(1,0);bfDialog.getTop()==""?bfDialog.show(1,"_login"):bfDialog.sub.show(1,"_login");document._login.action="/"+_sid+"/"+_mod};shRpc.requestError=function(){for(var a;(a=bfDialog.getTop()).length>0;)bfDialog.close(a);bfDialog.show(1,"_rpc_timeout")};shRpc.sleepTest=function(a){iSleep=a&&"sleep"in a?a.sleep:300;shRpc.aCall("data/doSleep/sleep:"+iSleep);shRpc.call("data/doSleep/sleep:"+iSleep);return 1};

