//***** FUNZIONI DI CONVALIDA DEI DATI INSERITI NELLA SEZIONE AMMINISTRATIVA NEWS*****
function IsEmailGuestBookValid(){
	var EmailOk  = true
	var Temp     = document.frmCommento.txtEMail.value;
	var AtSym    = Temp.indexOf('@')
	var Period   = Temp.lastIndexOf('.')
	var Space    = Temp.indexOf(' ')
	var Length   = Temp.length - 1   
	// Array is from 0 to length-1
	if (Temp == "") { 
	return true; }
	if ((AtSym < 1) ||                     
	    (Period <= AtSym+1) ||             
	    (Period == Length ) ||             
	    (Space  != -1))
		{                 
	      alert("Inserire un indirizzo E-mail valido.");
			document.frmCommento.txtEMail.focus();
	      EmailOk = false
	   }

	return EmailOk
}

function isNumber(s){
	var i;
	if (s.length > 2){
		for (i = 0; i < s.length; i++){   
			// Check that current character is number.
			var c = s.charAt(i);
			if (((c < "0") || (c > "9")) && (c != ".") && (c != ",")) return false;
		}
	}else{
		for (i = 0; i < s.length; i++){   
			var c = s.charAt(i);
			if (((c < "0") || (c > "9"))) return false;
		}
	}
	
	// All characters are numbers.
	return true;
}
function ConvalidaCommento(){

	if (document.frmCommento.txtNome.value==""){
		alert("Inserire il nome");
		document.frmCommento.txtNome.focus();
		return false;
	}

	if (IsEmailGuestBookValid()==false){
		return false;
	}

	if (document.frmCommento.txtCommento.value==""){
		alert("Inserire il commento");
		document.frmCommento.txtCommento.focus();
		return false;
	}
	
	return true;
}
//***** FINE FUNZIONI DI CONVALIDA DEI DATI INSERITI NELLA SEZIONE AMMINISTRATIVA NEWS*****

