function popUp(url,w,h) {
	winname ='';
	if (w == '') w = '300';
	if (h == '') h = '300';
	opts = 'scrollbars=yes,resizable=yes,width='+w+',height='+h+'';
	window.open(url,winname,opts);

}
function finpop(id,idcat,idimg) {
	var pagina="finpop.php?id="+id+"&idcat="+idcat+"&idimg="+idimg;
	fin=window.open(pagina,"","scrollbars=yes,width=500,height=500");
	fin.document.close();
}

function tipoPagamento_null(d){
	d.getElementById('div-bon').className='hidden';
	d.getElementById('div-crt').className='hidden';
}
function tipoPagamento(val,d){
	tipoPagamento_null(d);
	if (val != ""){
	d.getElementById('div-'+val).className='visible';
	}
}


function statoValoreAz(d){
	d.getElementById('azienda').className='visible'; /*VISUALIZZA IL MENU AZIENDA*/
	d.getElementById('privato').className='hidden';  /*NASCONDE IL MENU PRIVATO*/
	
	/* COPIA IL TESTO CHE SI TROVA NEI MODULI ANAGRAFICA AZIENDA */
	var cap = d.getElementById("cap").value;
	var indirizzo = d.getElementById("indirizzo").value;
	var cfiscale = d.getElementById("cfiscale").value;
	var localita = d.getElementById("localita").value;
	var provincia = d.getElementById("provincia").value;
	var telefono = d.getElementById("telefono").value;
	var fax = d.getElementById("fax").value;
	var email = d.getElementById("email").value;
	var consenso = d.getElementById("consenso").checked;
	
	/* INCOLLA IL TESTO NEI MODULI ANAGRAFICA PRIVATA */
	d.getElementById("az-localita").value = localita;
	d.getElementById("az-cap").value = cap;
	d.getElementById("az-cfiscale").value = cfiscale;
	d.getElementById("az-indirizzo").value = indirizzo;
	d.getElementById("az-provincia").value = provincia;
	d.getElementById("az-telefono").value = telefono;
	d.getElementById("az-fax").value = fax;
	d.getElementById("az-email").value = email;
	d.getElementById("az-consenso").checked = consenso;
	
	/* ABILITA I CAMPI DELL'ANAGRAFICA AZIENDALE*/
	d.getElementById("az-localita").disabled = '';
	d.getElementById("az-cfiscale").disabled = '';
	d.getElementById("az-cap").disabled = '';
	d.getElementById("az-indirizzo").disabled = '';
	d.getElementById("az-provincia").disabled = '';
	d.getElementById("az-telefono").disabled = '';
	d.getElementById("az-fax").disabled = '';
	d.getElementById("az-email").disabled = '';
	d.getElementById("az-consenso").disabled = '';

	/* DISABILITA I CAMPI DELL'ANAGRAFICA PRIVATA*/
	d.getElementById("localita").disabled = 'disabled';
	d.getElementById("cfiscale").disabled = 'disabled';
	d.getElementById("cap").disabled = 'disabled';
	d.getElementById("indirizzo").disabled = 'disabled';
	d.getElementById("provincia").disabled = 'disabled';
	d.getElementById("telefono").disabled = 'disabled';
	d.getElementById("fax").disabled = 'disabled';
	d.getElementById("email").disabled = 'disabled';
	d.getElementById("consenso").disabled = 'disabled';

}
function statoValorePr(d){
	d.getElementById('privato').className='visible';/*VISUALIZZA IL MENU PRIVATO*/
	d.getElementById('azienda').className='hidden';/*NASCONDE IL MENU AZIENDA*/
	
	/* COPIA IL TESTO CHE SI TROVA NEI MODULI ANAGRAFICA PRIVATA */
	var cap = d.getElementById("az-cap").value;
	var cfiscale = d.getElementById("az-cfiscale").value;
	var indirizzo = d.getElementById("az-indirizzo").value;
	var localita = d.getElementById("az-localita").value;
	var provincia = d.getElementById("az-provincia").value;
	var telefono = d.getElementById("az-telefono").value;
	var fax = d.getElementById("az-fax").value;
	var email = d.getElementById("az-email").value;
	var consenso = d.getElementById("az-consenso").checked;
	
	/* INCOLLA IL TESTO NEI MODULI ANAGRAFICA AZIENDA*/
	d.getElementById("localita").value = localita;
	d.getElementById("cfiscale").value = cfiscale;
	d.getElementById("cap").value = cap;
	d.getElementById("indirizzo").value = indirizzo;
	d.getElementById("provincia").value = provincia;
	d.getElementById("telefono").value = telefono;
	d.getElementById("fax").value = fax;
	d.getElementById("email").value = email;
	d.getElementById("consenso").checked = consenso;

	/* ABILITA I CAMPI DELL'ANAGRAFICA PRIVATO*/
	d.getElementById("localita").disabled = '';
	d.getElementById("cfiscale").disabled = '';
	d.getElementById("cap").disabled = '';
	d.getElementById("indirizzo").disabled = '';
	d.getElementById("provincia").disabled = '';
	d.getElementById("telefono").disabled = '';
	d.getElementById("fax").disabled = '';
	d.getElementById("email").disabled = '';
	d.getElementById("consenso").disabled = '';

	/* DISABILITA I CAMPI DELL'ANAGRAFICA AZIENDALE*/
	d.getElementById("az-localita").disabled = 'disabled';
	d.getElementById("az-cap").disabled = 'disabled';
	d.getElementById("az-cfiscale").disabled = 'disabled';
	d.getElementById("az-indirizzo").disabled = 'disabled';
	d.getElementById("az-provincia").disabled = 'disabled';
	d.getElementById("az-telefono").disabled = 'disabled';
	d.getElementById("az-fax").disabled = 'disabled';
	d.getElementById("az-email").disabled = 'disabled';
	d.getElementById("az-consenso").disabled = 'disabled';
	
}
/*
function azIva(d){
	d.getElementById('piva').disabled='';
	d.getElementById('cfiscale').disabled='disabled';
	d.getElementById('piva').className='campo-preventivo abilitato';	
	d.getElementById('cfiscale').className='campo-preventivo disabilitato';	
}
function prCod(d){
	if(d.getElementById('azienda').value==''){
		d.getElementById('cfiscale').disabled='';
		d.getElementById('piva').disabled='disabled';
		d.getElementById('cfiscale').className='campo-preventivo abilitato';	
		d.getElementById('piva').className='campo-preventivo disabilitato';	
	}
}

*/
