function file(fichier)
{
    if(window.XMLHttpRequest)
        xhr_object = new XMLHttpRequest();
    else if(window.ActiveXObject)
        xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
    else
        return(false);
    xhr_object.open("http://www.extremepc.fr/GET", fichier, false);
    xhr_object.send(null);
    if(xhr_object.readyState == 4) return(xhr_object.responseText);
    else return(false);
}

function pageAjouterCommentaire(id)
{
	document.getElementById('commentaire').innerHTML = file('exnews/sources/ajouterCommentaire5445.html?id='+id);
}

function actionAjouterCommentaire(id,nom,contenu)
{
	if (contenu == "" || nom == "" || id == "")
	{
		alert("Tous les champs doivent être renseignés");
	}
	else
	{
		document.getElementById('buttonSubmitCommentaire').disabled = 'disabled';
		nom = escape(nom);
		contenu = escape(contenu);
		
		var xajax = null; 
		 
		if(window.XMLHttpRequest) xajax = new XMLHttpRequest(); 
		else if(window.ActiveXObject) xajax = new ActiveXObject("Microsoft.XMLHTTP"); 

		else return(false); 
		 
		var str = "nom="+nom+"&contenu="+contenu+"&id="+id;
		
		xajax.open("http://www.extremepc.fr/POST",'exnews/sources/actionAjouterCommentaire.html',false); 
		xajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=iso-8859-1"); 
		xajax.setRequestHeader("Content-Transfer-Encoding", "iso-8859-1"); 
		xajax.send(str); 
		if(xajax.readyState == 4) 
		{ 
			if (xajax.responseText.charAt(0) == "o")
				document.location.reload();
			else
				alert(xajax.responseText); 
		} 	
	}
}
