
function voteAjax(id,note)
{
    var xhr=null;
    
    if (window.XMLHttpRequest) { 
        xhr = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) 
    {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
    }
    //on définit l'appel de la fonction au retour serveur
    xhr.onreadystatechange = function () {
		if (xhr.readyState == 4) {
			if(xhr.status == 200)
			writediv ('voteResultArea'+id,xhr.responseText);
			document.getElementById('voteArea'+id).innerHTML = "";
			//alert(xhr.responseText);
		}
    
	}
    //on appelle le fichier reponse.txt
    xhr.open("GET", "voteAPI.php?note="+note+"&id="+id, true);
    xhr.send(null);

}

/*
function ajax(article)
{
    var xhr=null;
    
    if (window.XMLHttpRequest) { 
        xhr = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) 
    {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
    }
    //on définit l'appel de la fonction au retour serveur
    xhr.onreadystatechange = function () {
		if (xhr.readyState == 4) {
			if(xhr.status == 200)
			writediv (xhr.responseText);
			//alert(xhr.responseText);
		}
    
	}
    //on appelle le fichier reponse.txt
    xhr.open("GET", "getArticleAjax.php?name="+article, true);
    xhr.send(null);

}
*/
/*
function ajaxList(categorie)
{
    var xhr=null;
    
    if (window.XMLHttpRequest) { 
        xhr = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) 
    {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
    }
    //on définit l'appel de la fonction au retour serveur
    xhr.onreadystatechange = function () {
		if (xhr.readyState == 4) {
			if(xhr.status == 200)
			writediv (xhr.responseText);
			//alert(xhr.responseText);
		}
    
	}
    //on appelle le fichier reponse.txt
    xhr.open("GET", "getListArticleAjax.php?categorie="+categorie, true);
    xhr.send(null);

}
*/

function ajaxLoadContentAndRight(url, param){
	wait(true);
	ajaxLoad(url+param, 'mainContent');
	ajaxLoad('rightMenuAjax.php'+param,'rightMenu');
	
}

function ajaxLoad(url, div)
{
	//alert(url);
	
    var xhr=null;
    
    if (window.XMLHttpRequest) { 
        xhr = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) 
    {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
    }
    //on définit l'appel de la fonction au retour serveur
    xhr.onreadystatechange = function () {
	
		if (xhr.readyState == 4) {
			if(xhr.status == 200) {
				writediv (div,xhr.responseText);
				if (div=='mainContent') wait(false);
				//alert(xhr.responseText);
			}
		}
    
	}
    //on appelle le fichier reponse.txt
    xhr.open("GET", url, true);
    xhr.send(null);
}
/*

	function buildURL(page,code,prefix){
		return "javascript:ajaxLoad('action.php?page="+page+"&code="+code+"&prefix="+prefix);";
	}
*/

function writediv(id,texte)
     {
     	document.getElementById(id).innerHTML = texte;
     	
     }
	 
	 function wait(bool){
		document.getElementById('wait').style.display=(bool)?"block":"none";
		
		var inputs = document.getElementsByTagName('input');
		//alert(inputs.length);
		for (var i = 0; i < inputs.length; i++) { 
			//alert(inputs[i].type);
			inputs[i].style.display = (!bool)?"block":"none";
		}	
		var mainContent = document.getElementById('mainContent');
		mainContent.style.display = (!bool)?"block":"none";
		location.href='#';
	 }
