function Commenta(game,user){
	
	mode = "i";
	testo = document.forms['frm-comm'].testo.value;
	MetodoPost('../elabora/commenti.php', '&mode='+mode+'&game='+game+'&user='+user+'&testo='+testo+'', CommentaRes);
	document.getElementById('inscomm').innerHTML = "<img src=\"../img/ajax-loader.gif\" alt=\"\" />";
	
}

function CommentaRes(esito){
	
	if(esito == "EC1"){
		
		document.getElementById('inscomm').innerHTML = "<p>Il testo che hai inserito non &egrave; un commento valido.</p>";
		
	}
	
	if(esito == "EC2"){

		document.getElementById('inscomm').innerHTML = "<p>Attendi qualche secondo prima di inserire un altro commento.</p>";		
	}
	
	if(esito == "IFAIL"){
		
		document.getElementById('inscomm').innerHTML = "<p>Si &egrave; verificato un problema. Riprova in un altro momento.</p>";
	
	}else{
		
		if(esito != "EC1" && esito != "EC2"){
			document.getElementById('inscomm').innerHTML = "<p>Commento inserito!</p>";
			MostraCommenti(esito,'s');
		}
	
	}

}

function MostraCommenti(game,hm){
	
	MetodoPost('../elabora/commenti.php', '&mode=m&hm='+hm+'&game='+game+'', MostraCommentiRes);
	if(hm == "a"){
		
		paginatore = document.getElementById('pages');
		paginatore.style.display = "none";
		
	}

}

function MostraCommentiRes(esito){
	
	if(esito == "EC3"){
		
		//non ci sono commenti
		document.getElementById('comm-list').innerHTML = "";
		
	}else{
		
		document.getElementById('comm-list').innerHTML = esito;
	
	}

}