HelperFunctions={
  _:null



  , parseFromString:function(str) {
      if(window.ActiveXObject) {
        xml=new ActiveXObject('MSXML.DomDocument');
        xml.async=false;
        xml.loadXML(str);
        return xml;
      } else if(window.DOMParser) {
        return new DOMParser().parseFromString(str, 'text/xml');
      }
    }
  
  
  
  , getXMLHttpRequest:function() {
      if(window.XMLHttpRequest) return new XMLHttpRequest();
      else if(window.ActiveXObject) {
        var req=null;
        for(var l=['MSXML2.XMLHTTP', 'Microsoft.XMLHTTP']; l.length && (req=new ActiveXObject(l.shift())););
        return req;
      } else return null;
    }



  , getEvalXPathFunction:function(namespaces) {
      var resolver={ns:namespaces, lookupNamespaceURI:function(p) { return this.ns[p]; }};
      var nsProps=''; {
        for(var p in namespaces) nsProps+=' xmlns:'+p+'="'+namespaces[p]+'"';
      }
      if(window.XPathEvaluator) {
        var xpathEvaluator=new window.XPathEvaluator();
        return function(node, xpath) {
          var result=[]
              , it=xpathEvaluator.evaluate(xpath, node, resolver, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null)
          ;
          for(var n; n=it.iterateNext(); ) result.push(n);
          return result;
        }
      } else if(document.evaluate) {
        return function(node, xpath) {
          var result=[]
              , it=node.document.evaluate(xpath, node, resolver, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null)
          ;
          for(var n; n=it.iterateNext(); ) result.push(n);
          return result;
        }
      } else if(window.ActiveXObject) {
        return function(node, xpath) {
          var result=[];
          node.ownerDocument.setProperty('SelectionNamespaces', nsProps);
          node.ownerDocument.setProperty('SelectionLanguage', 'XPath');
          for(var i=0, nodes=node.selectNodes(xpath); i<nodes.length; i++) result.push( nodes[i] );
          return result;
        }
      } else return null;
    }



  , getWindowSize:function() {
      var obj;
      if( (obj=window) && obj.innerWidth ) return [obj.innerWidth, obj.innerHeight];
      else if( (obj=document.documentElement) && obj.clientWidth ) return [obj.clientWidth, obj.clientHeight];
      else if( (obj=document.body) && obj.clientWidth ) return [obj.clientWidth, obj.clientHeight];
      else return null;
    }



  , getStylePos:function(htmlElem) {
      if(!htmlElem) return null;
      var pos=null;
      if(window.getComputedStyle) {
        var style=window.getComputedStyle(htmlElem, null);
        pos=[parseInt(style.getPropertyValue('left')), parseInt(style.getPropertyValue('top'))];
      } else if(htmlElem.currentStyle) {
        pos=[parseInt(htmlElem.currentStyle.left), parseInt(htmlElem.currentStyle.top)];
      }
      return pos;
    }



  , stopPropagation:function(e) {
      if(e) {
        e.cancelBubble=true;
        if(e.stopPropagation) e.stopPropagation();
        if(e.preventDefault) e.preventDefault();
      }
      return false;
    }



}
