function smile(charset){
    document.getElementById('comment').value += ' ' + charset;
}

function countlengthcomment(){
    testo = document.getElementById('comment').value;
    rimasti = 600 - (testo.length);
    if (testo.length > 599) 
        event.returnValue=false;
    document.getElementById('chars_rimasti').innerHTML = rimasti;
}

function validate(){
	if (document.commentForm.comment.value==''){
			alert("Per favore, inserisci un commento valido");
	}
    else if (document.commentForm.mathsecut.value==''){
			alert("Per favore, inserisci il codice di sicurezza");
	}
    else {
		document.commentForm.submit();
	}
}
