var $E = {};

$w('a abbr acronym address b big body blockquote br button caption cite '
	+ 'code col dd del div dfn dl dt em fieldset form h1 h2 h3 h4 h5 h6 '
	+ 'head hr html i img input ins kdb label legend li link meta ol '
	+ 'optgroup option p pre q samp script select small span strong style '
	+ 'sub sup table tbody td textarea tfoot th thead title tr tt ul var')

.each(function(e) {
  $E[e] = function() {
    var text, attributes = {}, children = $A();

    for (var i = 0; i < arguments.length; i++) {
      var argument = arguments[i];
      if (typeof argument == 'string')
        children.push(document.createTextNode(argument));
      else if (argument.nodeType == 1)
        children.push(argument);
      else if (argument.constructor == Array)
        children = children.concat(argument);
      else if (typeof argument == 'object')
        attributes = argument;
    }

    var element = new Element(e, attributes);
    children.each(function(c) { element.appendChild(c); });
    return element;
  }
});
