var MSXML  = (clsMSXML) ? new clsMSXML() : null;

Logger.info("MSXML", (MSXML) ? "loaded." + MSXML.version() : "failed to load.");

 
 function clsMSXML()
 {
  // Local Variables
var INSTALLPAGE = (window.location.href.indexOf("troubleshoot")>=0) ? "" : "XMLinstall.html";

  var m_v   = new Array(
       ''
        ,'.5.0'
        ,'.4.0'
		,'.3.0'	// We can not support version 3 //
       );
 
  var m_c   = new Array(
       'clsid:550dda30-0541-11d2-9ca9-0060b0ec3d39'
        ,'clsid:88D969E5-F192-11D4-A65F-0040963251E5'
        ,'clsid:88d969c4-f192-11d4-a65f-0040963251e5'
		,'clsid:f5078f39-c551-11d3-89b9-0000f81fe221'	// We can not support version 3 //
       );
 
  var m_i   = 0;
 
  var m_o  = null;
 
  // Properties
  this.version    = _v;
  this.ordinal   = _o;
  this.dsoClassID   = _c;
 
  // Methods
  this.DOMDocument		= _XD;
  this.XMLHTTP			= _XH;
  this.XMLObject		= _XO;
  this.XMLSchemaCache	= _XS;
  
  var SELFTEST = _XD(false); SELFTEST = null;

 function _v()
 {
  if(!m_i) _XD(true);
  return ((m_v[m_i].charAt(0)=='.') ? m_v[m_i].substr(1) : m_v[m_i]);
  
 }
 
 function _o()
 {
  var x=null;
 
  if(!m_i) x= _XD(true);
 
  if(m_o==null)
  {
   if(x==null) x= _XD(true);
   if(x!=null)
   {
    x.async=false;
    x.loadXML("<d><r>1</r><r>0</r></d>");
    m_o = parseInt(x.selectSingleNode('//r[1]').text);
   }
  }
  return m_o;
 }
 
 function _c()
 {
  if(!m_i) _XD(true);
  return m_c[m_i];
 }
 
 function _XO(p, na)
 {
  if(na==null) na=false;
  var x = null,e;
 
  if(m_i==0) m_i=1; //  Never start at 0 //
 
  for(var i=m_i; i<m_v.length; i++)
  {
   try
   {
    x = new ActiveXObject(p+m_v[i]);
    m_i=i;
    try { x.setProperty("NewParser", true);} catch(ee) {}
 	try { x.setProperty("SelectionLanguage", "XPath");} catch(ee) {}

    return x; // If we have a success then get out //
   }
   catch(e) {}
  }
  m_i=0; // Failed //
  if(!na && INSTALLPAGE!="") top.location.href = INSTALLPAGE;
  return null;
 }
 
 function _XD(na) { return _XO('MSXML2.DOMDocument',na); }
 
 function _XH(na) {  return _XO('MSXML2.XMLHTTP',na); }
 
 function _XS(na) {  return _XO('MSXML2.XMLSchemaCache',na); }

 }

