// DOM cross-platform functions

function setStyle(obj, style)
{ 
 if(obj.style)	obj.style.cssText = style;
 else			obj.setAttribute("style", style);
}

function setClass(obj, className)
{
 obj.setAttribute("class", className);
 obj.setAttribute("className", className);
}

function useFunctionString(str) { eval(str); }

function setEvent(obj, event, func)
{
 if(typeof(func) == "function")	finalFunc = function() {func.call(obj);};
 if(typeof(func) == "string")	finalFunc = function() {useFunctionString.call(obj, func)};

 if(document.addEventListener)	obj.addEventListener(event.substring(2), finalFunc, true);
 else							obj.attachEvent(event, finalFunc);
}

function removeAllNodes(obj)
{
 while(obj.hasChildNodes()) obj.removeChild(obj.firstChild);
}

function removeNode(obj)
{
 return obj.parentNode.removeChild(obj);
}
