function $c(sel, base) {
  return (base || document.body).querySelectorAll(sel);
}

function hasProperty(obj, p1) {
  var i, t, max = arguments.length;
  for (i = 1; i < max; ++i) {
    t = typeof obj[arguments[i]];
    if (t == "undefined")
      return false;
    else
      obj = obj[arguments[i]];
  }
  return true;
}

if (!Array.prototype.map)
{
  Array.prototype.map = function(fun /*, thisp*/)
  {
    var len = this.length >>> 0;
    if (typeof fun != "function")
      throw new TypeError();

    var res = new Array(len);
    var thisp = arguments[1];
    for (var i = 0; i < len; i++)
    {
      if (i in this)
        res[i] = fun.call(thisp, this[i], i, this);
    }

    return res;
  };
}

var isNode;
if (window.Node) {
  isNode = function (x) { return x instanceof Node; }
} else {
  // Best we can do in MSIE
  isNode = function (x) { return (typeof(x) == "object") && x.nodeName; }
}

var parseXml;
if (window.DOMParser) {
  parseXml = function (xml) {
    if (isNode(xml))
      return xml;
    return (new DOMParser()).parseFromString(text,"text/xml");
  };
} else {
  parseXml = function (xml) {
    if (isNode(xml))
      return xml;
    var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    xmlDoc.async = "false";
    xmlDoc.loadXML(xml);
    return xmlDoc;
  };
}


