/*****************************************************************************
 iefixes.js library
 ==================
 

 (c) 2006-07-08 Nick Moon (Software Services) www.nixsoft.co.uk
******************************************************************************/

/******************************************************************************

 Emulation of standard DOM/XML/XSLT classes for IE
 =================================================

 The following classes are defined for IE and emulate (partially) the behaviour
 of the Firefox/W3C standard. In other words IE is patched so it looks like
 Firefox.

 Classes emulate:

  * DOMParser
  * XMLHttpRequest
  * XMLSerializer
  * XSLTProcessor

*******************************************************************************/

if (typeof window.getComputedStyle == 'undefined') {
  
  window.getComputedStyle = function(el, pseudoEl) {
    return el.currentStyle;
  }

}

if (typeof DOMParser == 'undefined') {

  /* if IE need to define DOMParser */

  DOMParser = function() {

  }

  DOMParser.prototype.parseFromString = function(text, contentType) {
    var doc = new ActiveXObject("MSXML2.DOMDocument");
    doc.loadXML(text);
    if (doc.xml == '') {
      var pe = doc.parseError;
      doc.loadXML("<parsererror>Error in XML:  " + pe.reason + "\n in line:"
        + pe.line +' col:' + pe.linepos + " " + EscapeXML(pe.srcText) + "</parsererror>");
      alert(doc.documentElement.xml);
    };
    return doc;
  }

}

if (typeof XMLHttpRequest == 'undefined') {

  /* if IE6 or below  need to define XMLHttpRequest */

  XMLHttpRequest = function() {
    return new ActiveXObject("Microsoft.XMLHTTP");
  }

}


if (typeof XMLSerializer == 'undefined') {

  /* if IE need to define XMLSerializer */

  XMLSerializer = function() {

  }

  XMLSerializer.prototype.serializeToString = function(node) {
    return node.xml;
  }

}

if (typeof XSLTProcessor == 'undefined') {

  /* if IE need to define XSLTProcessor */

  /* not most methods aren't implemented. A more complete example would include
  the relevant ActiveX processor and wrap that... */

  XSLTProcessor = function() {
    this._xslt = null;
  }

  XSLTProcessor.prototype.clearParameters = function() {
    //Not implemented
  }

  XSLTProcessor.prototype.getParameter = function(namespaceURI, localName) {
    //Not implemented
  }

  XSLTProcessor.prototype.importStylesheet = function(stylesheet) {
    this._xslt = stylesheet;
  }

  XSLTProcessor.prototype.removeParameter = function(namespaceURI, localName) {
    //Not implemented
  }

  XSLTProcessor.prototype.reset = function() {
    //Not implemented
  }

  XSLTProcessor.prototype.setParameter = function(namespaceURI, localName, value) {
    //Not implemented
  }

  XSLTProcessor.prototype.transformToDocument = function(sourceNode) {
    var result = new ActiveXObject('MSXML2.DOMDocument');
    sourceNode.transformNodeToObject(this._xslt, result);
    return result;
  }

  XSLTProcessor.prototype.transformToFragment = function(sourceNode, ownerDocument) {
    //Not implemented
  }

}



