window.onload=set;
if(window.XMLHttpRequest)xml = new XMLHttpRequest();
else if(window.ActiveXObject)xml = new ActiveXObject("Microsoft.XMLHTTP");
function set(){
	if(hp=document.getElementById('d1').offsetHeight){
		if(hp>700)
		{
			hp+=10;
			if(document.getElementById('ml'))document.getElementById('ml').style.height=hp+'px';
			document.getElementById('mr').style.height=hp+'px';
		}
	}
}
function addComment(val){
	document.getElementById('addcom'+val).style.display="inline";
}
function subComment(val){
	formu=document.getElementById('formcom'+val);
	div=document.getElementById('addcom'+val);
	if( ! (formu.pseudo.value&&formu.comment.value))alert("vous n'avez pas remplis\ntous les champs obligatoires");
	else
	{
		formData='pseudo='+escape(formu.pseudo.value)+'&comment='+escape(formu.comment.value)+'&mail='+escape(formu.mail.value)+'&id='+val;
		xml.open("POST","http://map.jg-laurent.com/addcomment.php",true);
		xml.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		xml.send(formData);
		sto=div.innerHTML;
		xml.onreadystatechange = function()
		{ 
			if(xml.readyState == 4)
			{
				if(xml.responseText=='0')
				{
					 div.innerHTML='<div class="ccom">votre commentaire à été enregistré<br />Merci pour votre contribution</div>'
					 setTimeout('div.style.display="none";div.innerHTML=sto;document.location.reload()',4000);					 
				}
				if(xml.responseText=='1')
				{
					div.innerHTML='<div class="ecom">votre commentaire n\'a pas été enregistré<br />veuillez verifier si les champs sont correctement remplis. </div>';//'
					setTimeout('div.style.display="none";div.innerHTML=sto;',4000);	
				}
				if(xml.responseText=='2')
				{
					 div.innerHTML='<div class="ecom">votre commentaire à été refusé par le filtre anti-spam<br /></div>'
					 setTimeout('div.style.display="none";div.innerHTML=sto',4000);					 
				}
					 
			}
		}
	}
}
function contact(){
	window.open('http://map.jg-laurent.com/contact.php','contact','height=280,width=480,scrollbars=0,status=0,toolbar=0,top=50,left=50,resizable=0');
}
	