function Objectdivs(div, content) {
	if (document.getElementById) {
		document.getElementById(div).innerHTML = content;
	} else {
		if (document.layers) {
			document.div.innerHTML = content;
		} else {
			document.all.div.innerHTML = content;
		}
	}
};
        
function Gotolink(FILE, div) {
	
	var METHOD = 'GET';
	var DATA = null;
		
	if (METHOD == 'GET' && DATA != null) {
		FILE += '?' + DATA;
		DATA = null;
	}
	var httpRequestM = null;   
	if (window.XMLHttpRequest) {   // Firefox   
		httpRequestM = new XMLHttpRequest();
	} else if (window.ActiveXObject) {   // Internet Explorer   
		httpRequestM = new ActiveXObject("Microsoft.XMLHTTP");
	} else {   // XMLHttpRequest non supporté par le navigateur   
		return "Votre navigateur ne supporte pas les objets XMLHTTPRequest...";
	}   
	httpRequestM.open(METHOD, FILE, true);
	httpRequestM.onreadystatechange = function() {   
		if (httpRequestM.readyState == 4) {
			if(httpRequestM.responseText != ''){
				Objectdivs(div, httpRequestM.responseText);
			}
		}
	}
	if (METHOD  == 'POST') {
		httpRequestM.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	}
	httpRequestM.send(DATA);   
};

var global_href;
var global_div;

function loadImg(img){
	href = global_href;
	div = global_div;
	if(img.complete){
		window.clearInterval(timer);
		Gotolink(href, div);
	}
}


function ViewContent(href, div, h_img,image) {
	var marge_haute_loader = (h_img-16)/2;
	//alert(h_img+'\n'+marge_haute_loader);
	var wait = '<div id="loader" style="text-align:center; height:'+h_img+'px; "><img src="img/loading.gif" alt="" width="16" height="16" border="0" style="margin-top:'+marge_haute_loader+'px;"></div>';
	img = new Image();
	//alert(image);
	img.src = image;	
	Objectdivs(div, wait);
	//alert(href);
	global_href = href;
	global_div = div;
	timer = window.setInterval("loadImg(img)",100);
};

/*function ViewContent(url,id)
{
	var xhr_object = null;
	var position = id;
	   if(window.XMLHttpRequest)  { xhr_object = new XMLHttpRequest(); }
	  else {
	    if (window.ActiveXObject)  xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); 
	  }
	// On ouvre la requete vers la page désirée
	xhr_object.open("GET", url, true);
	xhr_object.onreadystatechange = function(){
	if ( xhr_object.readyState == 4 )
	{
		// j'affiche dans la DIV spécifiées le contenu retourné par le fichier
		document.getElementById(position).innerHTML = xhr_object.responseText;
	}
	}
	// dans le cas du get
	xhr_object.send(null);

}*/
