(function(m){var u=new function(){var n=[],d=[],f=[],g=0,h=void 0;this.Start=function(){var b;a:{for(b=0;b<n.length;b++){var a=n[b].getState();if(a.hasError||a.isBusy)break a}b=-1}if(-1<b)Helper.ShowLoading(),b=n[b].getState(),b.hasError&&r.AddError(b.error.requestStatus,b.error.requestStatusText,15),setTimeout(m.DevMan.Start,2E3);else{for(b=0;b<d.length;b++)d[b].Init();u();q("Device","System");Helper.HideLoading()}};this.ModuleType={CommunicationModule:1,Website:2};this.RegisterModule=function(b,
a){switch(a){case this.ModuleType.CommunicationModule:n.push(b);break;case this.ModuleType.Website:d.push(b)}};this.CommunicationType={mdp:1,ads:2};this.getCommunicationModule=function(b){for(var a=0;a<n.length;a++)if(n[a].communicationtype==b)return n[a]};var s=[],u=function(){try{document.getElementById("Body").innerHTML="",document.getElementById("Body").innerHTML+='<div id="MainNavigationMenue"></div>',document.getElementById("Body").innerHTML+='<div id="SubNavigationMenue"></div>',document.getElementById("Body").innerHTML+=
'<div id="ActivePage"></div>',document.getElementById("Body").innerHTML+='<div style="clear:both;"></div>'}catch(b){}try{document.getElementById("TitleHistory").innerHTML="",document.getElementById("TitleHistory").innerHTML+='<img id="imgBack" alt="" src="res/website/other/backicon.png" title="Back"/>',document.getElementById("TitleHistory").innerHTML+='<img id="imgForward" alt="" src="res/website/other/forwardicon.png" title="Forward"/>'}catch(a){}try{document.getElementById("imgBack").onclick=function(){return function(){0!=
g&&(g--,q(f[g].category,f[g].page,!0))}}(),document.getElementById("imgForward").onclick=function(){return function(){g+1>=f.length||(g++,q(f[g].category,f[g].page,!0))}}()}catch(e){}for(var c="",l=0;l<d.length;l++){var k=d[l].category;if(d[l].visible){var p;null==s[k]||0==s[k]?(s[k]=!0,p=!1):p=!0;p||(c+=(new ControlLib.MainNavigationButton).Create(k,k,"res/website/nav/main/"+k+".png"))}}try{document.getElementById("MainNavigationMenue").innerHTML=c}catch(D){}for(l=0;l<d.length;l++)d[l].visible&&
(k=d[l].category,document.getElementById(k+"_MainButton").onclick=function(b){return function(){v();w(b);x(b);for(var c="",a=0;a<d.length;a++)if(d[a].category==b&&d[a].visible){c=d[a].name;break}0<c.length&&q(b,c)}}(k))},w=function(b){for(var a=document.getElementById("MainNavigationMenue").getElementsByTagName("div"),e=0;e<a.length;e++)-1<a[e].id.indexOf("_body")&&(a[e].className="MainNavigationTile_Body_Unselected");y();""!=b&&(document.getElementById(b+"_body_MainButton").className="MainNavigationTile_Body_Selected")},
x=function(b){for(var a="",e=0;e<d.length;e++)if(d[e].category==b&&d[e].visible)var c=d[e].name,l=d[e].subnavigationicon,a=a+(new ControlLib.SubNavigationButton).Create(c,c,"res/website/nav/sub/"+l);document.getElementById("SubNavigationMenue").innerHTML=a;for(e=0;e<d.length;e++)d[e].category==b&&d[e].visible&&(c=d[e].name,document.getElementById(c+"_SubButton").onclick=function(b,c){return function(){q(b,c)}}(b,c))},y=function(){for(var b=document.getElementById("SubNavigationMenue").getElementsByTagName("div"),
a=0;a<b.length;a++)-1<b[a].id.indexOf("_body")&&(b[a].className="SubNavigationTile_Body_Unselected")};this.ChangePage=function(b,a){q(b,a)};var q=function(b,a,e){var c;a:{for(c=0;c<d.length;c++)if(d[c].category==b&&d[c].name==a)break a;c=-1}void 0==c||0>c||c>=d.length||(e||(g<f.length-1&&f.splice(g+1,f.length-(g+1)),100==f.length&&(f.splice(0,1),0<g&&g--),100>f.length&&!(0<f.length&&f[g].category===b&&f[g].page===a)&&(f.push(new Defines.HistoryEntry(b,a)),1<f.length&&g++)),w(b),x(b),z(c))};this.ReloadActivePage=
function(){z(h,!0)};var z=function(b,a){if(void 0!=b&&!(0>b||b>=d.length)){void 0==a&&(a=!1);var e=d[b].name;y();""!=e&&(document.getElementById(e+"_body_SubButton").className="SubNavigationTile_Body_Selected");if(b!=h||a)r.ClearErrorQueue(),v(),d[b].ShowPage(),h=b}},v=function(){void 0==h||0>h||h>=d.length||(d[h].Stop(),h=void 0)},B=function(){try{return new XMLHttpRequest}catch(b){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(a){try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){return null}}}},
C=function(b,a,e){var c=null,d=void 0,k=!1,f=new Date,g=f.getTime();this.Start=function(){f=new Date;g=f.getTime();c=B();if(null==c){var A=new dataStream.Response(!0,new dataStream.RequestError(2147811344,CommunicationModule_ERROR.ErrorCodeToErrorMessage(2147811344)),void 0,!1);void 0!=e&&"function"==typeof e&&e(A)}else device_url="/MdpWebService/MdpWebService.dll",c.onreadystatechange=m,c.open("POST",device_url,!0),c.setRequestHeader("SOAPAction","urn:beckhoff.com:service:cxconfig:1#"+a),c.setRequestHeader("Content-Type",
"text/xml; charset=utf-8"),c.setRequestHeader("dataType","text/xml"),k=!1,d=setTimeout(h,2E4),c.send(b)};var h=function(){if(null!=c&&4!=c.readyState){k=!0;c.abort();var b=new dataStream.Response(!0,new dataStream.RequestError(2147811345,CommunicationModule_ERROR.ErrorCodeToErrorMessage(2147811345)),void 0,!1);void 0!=e&&"function"==typeof e&&e(b);t.RequestFinished((new Date).getTime()-g,"timed out");c=null}},m=function(){if(null!=c&&4==c.readyState&&!k){d&&clearTimeout(d);var b;if(200==c.status)try{if(null!=
c.responseXML||null!=c.responseXML.documentElement){sSoapResponse=c.responseXML.documentElement;var a=sSoapResponse.getElementsByTagName("faultcode");if(0!=a.length){var f="";a[0].textContent?f=a[0].textContent:a[0].text&&(f=a[0].text);a=0;isNaN(f)||(a=Number(f)>>>0);b=new dataStream.Response(!0,new dataStream.RequestError(a,CommunicationModule_ERROR.ErrorCodeToErrorMessage(a)),void 0,!1)}else{var f=sSoapResponse.getElementsByTagName("ppData"),p=sSoapResponse.getElementsByTagName("ppRdData"),a="";
if(0!=f.length)for(var h=0;h<f[0].childNodes.length;h++)a+=f[0].childNodes[h].data;else if(0!=p.length)for(h=0;h<p[0].childNodes.length;h++)a+=p[0].childNodes[h].data;b=new dataStream.Response(!1,void 0,new dataStream.DataReader(a),!1)}}else b=new dataStream.Response(!0,new dataStream.RequestError(2147811347,CommunicationModule_ERROR.ErrorCodeToErrorMessage(2147811347)),void 0,!1)}catch(m){b=new dataStream.Response(!0,new dataStream.RequestError(2147811347,CommunicationModule_ERROR.ErrorCodeToErrorMessage(2147811347)),
void 0,!1)}else b=new dataStream.Response(!0,new dataStream.RequestError(c.status,c.statusText),void 0,!1);void 0!=e&&"function"==typeof e&&e(b);t.RequestFinished((new Date).getTime()-g,c.status);c=null}}};this.getSoapQueue=function(){return t};var t=new function(){var b=[],a=0;this.AddRequest=function(a,d,f){return 50>=b.length?(b.push(new C(a,d,f)),e(),!0):!1};this.RequestFinished=function(b,d){0<a&&(a--,e())};var e=function(){1>a&&0<b.length&&(b.shift().Start(),a++)}};this.getErrorQueue=function(){return r};
var r=new function(){var b=!1,a=[];this.AddError=function(c,d,f){if(void 0!=c&&(c=CommunicationModule_ERROR.ErrorCodeDisplay(c),Helper.DisplayError(c))){void 0==d&&(d=CommunicationModule_ERROR.ErrorCodeToErrorMessage(c));void 0==f&&(f=1);var g;a:{g=c;for(var h=0;h<a.length;h++)if(a[h].errorCode==g){a[h].errorOccurrenceCount++;g=!0;break a}g=!1}g||a.push(new Defines.UniversalError(c,d,f));b||e()}};this.ClearErrorQueue=function(){for(;0<a.length;)a.pop()};var e=function(){for(var c=-1,d=0;d<a.length;d++)a[d].errorOccurrenceCount>=
a[d].errorOccurrenceMax&&(c=d);if(-1<c){Helper.HideLoading();b=!0;d='<div class="ErrorDiv"><div class="ErrorMessage">'+("Error ("+CommunicationModule_ERROR.GetErrorTypeStr(a[c].errorCode)+"): "+a[c].errorMessage)+'<br/><button id="Btn_closeError">OK</button></div></div>';try{document.getElementById("OverlayError").style.zIndex=101,document.getElementById("OverlayError").innerHTML=d,document.getElementById("Btn_closeError").onclick=function(c){return function(){a.splice(c,1);b=!1;try{document.getElementById("OverlayError").style.zIndex=
-1,document.getElementById("OverlayError").innerHTML=""}catch(d){}0<a.length&&e()}}(c)}catch(f){}}}};m.ProductName="BECKHOFF Device Manager";m.ProductMajor=2;m.ProductMinor=0;m.ProductRevision=0;m.ProductBuild=10};m.DevMan=u})(window);
