//------------------------------------------------------------

function GetXmlHttpObject(handler)
{
	var objXmlHttp = null;
	
	//I HATE JQUERY, WHICH INSTALLS ITSELF IN XMLHttpRequest
	if ( typeof( window.XMLHttpRequest ) == 'undefined' || ( typeof( window.XMLHttpRequest ) == 'function' && window.XMLHttpRequest.toString().match( 'MSIE 5' ) ) )
	{
		//alert( "MS" );
		// Microsoft
		objXmlHttp = GetMSXmlHttp();
		if (objXmlHttp != null) objXmlHttp.onreadystatechange = handler;
	} 
	else
	{
		//alert( "Moz" );
		// Mozilla | Netscape | Safari
		objXmlHttp = new XMLHttpRequest();
		if (objXmlHttp != null)
		{
			objXmlHttp.onreadystatechange = handler; //WAS onload
			objXmlHttp.onerror = handler;
		}
	}
	
	return objXmlHttp; 
} 

//------------------------------------------------------------

function GetMSXmlHttp() 
{
	var xmlHttp = null;
	var clsids = ["Msxml2.XMLHTTP.6.0",
				  "Msxml2.XMLHTTP.4.0",
				  "Msxml2.XMLHTTP.3.0"];
	for(var i=0; i<clsids.length && xmlHttp == null; i++) {
		xmlHttp = CreateXmlHttp(clsids[i]);
	}
	return xmlHttp;
}

//------------------------------------------------------------

function CreateXmlHttp(clsid) 
{
	var xmlHttp = null;
	try {
		xmlHttp = new ActiveXObject(clsid);
		lastclsid = clsid;
		return xmlHttp;
	}
	catch(e) {}
}

//------------------------------------------------------------

function SendXmlHttpRequest( xmlhttp, url ) 
{
	xmlhttp.open('GET', url+ '&r=' + Math.random(), true); 
	xmlhttp.send(null); 
}

//------------------------------------------------------------

function stateChanged()
{
	if ( xmlHttp.readyState==4 || xmlHttp.readyState=="complete" ) document.getElementById('contentbox').innerHTML=xmlHttp.responseText;
} 


