function panelCheck(nomebutton)
{
		var check = true
		var x=document.postmsg
		var em1 = x.email.value
		var nome = x.fullname.value
		var user = x.username.value
		if (nome.length<5)
		{
			alert("E' necessario inserire un nome e un cognome validi");
			x.fullname.focus();
			check = false;
		}
		if ((user.length<6) && check)
		{
			alert("L'username deve essere di almeno 6 caratteri (fino a 15 max)");
			x.username.focus();
			check = false;
		}

		if ((!checkmail(em1)) && check)
		{
			alert("E' necessario fornire una email valida");
			x.email.focus();
			check = false;
		}
		if (check) 	goform(nomebutton);
}

function orgCheck(nomebutton)
{
		var check = true
		var x=document.postmsg
		var em1 = x.socmail.value
		var tel = x.phone.value
		var idc = x.IDCompany.value
		var soc = x.ragsoc.value
		if ((idc>0)&&(soc.length>0))
		{
			alert("Sono stati inseriti dati contrastanti (nuova organizzazione e organizzazione registrata)");
			x.IDCompany.focus();
			check = false;
		}
		if ((idc==0)&&check)
		{
			if ((soc.length<5)&&check)
			{
			alert("Ragione sociale non corretta");
			x.ragsoc.focus();
			check = false;
			}
			if ((tel=="")&&(em1=="")&&check)
			{
			alert("Deve essere fornito almeno un recapito a scelta tra telefono ed email");
			x.phone.focus();
			check = false;
			}
			if ((em1!="")&&check)
			{
				if ((!checkmail(em1)) && check)
				{
					alert("E' necessario fornire una email valida");
					x.socmail.focus();
					check = false;
				}
			}
		}
		if (check) 	goform(nomebutton);
}

function managernd()
{
		var x = document.postmsg
		var rndpassw = x.randomp
		var sendmail = x.mailto
		if (rndpassw.checked)
		{
				sendmail.checked = true;
				sendmail.disabled = true;
				x.passw.value="random";
				x.passwconfirm.value="random";
		}
		else
		{
				sendmail.checked = false;
				sendmail.disabled = false;
				x.passw.value="";
				x.passwconfirm.value="";
		}
}

function regCheck(nomebutton)
{
		var check = true
		var x=document.postmsg
		var em1 = x.email.value
		var em2 = x.emailconfirm.value
		var p1 = x.passw.value
		var p2 = x.passwconfirm.value
		var nome = x.name.value
		var user = x.username.value
		if (nome.length<5)
		{
			alert("E' necessario inserire un nome e un cognome validi");
			x.name.focus();
			check = false;
		}
		if ((user.length<6) && check)
		{
			alert("L'username deve essere di almeno 6 caratteri (fino a 15 max)");
			x.username.focus();
			check = false;
		}
		if ((p1.length<6) && check)
		{
			alert("La password deve essere di almeno 6 caratteri (max 8)");
			x.passw.focus();
			check = false;
		}
		if ((p1!=p2) && check)
		{
			alert("Controllo password errato: reinserire password");
			x.passwconfirm.value=""
			x.passwconfirm.focus();
			check = false;
		}
		if ((!checkmail(em1)) && check)
		{
			alert("E' necessario fornire una email valida");
			x.email.focus();
			check = false;
		}
		if ((em1!=em2) && check)
		{
			alert("Conferma email fallita: reinserire email");
			x.emailconfirm.value=""
			x.emailconfirm.focus();
			check = false;
		}
		if (check) 	goform(nomebutton);
}
		


	