// Ajax object
function GetNewXHR()
{
	var xmlhttp=false;
	
	// IE
	try 
	{
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} 
	catch (e) 
	{
		try 
		{
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch (E) 
		{
			xmlhttp = false;
		}
	}
	
	// Firefox / Mozilla / Safari 
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') 
	{
		try 
		{
			xmlhttp = new XMLHttpRequest();
		} 
		catch (e) 
		{
			xmlhttp=false;
		}
	}
	
	// Icebrowser
	if (!xmlhttp && window.createRequest) 
	{
		try 
		{
			xmlhttp = window.createRequest();
		} catch (e) 
		{
			xmlhttp=false;
		}
	}
	
	return xmlhttp;
}


function Debug(string)
{
	if (BrowserDetect.browser == "Firefox")
	{
		//console.log(string);
		alert(string);
	}
	else
	{
		document.status = string;
		//alert(string);
	}
}

function SeeXHR(strTitle, xhr)
{
	var mess = strTitle + "\n";
	try
	{
		mess += "status  : "     + xhr.status + "\n";
		mess += "statusText  : " + xhr.statusText + "\n";
	}
	catch (e)
	{
	}
	mess += "readyState : "  + xhr.readyState + "\n";
	Debug (mess);
}

function DisplayLoadingImage (readyState)
{
	var img = document.getElementById("loading");

	switch (readyState)
	{
		case 0 : // not initialised
			break;
		case 1 : // loading
			img.style.visibility="visible";
			break;
		case 2 : // loaded
			break;
		case 3 : // in treatment
			break;
		case 4 : // finished
			img.style.visibility="hidden";
			break;
		case 5 :
			break;
	}
}
