/* ajax for henting av data fra hintsegne script */
/* ajax.js, frs, 12.02.2010 */

	//-------------------------- AJAX Code ---------------------------------

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)//IE6 + IE5
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}

	return xmlHttp;
}




function insertChannelData(xmlHttp,destination)
{
	if(xmlHttp.readyState == 4)
	{
		//var response  = xmlHttp.responseXML;
		//var destination = response.getElementsByTagName('destination')[0].firstChild.data;
		//var data    = response.getElementsByTagName('data')[0].firstChild.data;

		document.getElementById(destination).innerHTML = xmlHttp.responseText;
	}
}




function loadChannelData(destination, url)//, date)
{
	var xmlHttp = GetXmlHttpObject();

	if(xmlHttp == null)
	{
		return;
	}
//alert('her')
	xmlHttp.onreadystatechange = function () { insertChannelData(xmlHttp,destination); };
	xmlHttp.open('GET', url, true);
	xmlHttp.send(null);
}




function GetXmlHttpObject2()
{
	var objXMLHttp = null;


	if(window.XMLHttpRequest)
	{
		objXMLHttp = new XMLHttpRequest();

		if(objXMLHttp.overrideMimeType)
		{
			objXMLHttp.overrideMimeType('text/xml');
		}
	}
	else if(window.ActiveXObject)
	{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}


	return objXMLHttp;
}