function $() { 
  var elements = new Array();

  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (typeof element == 'string') {
      element = document.getElementById(element);
    }

    if (arguments.length == 1)  {
      return element;
    }
    elements.push(element);
  }

  return elements;
}

// From: http://www.mozilla.org/docs/dom/technote/whitespace/
function is_all_ws( nod ) {
  // Use ECMA-262 Edition 3 String and RegExp features
  return !(/[^\t\n\r ]/.test(nod.data));
}
function is_ignorable( nod ) {
  if(!nod) {
    return true;
  }
  return ( nod.nodeType == 8) || // A comment node
    ( (nod.nodeType == 3) && is_all_ws(nod) ); // a text node, all ws
}