var NN;
if (window.XMLHttpRequest){
	NN = true;
} else if (window.ActiveXObject){
	NN = false;
}
function getXMLobject(method, url, onLoadHandler, onFaultHandler, waitHandler, shouldSend)
{
	// create the xobject
	var o = NN ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
	// set the onload event handler
	o.onreadystatechange = function()
	{
		// if load is complete
		if(o.readyState == 4){
			// if status's ok
			o.status == 200 ? onLoadHandler() : onFaultHandler();
		}
	}
	o.open(method, url, true);
	if(waitHandler != undefined)waitHandler();
	if(shouldSend)o.send(null);
	return o;
}

function getByID(element)
{
	return document.getElementById(element);
}
function getByTag(parentElem, tag)
{
	return parentElem.getElementsByTagName(tag);
}
function createNode(element)
{
	return document.createElement(element);
}
function createText(text)
{
	return document.createTextNode(text);
}
function append(parentElem, child)
{
	parentElem.appendChild(child);
}
function alertError(message, title, icon)
{
	alert(message);
}
function setCssClass(element, className)
{
	element.setAttribute("className", className);
	element.setAttribute("class",     className);	
}
function getNodeText(node)
{
	if(node == null)return "";
	return node.firstChild == null ? "" : node.firstChild.nodeValue;
}
function LTrim(str)
{
	var whitespace = new String(" \t\n\r");
	var s = new String(str);
	if (whitespace.indexOf(s.charAt(0)) != -1) 
	{
		var j=0, i = s.length;
		while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
		{
			j++;
		}
		s = s.substring(j, i);
	}
	return s;
}
function RTrim(str)
{
	var whitespace = new String(" \t\n\r");
	var s = new String(str);
	if (whitespace.indexOf(s.charAt(s.length - 1)) != -1) 
	{
		var i = s.length - 1;
		while ( i > 0 && whitespace.indexOf(s.charAt(i)) != -1)
		{
			i--;
		}
		s = s.substring(0, i + 1);
	}
	return s;
}
function Trim(str)
{
	str = LTrim(str);
	str = RTrim(str);
	return str;
}