var aCI="http://localhost/xmla/msxisapi.dll";var zb="http://localhost";var Kp="False";var MR="1";var adC="";var wa="";var Iq="";var IB="45";var azC="True";var abT="500";var abU="2500";var adq="";var uA="";var Pu=false;var IB=30;var tj=500;var atQ=2500;if(IB!=""){IB=parseInt(IB)};if(abT!=""){tj=parseInt(abT)};if(abU!=""){atQ=parseInt(abU)};function Xmla(){this.et=new ActiveXObject("Microsoft.XMLHTTP");this.iZ=aly;this.oS=oS;this.hN=null;this.YB=null;this.Yp=false;this.RU="Data";};function aly(jD,fm,dZ){if(hC==""){aE.Show(false);P.ShowMessageBox("XmlaServer is not set.",cW.Stop,cV.OK,null,"title:XMLA Info; width:400; height:200; zIndex:11100;");return;}if(!fm||fm==""){fm="Multidimensional"};if(!dZ){dZ=""};document.body.style.cursor="wait";var et=this.et;var MP=qS("Command",qS("Statement",zF(jD)));var Dh=qS("Properties","<PropertyList><DataSourceInfo>"+lI+"</DataSourceInfo><Catalog>"+iG+"</Catalog><Content>"+this.RU+"</Content><Format>"+fm+"</Format><SspropInitAppName>DM Companion</SspropInitAppName>"+dZ+"</PropertyList>");var yt=" xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi = \"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"";var dX="<?xml version='1.0'?>\n"+'<SOAP-ENV:Envelope '+yt+">\n"+zD()+"<SOAP-ENV:Body>\n"+" <Execute xmlns=\"urn:schemas-microsoft-com:xml-analysis\" >"+MP+Dh+" </Execute>"+"</SOAP-ENV:Body>\n"+"</SOAP-ENV:Envelope>\n";var cT=Kz(hC);if(!qP(hC))return;if(this.hN){et.open("POST",cT,true);var iCall=dz.length-1;et.onreadystatechange=function(){Os(iCall)};}else{et.open("POST",cT,false);}et.setRequestHeader("SOAPAction",'"'+"urn:schemas-microsoft-com:xml-analysis:Execute"+'"');et.setRequestHeader("Content-Type","text/xml");if(wa!=""&&Kp=="True")et.setRequestHeader("Authorization","Basic "+HI(wa+":"+Iq));for(var iTry=0;iTry<10;iTry++){try{et.send(dX);break;}catch(e){if(e.message.indexOf("download of the specified resource has failed")== -1&&e.message.indexOf("No data is available for the requested resource")== -1&&e.message.indexOf("Unspecified error")== -1){FT("Client","Internal error",e.message);break;}else{if(iTry==9){FT("Client","Final Internal error",e.message);}else{et=new ActiveXObject("Microsoft.XMLHTTP");if(this.hN){this.et=et;et.open("POST",cT,true);var iCall=dz.length-1;et.onreadystatechange=function(){Os(iCall)};}else{et.open("POST",cT,false);}et.setRequestHeader("SOAPAction",'"'+"urn:schemas-microsoft-com:xml-analysis:Execute"+'"');et.setRequestHeader("Content-Type","text/xml");if(wa!=""&&Kp=="True")et.setRequestHeader("Authorization","Basic "+HI(wa+":"+Iq));}}}}if(!this.hN){document.body.style.cursor="default";Kw(et.responseXML);if(et.responseXML.parsed==true){return et.responseXML;}else{return aaS(et.responseText);}}};function zD(){if(adC!="True")return "";if(uA==""){return "<SOAP-ENV:Header><XA:BeginSession xmlns:XA=\"urn:schemas-microsoft-com:xml-analysis\" xsi:type=\"xsd:int\" mustUnderstand=\"1\"/></SOAP-ENV:Header>";}else{return "<SOAP-ENV:Header><XA:Session xmlns:XA=\"urn:schemas-microsoft-com:xml-analysis\" mustUnderstand=\"1\" SessionId=\""+uA+"\"/></SOAP-ENV:Header>";}};function Kw(bE){if(uA!=""||adC!="True")return;var aV=bE.selectSingleNode("SOAP-ENV:Envelope/SOAP-ENV:Header/Session");if(aV==null)return;var Yw=aV.attributes.getNamedItem("SessionId");if(Yw==null)return;uA=Yw.text;};function aaZ(jD){document.body.style.cursor="wait";var aet="<SOAP-ENV:Header><XA:BeginSession xmlns:XA=\"urn:schemas-microsoft-com:xml-analysis\" xsi:type=\"xsd:int\" mustUnderstand=\"1\"/></SOAP-ENV:Header>";var et=Gu("BEGIN TRANSACTION",aet);var uA=et.responseXML.selectSingleNode("SOAP-ENV:Envelope/SOAP-ENV:Header/Session").attributes.getNamedItem("SessionId").text;if(!qP(hC))return;var rA="<SOAP-ENV:Header><XA:Session xmlns:XA=\"urn:schemas-microsoft-com:xml-analysis\" mustUnderstand=\"1\" SessionId=\""+uA+"\"/></SOAP-ENV:Header>";Gu(jD,rA);var xk="<SOAP-ENV:Header><XA:EndSession xmlns:XA=\"urn:schemas-microsoft-com:xml-analysis\" xsi:type=\"xsd:int\" mustUnderstand=\"1\" SessionId=\""+uA+"\"/></SOAP-ENV:Header>";Gu("COMMIT TRANSACTION",xk);document.body.style.cursor="default";};function Gu(jD,sHeader){document.body.style.cursor="wait";var et=new ActiveXObject("Microsoft.XMLHTTP");var Dh=qS("Properties","<PropertyList><DataSourceInfo>"+lI+"</DataSourceInfo><Catalog>"+iG+"</Catalog><Content>Data</Content><Format>Multidimensional</Format><SspropInitAppName>DM Companion</SspropInitAppName></PropertyList>");var yt=" xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi = \"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"";var MP=qS("Command",qS("Statement",zF(jD)));var dX="<?xml version='1.0'?>\n"+'<SOAP-ENV:Envelope '+yt+">\n"+sHeader+"<SOAP-ENV:Body>\n"+" <Execute xmlns=\"urn:schemas-microsoft-com:xml-analysis\" >"+MP+Dh+" </Execute>"+"</SOAP-ENV:Body>\n"+"</SOAP-ENV:Envelope>\n";var cT=Kz(hC);if(!qP(hC))return;et.open("POST",cT,false);et.setRequestHeader("SOAPAction",'"'+"urn:schemas-microsoft-com:xml-analysis:Execute"+'"');et.setRequestHeader("Content-Type","text/xml");if(wa!=""&&Kp=="True")et.setRequestHeader("Authorization","Basic "+HI(wa+":"+Iq));try{et.send(dX);}catch(e){aE.Show(false);FT("Client","Internal error",e.message);}var mv=GetFault(et.responseXML);if(mv!=""){aE.Show(false);P.ShowMessageBox("Error: "+mv,cW.Stop,cV.OK,null,"title:XMLA Info; width:400; height:200; zIndex:11100;");}return et;};function oS(dU,hE,dD){if(hC==""){aE.Show(false);P.ShowMessageBox("XmlaServer not set.",cW.Stop,cV.OK,null,"title:XMLA Info; width:400; height:200; zIndex:11100;");return};var et=this.et;var strType=qS("RequestType",dU);var strRestrictions=qS("Restrictions",qS("RestrictionList",hE));var Dh=qS("Properties",qS("PropertyList",dD));var yt=" xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi = \"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"";var dX="<SOAP-ENV:Envelope "+yt+" >"+" <SOAP-ENV:Body>"+" <Discover xmlns=\"urn:schemas-microsoft-com:xml-analysis\" >"+strType+strRestrictions+Dh+" </Discover>"+" </SOAP-ENV:Body>"+" </SOAP-ENV:Envelope>";var cT=hC;if(!qP(hC))return;if(this.hN){et.open("POST",cT,true);var iCall=dz.length-1;et.onreadystatechange=function(){Os(iCall)};}else{et.open("POST",cT,false);}et.setRequestHeader("SOAPAction",'"'+"urn:schemas-microsoft-com:xml-analysis:Discover"+'"');et.setRequestHeader("Content-Type","text/xml");if(wa!=""&&Kp=="True")et.setRequestHeader("Authorization","Basic "+HI(wa+":"+Iq));try{et.send(dX);}catch(e){FT("Client","Internal error",e.message);}if(!this.hN){if(et.responseXML.parsed==true){return et.responseXML;}else{return aaS(et.responseText);}}};function Os(jE){var et=dz[jE].et;if(et==null||et.readyState!=4)return;document.body.style.cursor="default";if(dz[jE].Yp)return;dz[jE].Yp=true;var Ie="";if(et.responseXML.parseError.errorCode!=0){Ie=et.responseText.substring(1,500);FT("Server","Unknown server error",Ie);dz[jE].et=null;}else if(et.responseXML.documentElement==null){dz[jE].et=null;aE.Show(false);P.ShowMessageBox("Error: responseXML.documentElement is NULL<br/>Text: "+et.responseText,cW.Stop,cV.OK,null,"title:XMLA Info; width:400; height:200; zIndex:11100;");}else{var bE=et.responseXML;var mv=GetFault(bE);if(mv!=""){if(window.Abort)(Pe());aE.Show(false);P.ShowMessageBox("Error: "+mv,cW.Stop,cV.OK,null,"title:XMLA Info; width:400; height:200; zIndex:11100;");if(dz[jE].YB){dz[jE].YB(mv);}}else{Kw(et.responseXML);dz[jE].hN(bE);}dz[jE].et=null;}};function FT(errCode,errString,errRaw){if(Pu==true){aE.Show(false);P.ShowMessageBox("Query is canceled.",cW.Stop,cV.OK,null,"title:XMLA Info; width:400; height:200; zIndex:11100;");Pu=false;}else{aE.Show(false);P.ShowMessageBox("Errors Code: "+errCode+"<br/>Error: "+errString+"<br/>Row Error: "+errRaw,cW.Stop,cV.OK,null,"title:XMLA Info; width:400; height:200; zIndex:11100;");}};function GetFault(bE){var strDescr="";if(oz()){var oNodeList=bE.selectNodes("soap:Envelope/soap:Body/ExecuteResponse/return/root/Messages/Error");}else{var oNodeList=bE.selectNodes("SOAP-ENV:Envelope/SOAP-ENV:Body/SOAP-ENV:Fault/detail/faultstring/Error");}try{var i=oNodeList.length;}catch(e){return "";}for(var i=0;i<oNodeList.length;i++){strDescr+=oNodeList[i].attributes.getNamedItem("Description").nodeValue+"\n";}if(strDescr==""){if(oz()){var aV=bE.selectSingleNode("soap:Envelope/soap:Body/soap:Fault/faultstring");}else{var aV=bE.selectSingleNode("SOAP-ENV:Envelope/SOAP-ENV:Body/SOAP-ENV:Fault/faultstring");}if(aV){strDescr=aV.text;}}return strDescr;};function aaS(iS){var kP=new ActiveXObject("MSXML.DOMDocument");kP.async=false;if(kP.loadXML(iS)==false){aE.Show(false);P.ShowMessageBox("XML Parsing Error:"+iS,cW.Stop,cV.OK,null,"title:XMLA Info; width:400; height:200; zIndex:11100;");}return kP;};function aAW(http){var kP=new ActiveXObject("MSXML.DOMDocument");kP.async=false;if(kP.load(http)==false){aE.Show(false);P.ShowMessageBox("Error parsing xml from http: "+http,cW.Stop,cV.OK,null,"title:XMLA Info; width:400; height:200; zIndex:11100;");}return kP;};function Kz(cT){if(MR=="0"||MR=="")return cT;if(MR=="1"){if(cT.substring(0,4)!="http")return cT;if(cT.substring(0,zb.length).toLowerCase()==zb.toLowerCase()){return cT;}}return cT;};function akX(cT){if(cT.substring(0,4)=="http")return cT;if(cT.substring(0,1)=="/"){return zb+cT;}else{return zb+"/"+cT;}};function abc(){if(hC.substring(0,zb.length).toLowerCase()==zb.toLowerCase()){var cT=hC.substring(zb.length);if(cT.indexOf(":")== -1){return cT;}else{var iProxyPos=cT.indexOf("?url");if(iProxyPos!= -1&&iProxyPos<cT.indexOf(":")){return cT;}else{return hC;}}}else{return hC;}};function zF(s){s=PA(s,"&","&amp;");s=PA(s,"<","&lt;");s=PA(s,">","&gt;");return s;};function PA(s,sSearch,replaceStr){var regexp=eval("/"+sSearch+"/gi");return s.replace(regexp,replaceStr);};function qS(sTag,dy){return "<"+sTag+">"+dy+"</"+sTag+">"};function Pe(){var i=dz.length-1;if(dz[i].et){Pu=true;dz[i].et.abort();dz[i].et=null;}document.body.style.cursor="default";if(window.idAbort&&window.idAbort.style){idAbort.style.display="none";}};function HI(sL){var OU="";var chr1,chr2,chr3="";var enc1,enc2,enc3,enc4="";var i=0;var keyStr="ABCDEFGHIJKLMNOP"+"QRSTUVWXYZabcdef"+"ghijklmnopqrstuv"+"wxyz0123456789+/"+"=";do{chr1=sL.charCodeAt(i++);chr2=sL.charCodeAt(i++);chr3=sL.charCodeAt(i++);enc1=chr1>>2;enc2=((chr1&3)<<4)|(chr2>>4);enc3=((chr2&15)<<2)|(chr3>>6);enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64;}else if(isNaN(chr3)){enc4=64;}OU=OU+keyStr.charAt(enc1)+keyStr.charAt(enc2)+keyStr.charAt(enc3)+keyStr.charAt(enc4);chr1=chr2=chr3="";enc1=enc2=enc3=enc4="";}while(i<sL.length);return OU;};function oz(){return(hC.toLowerCase().indexOf("msmdpump.dll")!= -1)};function als(){var dU="MDSCHEMA_CUBES";var hE="<CATALOG_NAME>"+iG+"</CATALOG_NAME><CUBE_NAME>"+fO+"</CUBE_NAME>";var dD="<DataSourceInfo>"+lI+"</DataSourceInfo><Catalog>"+iG+"</Catalog><Format>Tabular</Format><SspropInitAppName>DM Companion</SspropInitAppName><Content>SchemaData</Content>";var aU=new Xmla;var bE=aU.oS(dU,hE,dD);var mv=GetFault(bE);if(mv!=""||bE.documentElement==null){aE.Show(false);P.ShowMessageBox("Error: "+mv,cW.Stop,cV.OK,null,"title:XMLA Info; width:400; height:200; zIndex:11100;");return "";}var cY="";var aD=bE.selectNodes("//root/row");if(aD.length>0){cY=aD[0].selectSingleNode("LAST_DATA_UPDATE").text;if(oz()==false){adq=""}cY=Pd(cY);}return cY;};function Pd(sMyDate){try{var EH=sMyDate.split("T");var uy=EH[0];var DO=EH[1];var kR=uy.split("-");var rj="";var oJ="";var uz="";switch(adq){case "YYYY-MM-DD":rj=kR[0];oJ=kR[1];uz=kR[2];break;case "DD-MM-YYYY":uz=kR[0];oJ=kR[1];rj=kR[2];break;case "MM-DD-YYYY":oJ=kR[0];uz=kR[1];rj=kR[2];break;}if(rj==""){return uy+" "+DO;}var OE=DO.split(":");var Xy=parseInt(parseFloat(OE[0]));var YM=parseInt(parseFloat(OE[1]));var acq=parseInt(parseFloat(OE[2]));oJ=parseInt(parseFloat(oJ))-1;var dt=new Date();dt.setFullYear(rj,oJ,uz);if(true){dt.setUTCHours(Xy,YM,acq);}else{dt.setHours(Xy,YM,acq);}}catch(e){return uy};if(dt==null||dt+""=="NaN"){return uy};return dt.toLocaleString();}
