function loadImage() {
	var limg = document.getElementsByTagName('img');
	var l = limg.length;
	
	for(var i=0;i<l;i++) {
		limg[i].src = limg[i].getAttribute('tosrc');
		limg[i].setAttribute('tosrc', '');
		limg[i].removeAttribute("tosrc");
		limg[i].onLoad = function () {
			this.style.backgroundImage = 'none';					
		}
	}
}
window.onload = function() {
	window.scrollTo(0, 1)
	loadImage();
}
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 showImage(image_url, container_id){
	var container = document.getElementById(container_id);
	var http = getHTTPObject();
	var timeoutId;
	container.innerHTML = '<img src="image/blank.gif" align="center" class="imgArt" />';
	http.open("GET","script/loadImage.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 showLegende(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;
				if (htmlLeg.length>0){
					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
	);
}
