(function(t){var G=new function(){this.Template=function(){this.subnavigationicon=this.category=this.name="";this.visible=!1;var e=null,u=null,v=!0,g=0,w=2E3,m=!1,k=void 0,f=[],l=[],n=new Helper.CActiveRequestCount,h=[],x=void 0,y=void 0,q=void 0,z=void 0,r=void 0,A=void 0;this.setCycleTime=function(a){w=a};this.setCommunicationObj=function(a){k=a};this.getCommunicationObj=function(){return k};this.setRequestParamIDs=function(a){f=a};this.getRequestParamIDs=function(){return f};this.setResponseData=
function(a){RequestResponse=a};this.setPageInitialized=function(a){m=a};this.setOnInitStaticPage=function(a){x=a};this.setOnDisplayValues=function(a){y=a};this.setOnServiceTransferFailed=function(a){r=a};this.setOnServiceTransferResult=function(a){A=a};this.setOnWriteFailed=function(a){q=a};this.setOnWriteResult=function(a){z=a};this.ShowPage=function(){v=!1;e=document;u=e.getElementById("ActivePage");m=!1;RequestResponse=void 0;n.Init();H();B();C("status");I()};var B=function(){try{u.innerHTML='<div id="status"></div>'}catch(a){}};
this.Stop=function(){v=!0;0<g&&(clearTimeout(g),g=0);B()};this.ChangePage=function(a,b){t.DevMan.ChangePage(a,b)};this.Init=function(){return!1};this.addLockListener=function(a){try{var b=document.getElementById(a);b&&("SELECT"==b.tagName?(J(a,function(a){return function(){p(a)||h.push(a)}}(a)),K(a,function(a){return function(){try{e.getElementById(a).style.background="#FFFAF0"}catch(b){}}}(a))):J(a,function(a){return function(){if(!p(a)){h.push(a);try{e.getElementById(a).style.background="#FFFAF0"}catch(b){}}}}(a)))}catch(c){}};
this.isLocked=function(a){return p(a)};this.removeLock=function(a){L(a)&&s()};this.clearLocks=function(){H();s()};var p=function(a){for(var b=0;b<h.length;b++)if(h[b]==a)return!0;return!1},L=function(a){for(var b=0;b<h.length;b++)if(h[b]==a){h.splice(b,1);try{e.getElementById(a).style.background=""}catch(c){}return!0}return!1},H=function(){for(;0<h.length;)L(h[0])||h.pop()};this.showLoading=function(a){C(a)};this.writeStatus=function(a){try{u.children.status.innerHTML=a}catch(b){}};this.writeActivePage=
function(a){try{u.innerHTML=a}catch(b){}};this.readElement=function(a){return D(a)};this.writeElement=function(a,b){E(a,b)};this.getElementValue=function(a){var b;try{b=e.getElementById(a).value}catch(c){b=""}return b};this.setElementValue=function(a,b){var c;try{if(!p(a)){var d=e.getElementById(a);d.value.toString()!=b.toString()&&(d.value=b)}c=!0}catch(f){c=!1}return c};this.clearPage=function(){B()};this.getCheckedRadioButtonValue=function(a){var b;a:try{var c=e.getElementsByName(a);for(a=0;a<
c.length;a++)if(c[a].checked){b=c[a].value;break a}b=0}catch(d){b=0}return b};this.getElementChecked=function(a){var b;try{b=e.getElementById(a).checked}catch(c){b=0}return b};this.setElementChecked=function(a){var b;try{p(a)||(e.getElementById(a).checked=!0),b=!0}catch(c){b=!1}return b};this.setElementUnchecked=function(a){var b;try{p(a)||(e.getElementById(a).checked=!1),b=!0}catch(c){b=!1}return b};this.setElementDisabled=function(a,b){var c;try{e.getElementById(a).disabled=b,c=!0}catch(d){c=!1}return c};
this.setElementOnClick=function(a,b){var c;try{e.getElementById(a).onclick=b,c=!0}catch(d){c=!1}return c};this.setElementOnChange=function(a,b){return K(a,b)};this.setElementOnKeyUp=function(a,b){var c;try{e.getElementById(a).onkeyup=b,c=!0}catch(d){c=!1}return c};this.scrollToElement=function(a){var b;try{e.getElementById(a).scrollIntoView(),b=!0}catch(c){b=!1}return b};this.getElementSelectedIndex=function(a){var b;try{b=e.getElementById(a).selectedIndex}catch(c){b=0}return b};var C=function(a){var b;
b='<div id="">    <img id="" alt="" src="res/website/other/loading.gif"/>';b+="</div>";-1==D(a).indexOf("res/website/other/loading.gif")&&E(a,b)},D=function(a){try{return e.getElementById(a).innerHTML}catch(b){return""}},E=function(a,b){try{var c=e.getElementById(a);c.innerHTML.toString()!=b.toString()&&(c.innerHTML=b)}catch(d){}},J=function(a,b){try{return e.getElementById(a).onfocus=b,!0}catch(c){return!1}},K=function(a,b){try{return e.getElementById(a).onchange=b,!0}catch(c){return!1}};this.addParameter=
function(a,b){var c;c=void 0!=k?k.getModuleItemCount(a):0;this.visible||(this.visible=0<c);f.push(new Defines.RequestParameter(a,b,c))};var M=function(){v||(n.RequestsFinished()?0<l.length?(t.DevMan.getErrorQueue().AddError(l[0].requestStatus,l[0].requestStatusText,3),setTimeout(I,w)):(m||void 0!=x&&(m=x(f)),m&&(0<=D("status").indexOf("res/website/other/loading.gif")&&E("status",""),void 0!=y&&y(f)),g=setTimeout(s,w)):m||C("status"))},I=function(){0<g&&(clearTimeout(g),g=0);N(!1)},s=function(){0<
g&&(clearTimeout(g),g=0);N(!0)},N=function(a){for(;0<l.length;)l.pop();for(var b=[],c=0;c<f.length;c++)(f[c].cyclic&&a||!a)&&b.push(f[c].parameterName);0<b.length&&(new k.Request(b,G)).Start()&&n.Increment()},F=function(a){for(var b=0;b<f.length;b++)if(a==f[b].parameterName)return b;return-1},G=function(a){n.Decrement();a.hasError&&l.push(a.error);if(!a.hasError&&!a.isBusy){a=a.data;for(var b=0;b<a.length;b++)if(0<a[b].value.length&&a[b].value[0].constructor==t.Defines.ArrayInfo){var c=a[b].parameterName,
c=F(c);if(0<=c)for(var d=0;d<a[b].value.length;d++)0==a[b].value[d].length?(f[c].isArray=!0,f[c].values[d]=[]):(new k.ArrayRequest(a[b].value[d],P)).Start()&&n.Increment()}else if(c=a[b].parameterName,c=F(c),0<=c)if(f[c].clearValues(),0==a[b].value.length)f[c].values.push(new Defines.ResponseInfo("",3970306048));else for(d=0;d<a[b].value.length;d++)f[c].values.push(new Defines.ResponseInfo(a[b].value[d],a[b].error[d]))}M()},P=function(a){n.Decrement();a.hasError&&l.push(a.error);if(!a.hasError){a=
a.data;var b=F(a.parameterName.name);if(0<=b){f[b].isArray=!0;for(var c=[],d=0;d<a.value.length;d++)c.push(new Defines.ResponseInfo(a.value[d],a.error[d]));for(d=0;d<=a.parameterName.id;d++)void 0==f[b].values[d]&&(f[b].values[d]=[]);f[b].values[a.parameterName.id]=c}}M()};this.executeCommand=function(a,b,c){(new k.SingleCommand(a,b,c,Q)).Start()};var Q=function(a){a.isBusy?r&&(a=CommunicationModule_ERROR.ErrorCodeToErrorMessage(2147811360),r(new dataStream.Error(a,2147811360,void 0))):a.hasError?
r&&r(a.error):a.hasError||(s(),a=a.data,A&&A(a))};this.Write=function(a,b,c){(new k.Writer(a,b,c,O)).Start()};this.WriteArray=function(a,b,c,d){(new k.ArrayWriter(a,b,c,d,O)).Start()};var O=function(a){a.isBusy?q&&(a=CommunicationModule_ERROR.ErrorCodeToErrorMessage(2147811360),q(new dataStream.Error(a,2147811360,void 0))):a.hasError?void 0!=q&&q(a.error):a.hasError||(s(),a=a.data,void 0!=z&&z(a.moduleItemsWritten,a.errorCodes))}}};t.Page_Template=G})(window);
