function getHTTPObject() {
	var xmlhttp;
	/*@cc_on
	@if (@_jscript_version >= 5)
		try {
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (E) {
			xmlhttp = false;
			}
		}
	@else
	xmlhttp = false;
	@end @*/
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		try {
			xmlhttp = new XMLHttpRequest();
		xmlhttp.overrideMimeType("text/xml");
		} catch (e) {
			xmlhttp = false;
		}
	}
	return xmlhttp;
}

function show_image(image_url, container_id){
	var container = document.getElementById(container_id);
	
	var http = getHTTPObject();
	var timeoutId;
	container.innerHTML = "<img src='image/loading2.gif' alt='' style='float:left;text-align:center;margin:100px 0px 0px 165px;width:32px;height:32px;' />";
	http.open("GET","script/load_image.php?url="+image_url, true);
	http.onreadystatechange = function() {
		if (http.readyState == 4) {
			if (http.status == 200){
				window.clearTimeout(timeoutId);
				var htmlDoc = http.responseText;
				container.innerHTML = htmlDoc;
			}
		}
	}

	http.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	http.send("toto");
	timeoutId = window.setTimeout(
		function() {
			switch (http.readyState) {
				case 1:
				case 2:
				case 3:
					http.abort();
					//document.getElementById("statut").innerHTML = "<h2>Error Loading Data</h2>";
					//alert("Le serveur est occup̩, merci de r̩essayer ult̩rieurement!");
					break;
				default:
					break;
			}
		},
		120000 // twenty seconds
	);
}
function show_legende(legende,container_idlegende){
	
	var container_legende = document.getElementById(container_idlegende);
	
	var http = getHTTPObject();
	var timeoutId;
	
	http.open("GET","script/load_legende.php?id="+legende, true);
	http.onreadystatechange = function() {
		if (http.readyState == 4) {
			if (http.status == 200){
				
				var htmlLeg = http.responseText;
				container_legende.innerHTML = htmlLeg;
			}
		}
	}
	http.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	http.send("toto");
	timeoutId = window.setTimeout(
		function() {
			switch (http.readyState) {
				case 1:
				case 2:
				case 3:
					http.abort();
					//document.getElementById("statut").innerHTML = "<h2>Error Loading Data</h2>";
					//alert("Le serveur est occup̩, merci de r̩essayer ult̩rieurement!");
					break;
				default:
					break;
			}
		},
		120000 // twenty seconds
	);
}
