function TAG(){
	var tags = ['html', 'head', 'title', 'meta', 'body', 'div', 'span', 'a', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'b', 'strong', 'i', 'u', 'br', 'big', 'center', 'dd', 'dl', 'dt', 'em', 'embed', 'font', 'form', 'input', 'textarea', 'select', 'option', 'button', 'hr', 'img', 'ul', 'li', 'menu', 'link', 'marque', 'ol', 'p', 'small', 'table', 'thead', 'tbody', 'tr', 'th', 'td', 'tt', 'style', 'script', 'abbr', 'acronym', 'address', 'bdo', 'blockquote', 'cite', 'q', 'code', 'ins', 'del', 'dfn', 'kbd', 'pre', 'samp', 'var', 'base', 'area', 'map', 'object', 'param', 'tfoot', 'col', 'colgroup', 'caption', 'optgroup', 'label', 'fieldset', 'legend', 'noscript', 'sub', 'sup', '', '', '', ''];
	var events = ['abort', 'blur', 'change', 'click', 'dblclick', 'error', 'focus', 'keydown', 'keypress', 'keyup', 'load', 'mousedown', 'mousemove', 'mouseout', 'mouseover', 'mouseup', 'reset', 'resize', 'select', 'submit', 'unload'];
	for(var i=0; i<tags.length; i++){
		this.addFunction(tags[i], events);
	}
}
	
TAG.prototype.addFunction = function(tag, events){
	this[tag] = function(attrs){;
		var el = document.createElement(tag);
		for(var i=0; i<arguments.length; i++){
			var arg = arguments[i];
			if(i == 0 && typeof arg != ('string' || 'number')){
				for(var attr in attrs){
					var found = false;
					for(var a=0; a<events.length; a++){
						if('on'+events[a] == attr.toLowerCase()){
							el['on'+events[a]] = attrs[attr];
							found = true;
							break;
						}
					}
					if(!found){
						//attr2 = attr == 'class' ? window.ActiveXObject?'className':attr:attr;
						if(window.ActiveXObject){
							attr2 = attr == 'class'?'className':attr;
							el[attr2] = attrs[attr];
						}else{
							el.setAttribute(attr, attrs[attr]);
						}
					};
				}
			}else{
				if(typeof arg == ('string' || 'number')){
					//el.innerHTML = arg;
					var e = document.createElement('div');
					e.innerHTML = arg;
					el.appendChild(document.createTextNode(arg == '&nbsp;'?' ':e.innerHTML));
				}else{
					el.appendChild(arg);
				}
			}
		}
		return el;
	}
}

var TAG = new TAG();
