
function loadUrlCallback(method, dest, func) { 
    try { 
        xmlhttp = new XMLHttpRequest();
    } catch (trymicrosoft) {
        try {
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (othermicrosoft) {
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (failed) {
                xmlhttp = false;
            }
        }
    }
    
    if (!xmlhttp)
    	alert("Din webbläsare stödjs inte. Buggrapportera i forumet, tack.");
    
    // the xmlhttp object triggers an event everytime the status changes
    // triggered() function handles the events  
    xmlhttp.onreadystatechange = func;

    // open takes in the HTTP method and url.  
    xmlhttp.open(method, dest); 
    
    // Try to disable IE caching...
	xmlhttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
	xmlhttp.setRequestHeader("Cache-Control", "no-cache");

	// send the request. if this is a POST request we would have  
    // sent post variables: send("name=aleem&gender=male)  
    // Moz is fine with just send(); but  
    // IE expects a value here, hence we do send(null);  
    xmlhttp.send(null); 
} 

function loadurl(method, dest) {
	document.getElementById("output").innerHTML = "<div align=\"center\"><br/><br/><br/><br/><img src=\"pics/wait30trans.gif\"/><br/><br/><br/><br/></div>"; 
	return loadUrlCallback(method, dest, triggered);
}

function triggered() { 
    // if the readyState code is 4 (Completed)  
    // and http status is 200 (OK) we go ahead and get the responseText  
    // other readyState codes:  
    // 0=Uninitialised 1=Loading 2=Loaded 3=Interactive  
    if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) { 
        // xmlhttp.responseText object contains the response.  
        document.getElementById("output").innerHTML = xmlhttp.responseText; 
    }
}

