var $UNINITIALIZED = 0;
var $LOADING = 1;
var $LOADED = 2;
var $COMPLETE = 4;
///
/// Mozilla Browser Complement
/// Adding some missing 'oddie-goodie' functions to Document & Element Object
/// + loadXML
/// + setProperty
/// + selectSingleNode
/// + selectNodes
///
var $MozillaComplement = function()
{
if (typeof(window.XPathEvaluator)!='undefined')
{
var xpath = new XPathEvaluator();
var element = Element.prototype;
element.__proto__ = {__proto__: element.__proto__};
element = element.__proto__;
var attribute = Attr.prototype;
attribute.__proto__ = {__proto__: attribute.__proto__};
attribute = attribute.__proto__;
var txt = Text.prototype;
txt.__proto__ = {__proto__: txt.__proto__};
txt = txt.__proto__;
var doc = Document.prototype;
doc.__proto__ = {__proto__: doc.__proto__};
doc = doc.__proto__;
doc.loadXML = function(text)
{
var parser = new DOMParser;
var newDoc = parser.parseFromString(text, "text/xml");
// modified by Nguyen Anh Tuan
// check this first, so we cannot remove a null child
if (this.documentElement)
this.removeChild(this.documentElement);
// now we can add a new child
this.appendChild(newDoc.documentElement);
//this.replaceChild(newDoc.documentElement, this.documentElement);
};
doc.setProperty = function(name, value)
{
if(name=="SelectionNamespaces"){
namespaces = {};
var a = value.split(" xmlns:");
for (var i=1;i