function determineObject(referenceObject)
{
	typeof(referenceObject) == "string" ? refObject = document.getElementById(referenceObject) : ""; // 1
	typeof(referenceObject) == "object" ? refObject = referenceObject : ""; // 2
	
	return refObject; // 3
}

function newElem(referenceObject, referenceTag, referenceAttributes, referenceStyle, referenceEvents) // 1
{
	refObject  = determineObject(referenceObject); // 2
	newElement = refObject.appendChild(document.createElement(referenceTag)); // 3
	
	if (referenceAttributes) parseAttributes(newElement, referenceAttributes); // 4
	if (referenceStyle)      parseStyle(newElement, referenceStyle); // 5
	if (referenceEvents)     parseEvents(refObject, referenceEvents); // 6
}

function parseAttributes(refObj, objAttrib) // 1
{
	for (a = 0; a < objAttrib.length; a++) // 2
	{
		attribName  = objAttrib[a].split("::")[0]; // 3
		attribValue = objAttrib[a].split("::")[1]; // 4
		
		eval('refObj.' + attribName + ' = "' + attribValue + '"'); // 5
	}
}

function parseStyle(refObj, objStyle) // 1
{
	for (s = 0; s < objStyle.length; s++) // 2
	{
		styleName  = objStyle[s].split("::")[0]; // 3
		styleValue = objStyle[s].split("::")[1]; // 4
		
		eval('refObj.style.' + styleName + ' = "' + styleValue + '"'); // 5
	}
}

function parseEvents(refObj, objEvents) // 1
{
	for (e = 0; e < objEvents.length; e++) // 2
	{
		eventName =  objEvents[e].split("::")[0]; // 3
		eventValue = objEvents[e].split("::")[1]; // 4
		
		switch (eventName) // 5
		{
			case "onabort":
				refObj.onabort = new Function(eventValue);
			break;
			
			case "onblur":
				refObj.onblur = new Function(eventValue);
			break;
			
			case "onchange":
				refObj.onchange = new Function(eventValue);
			break;
			
			case "onclick":
				refObj.onclick = new Function(eventValue);
			break;
			
			case "ondblclick":
				refObj.ondblclick = new Function(eventValue);
			break;
			
			case "onerror":
				refObj.onerror = new Function(eventValue);
			break;
			
			case "onfocus":
				refObj.onfocus = new Function(eventValue);
			break;
			
			case "onkeydown":
				refObj.onkeydown = new Function(eventValue);
			break;
			
			case "onkeypress":
				refObj.onkeypress = new Function(eventValue);
			break;
			
			case "onkeyup":
				refObj.onkeyup = new Function(eventValue);
			break;
			
			case "onload":
				refObj.onload = new Function(eventValue);
			break;
			
			case "onmousedown":
				refObj.onmousedown = new Function(eventValue);
			break;
			
			case "onmousemove":
				refObj.onmousemove = new Function(eventValue);
			break;
			
			case "onmouseout":
				refObj.onmouseout = new Function(eventValue);
			break;
			
			case "onmouseover":
				refObj.onmouseover = new Function(eventValue);
			break;
			
			case "onmouseup":
				refObj.onmouseup = new Function(eventValue);
			break;

			case "onreset":
				refObj.onreset = new Function(eventValue);
			break;
			
			case "onresize":
				refObj.onresize = new Function(eventValue);
			break;
			
			case "onselect":
				refObj.onselect = new Function(eventValue);
			break;
			
			case "onsubmit":
				refObj.onsubmit = new Function(eventValue);
			break;
			
			case "onunload":
				refObj.onunload = new Function(eventValue);
			break;
		}
	}
}

/*window.onload = function loader()
{
	//if (document.addEventListener) alert(1);
	//if (document.attachEvent) alert(2);
}

function joer(as)
{
	alert(as);
}*/