var $ = function(sid){ return document.getElementById(sid) ; }

// ====================================
// create new element
// ====================================
createEl = function(t, a, y, x) {
	var e = document.createElement(t);
	if (a) 
	{
		for (var k in a) 
		{
			if (k == 'class') e.className = a[k];
			else if (k == 'id') e.id = a[k];
			else e.setAttribute(k, a[k]);
		}
     }
    if (y) { for (var k in y) e.style[k] = y[k]; }
    if (x) { e.appendChild(document.createTextNode(x)); }
    return e;
}


function Trim(sString)
{
	return sString.replace(/(^[\s\t\n]*)|([\s\t\n]*$)/g, '') ;
}

function GetXmlHttpObject()
{
	try
  	{
  		// Firefox, Opera 8.0+, Safari
  		xmlHttp=new XMLHttpRequest();
  	}
	catch (e)
  	{
  		// Internet Explorer
  		try
	    	{
	    		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	    	}
  		catch (e)
	    	{
	    		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	    	}
  	}
	return xmlHttp;
}
