function MostraNascondi (ID)
	{
	if(document.getElementById(ID).style.display == "" | document.getElementById(ID).style.display == "none")
		document.getElementById(ID).style.display = "block";
	else
		document.getElementById(ID).style.display = "none";
	}

function AttivaDisattivaCampi(check, target)
	{
	if(check == true)
		{
		document.getElementById('s_indirizzo').disabled = "disabled";
		document.getElementById('s_citta').disabled = "disabled";
		document.getElementById('s_cap').disabled = "disabled";
		document.getElementById('s_provincia').disabled = "disabled";
		document.getElementById('s_nazione').disabled = "disabled";
		}
	else
		{
		document.getElementById('s_indirizzo').disabled = false;
		document.getElementById('s_citta').disabled = false;
		document.getElementById('s_cap').disabled = false;
		document.getElementById('s_provincia').disabled = false;
		document.getElementById('s_nazione').disabled = false;
		}
	}

function VerificaRegistrazione()
	{
	document.getElementById("Errori").style.color = "#000";
	Invia = true;
	lunghezza = document.registrazione.elements.length;
	for(i = 0; i < lunghezza; i++)
		{
		document.registrazione.elements[i].parentNode.style.color = "#000";
		if(document.registrazione.elements[i].type == "text")
			{
			if(document.registrazione.elements[i].disabled == false)
				{
				if(trim(document.registrazione.elements[i].value) == "")
					{
					Invia = false;
					document.registrazione.elements[i].parentNode.style.color = "#F00";
					}
				else
					{
					document.registrazione.elements[i].value = trim(document.registrazione.elements[i].value);
					}
				}
			}
		}

		if(Invia == true)
			document.registrazione.submit();
		else
			document.getElementById("Errori").style.color = "#F00";
	}

function VerificaModifica()
	{
	document.getElementById("Errori").style.color = "#000";
	Invia = true;
	lunghezza = document.registrazione.elements.length;
	for(i = 0; i < lunghezza; i++)
		{
		document.registrazione.elements[i].parentNode.style.color = "#000";
		if(document.registrazione.elements[i].type == "text")
			{
			if(document.registrazione.elements[i].disabled == false)
				{
				if(document.registrazione.elements[i].name != "PASSWORD")
				if(trim(document.registrazione.elements[i].value) == "")
					{
					Invia = false;
					document.registrazione.elements[i].parentNode.style.color = "#F00";
					}
				else
					{
					document.registrazione.elements[i].value = trim(document.registrazione.elements[i].value);
					}
				}
			}
		}

		if(Invia == true)
			document.registrazione.submit();
		else
			document.getElementById("Errori").style.color = "#F00";
	}

function modificaForm(Valore)
	{
	if(Valore == 1)
		{
		document.registrazione.RAGIONE_SOCIALE.disabled = false;
		document.registrazione.P_IVA.disabled = false;
		document.getElementById('rs').style.display = 'block';
		document.getElementById('pi').style.display = 'block';
		}
	if(Valore == 0)
		{
		document.registrazione.RAGIONE_SOCIALE.disabled = true;
		document.registrazione.P_IVA.disabled = true;
		document.getElementById('rs').style.display = 'none';
		document.getElementById('pi').style.display = 'none';
		}
	}

function trim(stringa)
	{
	while (stringa.substring(0,1) == ' ')
		{
		stringa = stringa.substring(1, stringa.length);
		}
	while (stringa.substring(stringa.length-1, stringa.length) == ' ')
		{
		stringa = stringa.substring(0,stringa.length-1);
		}
	return stringa;
	}


