// (c)2011 MrOrange

﻿String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"");};String.prototype.ltrim=function(){return this.replace(/^\s+/,"");};String.prototype.rtrim=function(){return this.replace(/\s+$/,"");};var mrOwebservice={target:null,OnTimeOut:function(err){if(mrO.page.debugging({sender:'mrOwebservice.OnTimeOut'})){mrO.utils.writeToConsole(err);}
if(this.target!==null){this.target.innerHTML='Error: <br />'+err.get_message();}},OnError:function(err){if(mrO.page.debugging({sender:'mrOwebservice.OnError'})){mrO.utils.writeToConsole(err);}
if(this.target!==null){this.target.innerHTML='Error: <br />'+err.get_message();}}};var mrOxml={parser:null,applyXSL:function(XMLObj,XSLObj){var res;if(window.ActiveXObject){res=XMLObj.transformNode(XSLObj);if(mrO.page.debugging({sender:'mrOxml.applyXSL'})){mrO.utils.writeToConsole(res);}
return res;}else if(window.XSLTProcessor){var xsltp=new window.XSLTProcessor();xsltp.importStylesheet(XSLObj);res=xsltp.transformToFragment(XMLObj,document);if(mrO.page.debugging({sender:'mrOxml.applyXSL'})){mrO.utils.writeToConsole(res);}
return res;}else{return"error:";}},getXMLObj:function(inp,type){var XMLObj=null;if(window.ActiveXObject){if(type===1){XMLObj=new window.ActiveXObject("Msxml2.DOMDocument.3.0");XMLObj.async=false;XMLObj.load(inp);}else if(type===2){XMLObj=new window.ActiveXObject("Msxml2.DOMDocument.3.0");XMLObj.async=false;XMLObj.loadXML(inp);}
return XMLObj;}else if(document.implementation&&document.implementation.createDocument){if(type===1){XMLObj=document.implementation.createDocument("","",null);XMLObj.async=false;XMLObj.load(inp);}else if(type===2){var parser=new window.DOMParser();XMLObj=parser.parseFromString(inp,"text/xml");}
return XMLObj;}else{return null;}},getXMLStr:function(subTree){var out="";var z;var atrib;out=out+"<ul>\n";for(var i=0;i<subTree.childNodes.length;i++){if(subTree.childNodes[i].nodeType==1){out=out+"\t<li>"+subTree.childNodes[i].nodeName+": ";if(subTree.childNodes[i].childNodes.length===0){out=out+subTree.childNodes[i].nodeValue;for(z=0;z<subTree.childNodes[i].attributes.length;z++){atrib=subTree.childNodes[i].attributes[z];out=out+" ("+atrib.nodeName+" = "+atrib.nodeValue+")";}}else if(subTree.childNodes[i].childNodes.length>0){out=out+subTree.childNodes[i].firstChild.nodeValue;for(z=0;z<subTree.childNodes[i].attributes.length;z++){atrib=subTree.childNodes[i].attributes[z];out=out+" ("+atrib.nodeName+" = "+atrib.nodeValue+")";}
out=out+this.getXMLStr(subTree.childNodes[i]);}
out=out+"</li>\n";}}
out=out+"</ul>\n";return out;}};
