function DOM(_1){
this.temp=SObject;
this.temp();
delete this.temp;
this.ie=false;
this.loaded=false;
this.loadOK;
this.stylesheet;
this.rootElement=(_1==undefined)?"root":_1;
this.getDOMDocument=function(){
var _2;
if(document.implementation&&document.implementation.createDocument){
Node.prototype.__defineGetter__("xml",_Node_getXML);
_2=document.implementation.createDocument("",this.rootElement,null);
_2.parent=this;
_2.addEventListener("load",function(_3){
this.parent.loaded=true;
},false);
}else{
this.ie=true;
var _4=new Array("MSXML4.DOMDocument","MSXML3.DOMDocument","MSXML2.DOMDocument","MSXML.DOMDocument","Microsoft.XmlDom");
for(var i=0;i<_4.length;i++){
try{
_2=new ActiveXObject(_4[i]);
_2.async=true;
var _6=_2.createElement(this.rootElement);
_2.appendChild(_6);
break;
}
catch(e){
}
}
if(_2.documentElement.nodeName!=this.rootElement){
throw new Error("Could not create DOM document.");
}
_2.onreadystatechange=new Function(undefined,"if (SOBS["+this.id+"].document.readyState == 4) SOBS["+this.id+"].loaded = true");
}
return _2;
};
this.document=this.getDOMDocument();
this.rDocument=this.getDOMDocument();
this.setDocument=function(_7){
this.queue("loadDocument",_7);
};
this.loadDocument=function(){
if(this.loaded){
this.loaded=false;
this.rDocument=this.document;
this.document=this.getDOMDocument();
}
this.document.load(this.cArgs);
};
this.loadDocumentCheck=function(){
if(this.loaded){
if(!this.ie&&(this.document.getElementsByTagName("parsererror").length>0)){
this.addError(this.document.getElementsByTagName("parsererror").item(0).firstChild.xml);
this.document=this.rDocument;
this.loadOK=false;
}else{
if(this.document.xml==""){
this.addError("Failed loading document: "+this.cArgs);
this.document=this.rDocument;
this.loadOK=false;
}else{
this.loadOK=true;
}
}
return true;
}else{
return false;
}
};
this.appendDocument=function(_8,_9){
var _a=new Array;
_a["dom"]=_8;
_a["pElement"]=_9;
this.queue("append",_a);
};
this.appendCheck=function(){
if(this.cArgs["dom"].idle()){
var _b=this.cArgs["dom"].document.documentElement.cloneNode(true);
if(this.cArgs["pElement"]==undefined){
this.document.documentElement.appendChild(_b);
}else{
this.cArgs["pElement"].appendChild(_b);
}
return true;
}else{
return false;
}
};
this.setStylesheet=function(_c){
this.queue("loadStylesheet",_c);
};
this.loadStylesheet=function(){
this.stylesheet=new DOM;
this.stylesheet.setDocument(this.cArgs);
};
this.loadStylesheetCheck=function(){
return this.stylesheet.idle();
};
this.applyStylesheet=function(){
this.queue("transform");
};
this.transform=function(){
if(this.stylesheet.hasErrors()){
throw new Error("Stylesheet DOM contains errors:{stylesheet error:"+this.stylesheet.getErrors()+"}");
}
try{
if(this.ie){
this.transformed=this.document.transformNode(this.stylesheet.document);
}else{
var _d=new XSLTProcessor();
_d.importStylesheet(this.stylesheet.document);
this.transformed=_d.transformToDocument(this.document).xml;
}
}
catch(e){
throw new Error("Failed applying stylesheet:{native error:"+e.toString()+"}");
}
};
this.removeChildNodes=function(_e){
this.queue("removeChildren",_e);
};
this.removeChildren=function(){
if(this.cArgs==undefined){
this.cArgs=this.document.documentElement;
}
while(this.cArgs.childNodes.length>0){
this.cArgs.removeChild(this.cArgs.firstChild);
}
};
this.addChildNode=function(_f,_10,_11){
var _12=new Array;
_12["pNode"]=_f;
_12["name"]=_10;
_12["atts"]=_11;
this.queue("addChild",_12);
};
this.addChild=function(){
var _13=this.document.createElement(this.cArgs["name"]);
for(att in this.cArgs["atts"]){
_13.setAttribute(att,this.cArgs["atts"][att]);
}
this.cArgs["pNode"].appendChild(_13);
};
this.hasErrors=function(){
return (this.errors.length>0);
};
this.clear=function(){
this.kJobs=new Array;
this.transformed=null;
this.cycles=0;
};
}
DOM.prototype=new SObject();
function _Node_getXML(){
var _14=new XMLSerializer;
var _15=_14.serializeToString(this);
return _15;
}

