// JavaScript Document

function AbilitaDestinatario(){

	var nominativo = document.getElementById('nominativo')

	var tab_destinatario = document.getElementById('presso')

	var tr_destinatario = tab_destinatario.getElementsByTagName("tr")

	var input_destinatario = tab_destinatario.getElementsByTagName("input")

	for(var i=0; i<input_destinatario.length; i++){

		//alert(i)

	if(document.getElementById('c_o_presso').checked){

		document.getElementById('o_c').className='formdati'

		tr_destinatario[i].className='formdati';

		input_destinatario[i].readOnly='';

		if(input_destinatario[i].value==""){

		input_destinatario[i].className='imputsi';

		input_destinatario[i].value='';

		}

		}else{

		tab_destinatario.getElementsByTagName("span")[i].style.visibility='hidden';

		input_destinatario[i].className='presso';

		document.getElementById('o_c').className='disattivato'

		tr_destinatario[i].className='disattivato';

		input_destinatario[i].readOnly="readonly";

		input_destinatario[i].value=nominativo.getElementsByTagName("input")[i].value

		}

	}

	}

function controlloForm(){

var cognome = true, nome = true, via = true, citta = true, stato = true, cognome2 = true, nome2 = true, via2 = true, citta2 = true, cap2 = true, stato2 = true, telefono = true, email = true, modopag = true, condizioni = true, cap = true

if(document.getElementById("cognome").value == ""){

document.getElementById('error1').style.visibility='visible';

cognome = false;

}

if(document.getElementById("nome").value == ""){

document.getElementById('error2').style.visibility='visible';

nome = false;

}

if(document.getElementById("via").value == ""){

document.getElementById('error3').style.visibility='visible';

via = false;

}

if(document.getElementById("citta").value == ""){

document.getElementById('error4').style.visibility='visible';

citta = false;

}

if(document.getElementById("stato").value == ""){

document.getElementById('error5').style.visibility='visible';

stato = false;

}

if(document.getElementById("telefono").value == "" || !/^([0-9])+$/.test(document.getElementById("telefono").value)){

document.getElementById('error6').style.visibility='visible';

telefono = false;

}

if(document.getElementById("cap").value == "" || !/^([0-9])+$/.test(document.getElementById("cap").value)){

document.getElementById('error16').style.visibility='visible';

cap = false;

}

var mail  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

if(document.getElementById("email").value == ""){

document.getElementById('error7').style.visibility='visible';

email = false;

}else if(!mail.test(document.getElementById("email").value)){

document.getElementById('error7').style.visibility='visible';

email = false;

}



if(document.getElementById('c_o_presso').checked){

if(document.getElementById("cognome2").value == ""){

document.getElementById('error9').style.visibility='visible';

cognome2 = false;

}

if(document.getElementById("nome2").value == ""){

document.getElementById('error10').style.visibility='visible';

nome2 = false;

}

if(document.getElementById("via2").value == ""){

document.getElementById('error11').style.visibility='visible';

via2 = false;

}

if(document.getElementById("citta2").value == ""){

document.getElementById('error12').style.visibility='visible';

citta2 = false;

}

if(document.getElementById("cap2").value == "" || !/^([0-9])+$/.test(document.getElementById("cap").value)){

document.getElementById('error17').style.visibility='visible';

cap2 = false;

}

if(document.getElementById("stato2").value == ""){

document.getElementById('error13').style.visibility='visible';

stato2 = false;

}

}

if(document.getElementById("ModoPag").options.length > 1 && document.getElementById("ModoPag").options.selectedIndex == 0){

document.getElementById('error14').style.visibility='visible';

modopag = false;

}

if(!document.getElementById("condizioni").checked){

document.getElementById('error15').style.visibility='visible';

condizioni = false;

}

if((!cognome)||(!nome)||(!via)||(!citta)||(!cap)||(!stato)||(!cognome2)||(!nome2)||(!via2)||(!citta2)||(!cap2)||(!stato2)||(!telefono)||(!email)||(!modopag)||(!condizioni)){

	document.getElementById('testoErrore').innerHTML='Campi errati controllare'

	setTimeout("document.getElementById('testoErrore').innerHTML=''",3000);

	return false;

	}

return true;

}





function pagamenti(option){

var modo = new Array()

modo[0] = ""

modo[1] = "Si consiglia di spedire per posta assicurata"

modo[2] = "BANCA POPOLARE COMMERCIO E INDUSTRIA - AGENZIA N.121\nVIA SOLARI 3 - 20144 MILANO\nCODICE IBAN: IT 02 B 05048 01636 000000000185\nC/C intestato a SANGUINETTI SAS\nDall’estero, CODICE BIC: POCIITM1XXX"

modo[3] = "SI ACCETTANO PAGAMENTI CON CARTA  DI CREDITO: VISA - CARTASI - MASTERCARD\nSCARICA  IL MODULO E RISPEDISCILO COMPILATO E FIRMATO PER LETTERA O PER FAX al nostro N.  02/8322715 il fax č automatico.\nScaricare il modulo <a href=\"../VISAITA.pdf\" target=\"_blank\">cliccando qui</a>"

modo[4] = "Ritiro entro 8 giorni. PAGAMENTO ALLA CONSEGNA"

modo[5] = "Versamento  sul ns. Conto Corrente Postale n. 38108247 se si desidera accelerare la spedizione inviare fotocopia del versamento su CCP, per fax al nostro N.02/8322715  il fax č automatico.\rCODICE IBAN: IT 64 G 07601 01600 000038108247\nC/C intestato a SANGUINETTI SAS\rDall\'estero, CODICE BIC: BPPIITRRXXX"

document.getElementById("pagamento").innerHTML=modo[option]

}

