/**
 * @author cristiano
 */function Commento(){	this.script_page = "/ajax/commento.php";	this.checkFormCommenti = function()	{		nome = document.getElementById("nome");		commento = document.getElementById("commento");		ln = document.getElementById("ln").value;				if (nome.value.length <= 2)		{			if(ln == 1){			alert("Devi inserire almeno 3 caratteri nel campo nome.");			}else{			alert("You must enter at least 3 characters in the name field.");			}			nome.style.borderColor = "red";			nome.focus();			return false;		}				if (commento.value.length <= 2)		{			if(ln == 1){			alert("Devi inserire almeno 3 caratteri nel campo commento.");			}else{			alert("You must enter at least 3 characters in the comment field.");			}			commento.style.borderColor = "red";			commento.focus();			return false;		}				nome.style.borderColor = "";		commento.style.borderColor = "";				return true;	}		this.sendComment = function()	{		if (this.checkFormCommenti())		{			this.setLoadingSrc("/immagini/vote_loader.gif");			this.setLoadingTarget(document.getElementById("php_response"));			this.setTarget(this.gestisciRisposta);			this.params["operazione"] = "commenta";			this.params["idc"] = document.getElementById("idc").value;			this.params["nome"] = document.getElementById("nome").value;			this.params["commento"] = document.getElementById("commento").value;			ln = document.getElementById("ln").value;			if(ln == 1){			alert("Grazie per il tuo commento. Il tuo commento dovrà essere approvato prima di essere visibile sul blog.");			}else{			alert("Thanks for your comment. Your comment must be approved before being visible on the blog.");			}			this.makeRequest(this.script_page);		}	}		this.listaCommenti = function(idc, pag)	{		this.setLoadingSrc("/immagini/vote_loader.gif");		this.setLoadingTarget(document.getElementById("php_response"));		this.setTarget(document.getElementById("php_response"));		this.params["operazione"] = "lista_commenti";		this.params["idc"] = parseInt(idc);		this.params["pag"] = (pag == null || pag == undefined) ? 1 : parseInt(pag);		this.makeRequest(this.script_page);	}		this.gestisciRisposta = function(response)	{		response = new String(response);		response = response.split(":");				if (response[0] == 'OK')			document.getElementById('form_commento').reset();		else if (response[0] == 'FLOOD'){			ln = document.getElementById("ln").value;			if(ln == 1){			alert('Devi aspettare un minuto per inserire il prossimo commento.');			}else{			alert('You have to wait a minute to enter your next comment.');			}		}else{			ln = document.getElementById("ln").value;			if(ln == 1){			alert('Errore nell\'inserimento del commento!');			}else{			alert('Error during this operation!');			}		}		eval("comm.listaCommenti(" + response[1] + ", 1);");	}}Commento.prototype = new AjaxModule();Commento.prototype.constructor = Commento;
