DOM = {
	/**
	 * Convenience method for creating HTMLElements without writing 15,0000 lines of code.
	 * Originally by:
	 * http://spudly.shuoink.com/2008/02/20/using-the-xml-dom-without-writing-150000-lines-of-code/
	 */
	createElements: function (args) {  
		var element;

		if (typeof args == "string") {  
			element = document.createTextNode(args);  
		} else if ( typeof(args) == "object" ) {  
			element = document.createElement(args.tag);
			if ( args.attributes ) {
				for (var i in args.attributes) {
					if (i === "className") {
						element.className = args.attributes[i];
					} else {
						element.setAttribute(i, args.attributes[i]);
					}
				}
			}
			if (args.style) {
				for (var i in args.style) {
					element.style[i] = args.style[i];
				}
			}
			if (args.children) {
				for (var i = 0; i < args.children.length; i++) {
					element.appendChild(DOM.createElements(args.children[i]));
				}
			}
		}
		return element;  
	},
	
	/**
	 *	Gets the HTMLElements under a given parent with an attribute
	 */
	getElementsByAttribute: function (parent, attribute) {
		var all = parent.all || parent.getElementsByTagName("*");
		var elements = [];
		for (var i = 0; i < all.length; i++) {
			if (all[i].getAttribute && all[i].getAttribute(attribute)) {
				elements.push(all[i]);
			}
		}
		return elements;
	},
	
	/**
	 *  Gets the actual style property for a given element
	 *	Original by John Resig
	 */
	getStyle: function (elem, name) {
		if (elem.style[name]) {
			return elem.style[name];
		} else if (elem.currentStyle) {
			return elem.currentStyle[name];
		} else if (document.defaultView && document.defaultView.getComputedStyle) {
			name = name.replace(/([A-Z])/g, "-$1");
			name = name.toLowerCase();
			var s = document.defaultView.getComputedStyle(elem, "");
			return s && s.getPropertyValue(name);
		} else {
			return null;
		}
	}
};