var xmlHttp

var xmlHttp

function htmlsk_til_norsk(txt)
{
	txt = txt.replace(/ZaeligZ/g,"æ") 
	txt = txt.replace(/ZoslashZ/g,"ø")
	txt = txt.replace(/ZaringZ/g,"å")
	txt = txt.replace(/ZoumlZ/g,"ö")
	txt = txt.replace(/ZaumlZ/g,"ä")
	txt = txt.replace(/ZeacuteZ/g,"é")
	txt = txt.replace(/ZuumlZ/g,"ü")
	txt = txt.replace(/ZAEligZ/g,"Æ")
	txt = txt.replace(/ZOslashZ/g,"Ø")
	txt = txt.replace(/ZAringZ/g,"Å")
	txt = txt.replace(/ZOumlZ/g,"Ö")
	txt = txt.replace(/ZAumlZ/g,"Ä")
	txt = txt.replace(/ZEacuteZ/g,"É")
	txt = txt.replace(/ZUumlZ/g,"Ü")
	return txt
}

function norsk_til_htmlsk(txt)
{
	txt = txt.replace(/æ/g,"ZaeligZ") 
	txt = txt.replace(/ø/g,"ZoslashZ")
	txt = txt.replace(/å/g,"ZaringZ")
	txt = txt.replace(/ö/g,"ZoumlZ")
	txt = txt.replace(/ä/g,"ZaumlZ")
	txt = txt.replace(/é/g,"ZeacuteZ")
	txt = txt.replace(/ü/g,"ZuumlZ")
	txt = txt.replace(/Æ/g,"ZAEligZ")
	txt = txt.replace(/Ø/g,"ZOslashZ")
	txt = txt.replace(/Å/g,"ZAringZ")
	txt = txt.replace(/Ö/g,"ZOumlZ")
	txt = txt.replace(/Ä/g,"ZAumlZ")
	txt = txt.replace(/É/g,"ZEacuteZ")
	txt = txt.replace(/Ü/g,"ZUumlZ")
	return txt

}

function evalResponse() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		response = xmlHttp.responseText
		//alert (response)
		response = htmlsk_til_norsk(response)
		
		eval (response)
        if (typeof Behaviour == 'function')
            Behaviour.apply();
	} 
} 

function stateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("txtHint").innerHTML=xmlHttp.responseText 
	} 
} 

function GetXmlHttpObject(handler)
{ 
	var objXmlHttp=null

/*
	if (navigator.userAgent.indexOf("Opera")>=0)
	{
		alert("This example doesn't work in Opera") 
		return 
	}
*/
	ua = navigator.userAgent.toLowerCase();
	
	mozilla=false
	opera=false
	msie=false
	if (ua.indexOf("mozilla")>=0)
		mozilla=true
	if (ua.indexOf("opera")>=0)
		opera=true
		if (ua.indexOf("msie")>=0)
		msie=true	
		
	if (opera)
		browser = "moz"
	else if (!msie)
		browser = "moz"
	else if (msie)
		browser = "msie"
	else
		browser = "moz"
	
	if (browser == "moz")
	{
		objXmlHttp=new XMLHttpRequest()
		objXmlHttp.onload=handler
		objXmlHttp.onerror=handler 
		return objXmlHttp
	}

	else
	{ 
		var strName="Msxml2.XMLHTTP"
		if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
		{
			strName="Microsoft.XMLHTTP"
		} 
		try
		{ 
			objXmlHttp=new ActiveXObject(strName)
			objXmlHttp.onreadystatechange=handler 
			return objXmlHttp
		} 
		catch(e)
		{ 
			alert("Error. Scripting for ActiveX might be disabled") 
			return 
		} 
	} 

}


function straight_url_eval(url)
{
    xmlHttp=GetXmlHttpObject(evalResponse)

    xmlHttp.open('post',  url);
    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

    poststring = "rand=" + Math.random()
    xmlHttp.send(poststring)

}

function straight_url_eval_params(url, params)
{

    var x
    
    xmlHttp=GetXmlHttpObject(evalResponse)

    xmlHttp.open('post',  url);
    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

    poststring = "rand=" + Math.random()
    for (x in params)
    {  
        poststring = poststring + "&" + x + "=" + params[x]
    }
    xmlHttp.send(poststring)

}
 
