////////////////////////////// XMLHttpRequest //////////////////////////////
////	Gets the xmlhttp object for Ajax functions.						////
////////////////////////////////////////////////////////////////////////////

xmlhttp = false; 
try{ 
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
} 
catch (e){ 
	try{ 
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
	} 
	catch (E){ 
		xmlhttp = false; 
	} 
} 
if (!xmlhttp && typeof XMLHttpRequest != 'undefined'){ 
	xmlhttp = new XMLHttpRequest(); 
}


function update_kommun(name){
	target_div = document.getElementById("kommun_result");
	
	target_div.innerHTML = "";
	target_div.innerHTML = "<p>Hämtar data...</p>";
	
	var serverPage = "/inc/ajax_kommun.php?name="+name; 
	xmlhttp.open("POST", serverPage);
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			target_div.innerHTML = "";
			target_div.innerHTML = xmlhttp.responseText;
		} 
	} 
	xmlhttp.send(null);
}