function valida(){
	var errFound = false;
	var errAlert = "";
	
	if (Trim(window.document.frmSalvaRic.txtLogin.value)==""  && !errFound){
		errFound = true;
		errAlert = "Inserire Login";
	}
	if (Trim(window.document.frmSalvaRic.pspPassword.value)==""  && !errFound) {
		errFound = true;
		errAlert = "Inserire password";
	}
	if (errFound) {
		alert(errAlert);
	}
	else {
		window.document.frmSalvaRic.submit();
	}
	
}

function invia(){
	var errFound = false;
	var errAlert = "";
	
	if (Trim(window.document.frmMess.txtlogin.value)==""  && !errFound){
		errFound = true;
		errAlert = "Inserire Login";
	}
	if (Trim(window.document.frmMess.txtpassword.value)==""  && !errFound) {
		errFound = true;
		errAlert = "Inserire password";
	}
	if (Trim(window.document.frmMess.txtMsg.value)==""  && !errFound) {
		
		errFound = true;
		errAlert = "Inserire il testo";
	}
	if (errFound) {
		alert(errAlert);
	}
	else {
		window.document.frmMess.submit();
	}
	
}

function Trim(stringa){
		var NoExit;
		var x;
		var NoExit;
		var MyChar;
		stringa = stringa + "";
		NoExit = true;
		x = stringa.length-1;
		do 
		{
			MyChar = stringa.charCodeAt(x);
			if (MyChar != 32)
				NoExit = false;
			else
				x = x -1;
		}
		while (NoExit)
		stringa = stringa.substring(0,x+1);
		return (stringa);
}
