// software sviluppato da IusOnDemand srl per www.fatturami.com - utilizzo consentito lasciando questa riga nel codice.
function Fatturami_formAction(svalue)
{
var objAction = document.getElementById("Fatturami_submit");
objAction.value = svalue;
}
function controllaordine() {
var fatturami_obj="";
var buyername="";
var buyeremail="";
var buyeraddress="";
var buyerzip="";
var buyercity="";
var buyerprovincia="";
var buyercf="";
var buyerpiva="";
var buyertos="";
var buyertel="";
var fatturami_err="";
var fatturami_error="";
var fatturami_vuoto="";
buyername = Fatturami_TrimString(document.getElementById("iodbuyername").value);
buyeremail = Fatturami_TrimString(document.getElementById("iodbuyeremail").value);
buyeraddress= Fatturami_TrimString(document.getElementById("iodbuyeraddress").value);
buyerzip = Fatturami_TrimString(document.getElementById("iodbuyerzip").value);
buyercity = Fatturami_TrimString(document.getElementById("iodbuyercity").value);
buyercf = Fatturami_TrimString(document.getElementById("iodbuyercf").value);
buyerpiva = Fatturami_TrimString(document.getElementById("iodbuyerpiva").value);
buyertel = Fatturami_TrimString(document.getElementById("iodbuyertel").value);
buyertos = document.getElementById("iodbuyertos").checked;
var iodsel = document.getElementById("iodbuyerprovincia");
buyerprovincia = iodsel.options[iodsel.selectedIndex].value;
// var iodselprovincia = document.getElementById("iodbuyerprovincia");
// buyerprovincia = iodselprovincia.options[iodselprovincia.selectedIndex].value;
// var iodselcountry = document.getElementById("iodbuyercountry");
// buyercountry = iodselcountry.options[iodselcountry.selectedIndex].value;
// **************************************************************************
if (buyername=="" ) {
document.getElementById("iodbuyername").className = 'iodinputempty';
//document.getElementById("iodbuyername").placeholder = "nome e cognome o azienda";
fatturami_err=fatturami_err+"
la denominazione \r";
fatturami_vuoto="on";
} else {
document.getElementById("iodbuyername").value=Fatturami_toTitleCase(document.getElementById("iodbuyername").value);
document.getElementById("iodbuyername").className = 'iodstileinput';
}
if (buyeremail =="" ) {
document.getElementById("iodbuyeremail").className = 'iodinputempty';
//document.getElementById("iodbuyeremail").placeholder = "email per evadere l'ordine";
fatturami_err=fatturami_err+"
il Comune \r";
fatturami_vuoto="on";
} else {
document.getElementById("iodbuyercity").className = 'iodstileinput';
}
if (buyerzip.length == 0) {
document.getElementById("iodbuyerzip").className = 'iodinputempty';
//document.getElementById("iodbuyerzip").placeholder = "cap: 5 caratteri";
fatturami_err=fatturami_err+"
il cap \r";
fatturami_vuoto="on";
} else if (buyerzip.length !=5) {
document.getElementById("iodbuyerzip").className = 'iodinputerror';
fatturami_err=fatturami_err+"
Correggere il cap \r";
} else {
document.getElementById("iodbuyerzip").className = 'iodstileinput';
}
if (buyerprovincia=="" ) {
document.getElementById("iodbuyerprovincia").className = 'iodinputempty';
//document.getElementById("iodbuyerprovincia").placeholder = "indica la Provincia";
fatturami_err=fatturami_err+"
la provincia \r";
fatturami_vuoto="on";
} else {
document.getElementById("iodbuyerprovincia").className = 'iodstileinput';
}
if (buyertel=="" ) {
document.getElementById("iodbuyertel").className = 'iodinputempty';
fatturami_err=fatturami_err+"
accettare le Condizioni Legali \r";
} else {
document.getElementById("iodbuyertos").className = 'iodstilechk';
document.getElementById("tosid").className = 'tosidok';
}
// ricorda: il cf potrebbe essere p.iva. Attenzione: potrebbero esserci clienti stranieri senza c.f. Per ora avverte solamente senza interrompere.
if (buyercf =="") {
document.getElementById("iodbuyercf").className = 'iodinputempty';
//document.getElementById("iodbuyercf").placeholder = "codice fiscale per la fattura";
fatturami_err=fatturami_err+"
Inserire il Codice Fiscale \r";
} else if (Fatturami_verifica(buyercf)!="" ) {
document.getElementById("iodbuyercf").className = 'iodinputerror';
fatturami_err=fatturami_err+"
Correggere il Codice Fiscale \r";
} else {
document.getElementById("iodbuyercf").className = 'iodstileinput';
}
if (buyerpiva=="" ) {
document.getElementById("iodbuyerpiva").className = 'iodinputempty';
} else if (Fatturami_ControllaPIVA(buyerpiva)!="") {
document.getElementById("iodbuyerpiva").className = 'iodinputerror';
fatturami_err=fatturami_err+"Partita Iva non corretta "+Fatturami_ControllaPIVA(buyerpiva)+"\r";
} else {
document.getElementById("iodbuyerpiva").className = 'iodstileinput';
}
// **************************************************************************
if (fatturami_err=="") {
document.getElementById("submit1").disabled=false;
document.getElementById("submit2").disabled=false;
fatturami_err="Modulo compilato. Ora puoi comprare";
} else {
document.getElementById("submit1").disabled=true;
document.getElementById("submit2").disabled=true;
fatturami_err="