function newwindow(theURL)
{
	window.open(theURL,'aggiungi','scrollbars=yes,resizable=yes,left=50,top=0,width=800,height=700,status=no,location=no,toolbar=no');
}

// FUNZIONE CHE CONTROLLA TUTTI I CAMPI CONTRASSEGNATI CON REQUIRED

// FUNZIONE CHE CONTROLLA TUTTI I CAMPI CONTRASSEGNATI CON REQUIRED
function ControlloCampiForm(which)
{
	var pass=true
	
	if (document.images)
	{
		for (i=0;i<which.length;i++)
		{
			var tempobj=which.elements[i]
			var nome_campo = tempobj.name
			if (tempobj.id.substring(0,8)=="required")
			{
				if (((tempobj.type=="text"||tempobj.type=="textarea")&&tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&tempobj.selectedIndex==-1))
				{
					pass=false
					break
				}
			}
		}
	}

	if (!pass)
	{
		alert("Attenzione\n E' necessario compilare il campo obbligatorio: " + nome_campo.toUpperCase())
		return false
	} else {
	return true
	}
}
// FINE CONTROLLO DEI CAMPI



// FUNZIONE CHE NASCONDE O VISUALIZZA UNA PARTE DI CODICE DENTRO IL DIV
// <a href="#" onclick="toggle_visibility('DatiAcquisto');">Intendo spedire la merce in altra destinazione</a>
//
// <div id="DatiAcquisto" style="display:none;">
// 		QUELLO CHE VOGLIO
// </div>
function toggle_visibility(id) 
{
	var e = document.getElementById(id);
	
	if(e.style.display == 'block')
		e.style.display = 'none';
	else
		e.style.display = 'block';
}


function show_privacy()
{
  privacy=window.open('privacy.htm','privacy','channelmode=0,directories=0,fullscreen=0,height=700,left='+((screen.availWidth/2)-300)+',location=0,menubar=0,resizable=0,scrollbars=1,status=1,titlebar=1,toolbar=0,top=100,width=600');
}

function show_condizioni()
{
  privacy=window.open('condizioni-di-vendita.htm','privacy','channelmode=0,directories=0,fullscreen=0,height=700,left='+((screen.availWidth/2)-300)+',location=0,menubar=0,resizable=0,scrollbars=1,status=1,titlebar=1,toolbar=0,top=100,width=600');
}


function showform(id)
{
	
	if (document.id["Azienda"].checked)
	{
		document.id["RagioneSociale"].disabled = null;
		document.id["PartitaIVA"].disabled = null;
	}
	else
	{
		document.id["RagioneSociale"].disabled = true;
		document.id["PartitaIVA"].disabled = true;
	}
}
