function addComment(type,id_type, page, nb_elmt)
{

	var commentaire = document.getElementById('textarea_commentaire');
	var objet = document.getElementById('objet');
	
	document.getElementById('okComment').style.display = "none";
	
	if(commentaire.value.length>500)
	{
		document.getElementById('erreurComment').innerHTML="Les commentaires sont limit&#233;s &#224; 500 caract&#233;res";
		document.getElementById('textarea_commentaire').style.border = "1px red solid";
		document.getElementById('erreurComment').style.display = "block";
	}
	else if(commentaire.value.length<1)
	{
		document.getElementById('erreurComment').innerHTML="Veuillez saisir un commentaire";
		document.getElementById('textarea_commentaire').style.border = "1px red solid";
		document.getElementById('erreurComment').style.display = "block";
	}
	else
	{
		var Request = 'type='+type+'&id_type='+id_type+'&objet='+objet.value+'&commentaire='+commentaire.value;
		if (page)
			 Request = Request+'&p='+page;
		else if (nb_elmt)
			 Request = Request+'&elmt='+nb_elmt;
			 
		//alert(Request);
		var xhr;
		if(window.XMLHttpRequest) // Firefox
		xhr = new XMLHttpRequest();
		else if(window.ActiveXObject) // Internet Explorer
		xhr = new ActiveXObject("Microsoft.XMLHTTP");
		xhr.onreadystatechange = function() {
			if(xhr.readyState == 4 && xhr.status == 200) {
				var reponse = xhr.responseText;
				if(reponse!=false)
				{					
					document.getElementById('com').innerHTML = reponse;
					document.getElementById('okComment').style.display = "block";					
				}
				else
				{
					document.getElementById('erreurComment').innerHTML = "Ajout de commentaire impossible";
					document.getElementById('erreurComment').style.display = "block";
				}
			}
		}
		var request = "../jax/addcomment.php";
		xhr.open("POST",request,true);
		xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		xhr.send(Request);
	}
}
