// JavaScript Docume

function getXhr(){
				if(window.XMLHttpRequest) // Firefox et autres
				   xhr = new XMLHttpRequest(); 
				else if(window.ActiveXObject){ // Internet Explorer 
				   try {
			                xhr = new ActiveXObject("Msxml2.XMLHTTP");
			            } catch (e) {
			                xhr = new ActiveXObject("Microsoft.XMLHTTP");
			            }
				}
				else { // XMLHttpRequest non supporté par le navigateur 
				   alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
				   xhr = false; 
				} 
}

function loading(){

	getXhr();
				xhr.onreadystatechange = function(){
					if(xhr.readyState == 4 && xhr.status == 200){
						preload_image_object = new Array()
						var i=0;
						liste = xhr.responseText;
						var reg=new RegExp("[;]+", "g");
						tableau=liste.split(reg);
						cont=0;
						time1=setTimeout("next()",10);
					}

				}
				
				var fond=document.getElementById('fond');
				fond.style.width= window.innerWidth +'px';
				fond.style.height= window.innerHeight +'px';
				
				var logo_intro=document.createElement("div");
				logo_intro.id="logo_intro";
				
				var loading=document.createElement("div");
				loading.id="loading";
				
				var masque=document.createElement("div");
				masque.id="masque";
				
				loading.appendChild(masque);
				logo_intro.appendChild(loading);
				fond.appendChild(logo_intro);
				
				xhr.open("POST",'nb_img.php',true);
				xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
				//xhr.send(" ");
				time1=setTimeout("next()",10);
}

function next(){
	//alert('in');
	if(document.getElementById('loading').offsetWidth < document.getElementById('masque').offsetWidth){
		time1=setTimeout("next()",10);
		document.getElementById('loading').style.width = document.getElementById('loading').offsetWidth + 1 +"px";	
	}else{
		time1=setTimeout("$('#fond').fadeOut('slow')",2000);
	}
}
