/*
////////////////////////////////////////
// GET ELEMENT - spawns a new element and attaches it with properties.
// Basically, allows a shorter syntax for document.createElement
// @author Oded Idan

Example Syntax:
	var newDiv = getElement("DIV",
		{
			innerHTML : "I am the DIV's inner HTML",
			className : "I am the DIV's class",
			style : {
				backgroundColor : "#F00",
				border : "1px solid #FFFFFF"
			}
		}
	);

*/

var getElement = function(tag, attr) {
	var e = document.createElement(tag);
	for (i in attr) {
		switch (i) {
			case 'innerHTML':
				e.innerHTML = attr[i];
			break;
			case 'className':
			case 'class':
				e.className = attr[i];
			break;
			case 'style':
				for (j in attr[i]) {
					e.style[j] = attr[i][j];
				}
			break;
			default:
			e.setAttribute(i, attr[i]);
			break;
		}
	}
	return e;
}