// JavaScript Document
function validateComment() {
 	var bledy = "";
	errfound = false;
	elem = document.forms[0].elements['nickname'];
	elem2 = document.forms[0].elements['testo'];
	reg = /^[a-zA-Z \-)(:;\?!\.0-9èàùòìÈÀÒÙ'&]{2,2250}$/;
		if (elem.value == "" || elem.value.match(reg) == null)  bledy += "Inserisci correttamente 'nickname'  \n";
		if (elem2.value == "" || elem2.value.match(reg) == null)  bledy += "Inserisci correttamente 'testo'  \n";
	    if (elem.value.length >= 21) bledy += "Il Tuo nickname non puo' essere superiore ai 20 caratteri\n";
	    if (elem2.value.length >= 2250) bledy += "Il Tuo testo non puo' essere superiore ai 2250 caratteri\n";


 		if (bledy != "") {
				window.alert(bledy);
				errfound = true;	
		} 
	 
return !errfound;
};

function validateSpace() {
 	var bledy = "";
	errfound = false;
	elem = document.forms[0].elements['name'];
	elem2 = document.forms[0].elements['email'];
	elem3 = document.forms[0].elements['title'];
	elem4 = document.forms[0].elements['text'];
	reg = /^[a-zA-Z \-)(:;\?!\.,0-9èàùòìÈÀÒÙ'&]{1,2250}$/;
 	em = /^[a-zA-Z0-9_\-\.]{1,30}@[a-zA-Z0-9_\-]+(\.[a-z_A-Z0-9]+)+$/;

		if (elem.value == "" || elem.value.match(reg) == null)  bledy += "Inserisci correttamente 'Nome'  \n";
		if (elem2.value == "" || elem2.value.match(em) == null)  bledy += "Inserisci correttamente 'E-mail'  \n";
		if (elem3.value == "" || elem3.value.match(reg) == null)  bledy += "Inserisci correttamente 'Titolo dell'articolo'  \n";
		if (elem4.value == "")  bledy += "Inserisci correttamente 'Titolo dell'articolo'  \n";
	    if (elem.value.length >= 40) bledy += "Il Tuo nickname non puo' essere superiore ai 40 caratteri\n";
	    if (elem2.value.length >= 100) bledy += "Il Tuo email non puo' essere superiore ai 100 caratteri\n";
	    if (elem3.value.length >= 400) bledy += "Il Tuo titolo non puo' essere superiore ai 400 caratteri\n";


 		if (bledy != "") {
				window.alert(bledy);
				errfound = true;	
		} 
	 
return !errfound;
};

