// JavaScript Documentvar xmlHttp


// En funktion som gör att man kan hämta och 
// ställa in elementID överalt i koden
function mainElement(el)
{
	if(el.length > 0)
	{
		currentElement = el;
	}
	else
	{
		return currentElement;
	}
}


function stateChanged() 
{
	//alert(xmlHttp.status);
	if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
	{
		if(xmlHttp.responseText != "")
		{
			response = document.getElementById(mainElement(''));
			response.innerHTML = xmlHttp.responseText
		}
	}
}



function GetXmlHttpObject()
{
	var xmlHttp = null;
	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;
}
