
var xget;
var is_ie = (navigator.userAgent.indexOf('MSIE') >= 0) ? 1 : 0; 
var callback;
var ajaxXMLDocument;

function stateChangeHandler()
{
    var str = "";
	
	if (xget.readyState == 4 || xget.readyState == 'complete') 
	{
	    str = xget.responseText;

        if(xget.responseXML)
	        ajaxXMLDocument = xget.responseXML.documentElement;

	    // If the xml document is not null, we just want to invoke
	    // the callback method without parameters.  Otherwise,
	    // invoke the callback method with the string from the responseText.
	    if (ajaxXMLDocument)
	        eval(callback + "()");
        else if (str)
            eval(callback + "(\"" + str + "\")");
    }
}

function getContent(url, callbackfunction)
{
    callback = callbackfunction;
    xget = getXMLHttp();
	xget.open ("GET", url, true);
	xget.send (null);
}

function getXMLHttp()
{
	var objHttp;
	if (is_ie)
	{
		objHttp = new ActiveXObject('Microsoft.XMLHTTP');
		objHttp.onreadystatechange = stateChangeHandler;
	}
	else
	{
		objHttp = new XMLHttpRequest();
		objHttp.onload = stateChangeHandler;
		objHttp.onerror = stateChangeHandler;
	}
	
	return objHttp;
}

