function confirmation(msg, url) {
var options = {
message: msg
}
return eModal
.confirm(options)
.then(
function ( /* DOM */) {
document.location.href = url;
}
);
}
function confirmationcinsurance() {
var options = {
title: 'Assicurazione Viaggiatori',
subtitle: 'Perché rischiare viaggiando senza?',
message: 'Le nostre polizze assicurative hanno un ottimo rapporto qualità/prezzo e possono tutelarti da:
-Spese mediche
-Annullamento
-Perdita del bagaglio.
Scegli l\'assicurazione più adatta a te.'
}
return eModal
.confirm(options)
.then(
function () {
$('#addinsurancebutton').trigger('click');
},
function () {
document.location.href = '/it/checkout/?step=7';
}
);
}
function checkVATCF(fieldId, fieldsforcheck) {
if ($('#' + fieldId).length) {
var valuecfiva = $('#' + fieldId).val();
var formId = $('#' + fieldId).closest('form').attr('id');
var formName = $('#' + fieldId).closest('form').attr('name');
var giorno = $('#' + formId + ' #giorno').val();
var mese = $('#' + formId + ' #mese').val();
var anno = $('#' + formId + ' #anno').val();
var first2_name = $('#' + formId + ' #nome').val();
var last2_name = $('#' + formId + ' #cognome').val();
if (fieldsforcheck != '' && fieldsforcheck != undefined) {
fieldsforcheck = fieldsforcheck.split(',');
var first2_name = $('#' + formId + ' #' + fieldsforcheck[0]).val();
var last2_name = $('#' + formId + ' #' + fieldsforcheck[1]).val();
var giorno = $('#' + formId + ' #' + fieldsforcheck[2]).val();
var mese = $('#' + formId + ' #' + fieldsforcheck[3]).val();
var anno = $('#' + formId + ' #' + fieldsforcheck[4]).val();
var ii = Number(fieldsforcheck[5]) + 1;
}
err = 0;
errCode = 0;
errors = '';
if ((first2_name != '' && first2_name != undefined) && (last2_name != '' && last2_name != undefined) && (giorno != '' && giorno != undefined) && (mese != '' && mese != undefined) && (anno != '' && anno != undefined)) {
if (valuecfiva.length == 11 && valuecfiva) {
pi = valuecfiva;
if (pi.length != 11) {
err = 1;
}
validi = "0123456789";
for (i = 0; i < 11; i++) {
if (validi.indexOf(pi.charAt(i)) == -1) {
err = 2;
}
}
s = 0;
for (i = 0; i <= 9; i += 2) {
s += pi.charCodeAt(i) - '0'.charCodeAt(0);
}
for (i = 1; i <= 9; i += 2) {
c = 2 * (pi.charCodeAt(i) - '0'.charCodeAt(0));
if (c > 9) {
c = c - 9;
}
s += c;
}
if ((10 - s % 10) % 10 != pi.charCodeAt(10) - '0'.charCodeAt(0)) {
err = 33;
}
}
else if (valuecfiva.length == 16) {
cf = valuecfiva;
//start CF check
var consonanti = "bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ";
function CalcolaNome(Nome) {
var code = "";
cons = GetConsonanti(Nome);
if (cons.length > 3)
code = cons.substring(0, 1) + cons.substring(2, 3) + cons.substring(3, 4);
else if (cons.length == 3)
code = cons;
else {
code = cons + GetVocali(Nome).substring(0, 3 - cons.length);
if (code.length < 3)
for (i = code.length; i < 3; i++)
code += "X";
}
return code;
}
function CalcolaCognome(Cognome) {
var code = "";
code = GetConsonanti(Cognome);
if (code.length >= 3) code = code.substring(0, 3);
else {
code += GetVocali(Cognome).substring(0, 3 - code.length)
if (code.length < 3)
for (i = code.length; i < 3; i++)
code += "X";
}
return code;
}
function GetConsonanti(Stringa) {
var cns = "";
for (i = 0; i < Stringa.length; i++)
if (consonanti.indexOf(Stringa.substring(i, i + 1)) != -1)
cns += Stringa.substring(i, i + 1);
return cns.toUpperCase();
}
function GetVocali(Stringa) {
var voc = "";
for (i = 0; i < Stringa.length; i++)
if (consonanti.indexOf(Stringa.substring(i, i + 1)) == -1 && Stringa.substring(i, i + 1) != " ")
voc += Stringa.substring(i, i + 1);
return voc.toUpperCase();
}
rc = CalcolaCognome(last2_name);
rn = CalcolaNome(first2_name);
var msg = ""; var msg2 = ""; var msg3 = ""; var msg4 = "";
// estraggo le ultime 2 cifre della data
anno_2 = anno.substring(2, 4);
// per le donne al giorno di nascita viene sommato 40
giorno_f = eval(giorno) + 40;
// mesi utilizzati per il calcolo.
// es. se sono nato ad ottobre (10) sul cf troverò "R"
MESI = "ABCDEHLMPRST";
mese = mese - 1;
// estraggo la lettera che identifica il mese dal cf inserito
mese_cf = cf.substring(8, 9);
// trovo la lettera corrispondende al mese di nascita inserito
temp_mese = MESI.charAt(mese);
// le 2 lettere coincidono??
if (temp_mese != mese_cf) {
err = 4;
errCode = 'controllare il mese di nascita';
}
// controllo se nel codice fiscale compare il nome + cognome
if (cf.indexOf(rc + rn) == -1) {
err = 4;
errCode = 'controllare il nome e/o cognome';
}
// controllo se nel codice fiscale compare il giorno di nascita
giorno_cf = cf.substring(9, 11);
if (giorno < 10) {
giorno = '0' + giorno;
}
if (giorno_cf != giorno && giorno_cf != giorno_f) {
err = 4;
errCode = 'controllare il giorno di nascita';
}
// controllo se nel codice fiscale compare l'anno di nascita
anno_cf = cf.substring(6, 8);
if (anno_2 != anno_cf) {
err = 4;
errCode = 'controllare l\'anno di nascita';
}
if (err == '') {
set1 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
set2 = "ABCDEFGHIJABCDEFGHIJKLMNOPQRSTUVWXYZ";
setpari = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
setdisp = "BAKPLCQDREVOSFTGUHMINJWZYX";
s = 0;
for (i = 1; i <= 13; i += 2)
s += setpari.indexOf(set2.charAt(set1.indexOf(cf.charAt(i))));
for (i = 0; i <= 14; i += 2)
s += setdisp.indexOf(set2.charAt(set1.indexOf(cf.charAt(i))));
if (s % 26 != cf.charCodeAt(15) - 'A'.charCodeAt(0)) {
//alert('Il codice fiscale non è corretto\n');
//errors="Owner";
err = 4;
}
}
// ends CF check
}
else {
err = 5;
}
if (err) {
$('input[id*="' + fieldId + '"]').focus();
document.getElementById(fieldId).focus;
}
if (err == 33) {
//alert('--------------- ATTENZIONE ---------------
P.IVA non corretta: ' + errCode);
$.notify({
message: '--------------- ATTENZIONE ---------------
P.IVA non corretta: ' + errCode,
}, { type: 'danger', position: 'fixed', placement: { from: "top", align: "center" } });
//$('#proseguiattendees').css("display",'none');
$('#proseguiattendees').attr("disabled", true);
$('.bs-wizard-dot').bind('click', false);
return false;
}
else if (err == 3) {
//$('#proseguiattendees').css("display",'none');
$('#proseguiattendees').attr("disabled", true);
$('.bs-wizard-dot').bind('click', false);
return false;
}
else if (err == 4) {
if (errCode) {
//alert('PARTECIPANTE '+ ii +' --------------- ATTENZIONE ---------------C.F. non corretto: ' + errCode);
$.notify({
message: 'PARTECIPANTE ' + ii + ' --------------- ATTENZIONE ---------------C.F. non corretto: ' + errCode,
}, { type: 'danger', position: 'fixed', placement: { from: "top", align: "center" } });
}
else {
//alert('PARTECIPANTE '+ ii +' --------------- ATTENZIONE ---------------C.F. non corretto');
$.notify({
message: 'PARTECIPANTE ' + ii + ' --------------- ATTENZIONE ---------------C.F. non corretto',
}, { type: 'danger', position: 'fixed', placement: { from: "top", align: "center" } });
}
//$('#proseguiattendees').css("display",'none');
$('#proseguiattendees').attr("disabled", true);
$('.bs-wizard-dot').bind('click', false);
return false;
}
else if (err == 5) {
//alert('PARTECIPANTE '+ ii +' --------------- ATTENZIONE ---------------P.IVA e/o C.F. non corretti');
$.notify({
message: 'PARTECIPANTE ' + ii + ' --------------- ATTENZIONE ---------------P.IVA e/o C.F. non corretti',
}, { type: 'danger', position: 'fixed', placement: { from: "top", align: "center" } });
//$('#proseguiattendees').css("display",'none');
$('#proseguiattendees').attr("disabled", true);
$('.bs-wizard-dot').bind('click', false);
return false;
}
else {
$('#' + formName + ' input[type=submit]', '#' + formName + ' input[type=button]').removeAttr('disabled');
$('#proseguiattendees').css("display", 'block');
$('.bs-wizard-dot').unbind('click', false);
return true;
}
}
}
}
var contactusform = $("#contactus").validate({
// Rules for form validation
rules:
{
nome:
{
required: true
},
cognome:
{
required: true
},
email:
{
required: true,
email: true
},
richiesta:
{
required: true
},
privacyok:
{
required: true
}
},
// Messages for form validation
messages:
{
nome:
{
required: 'Campo obbligatorio.'
},
cognome:
{
required: 'Campo obbligatorio.'
},
email:
{
required: 'Campo obbligatorio.',
email: 'Si prega di inserire un indirizzo email corretto.'
},
richiesta:
{
required: 'Campo obbligatorio.'
},
privacyok:
{
required: 'Campo obbligatorio.'
}
},
// Ajax form submition
submitHandler: function (form) {
var vars = $("#contactus").serialize();
$.post("/_apps/post.inc.html?" + vars, function (result) {
showalertmsg('success', result, '1500');
gtag('event', 'conversion', {
'send_to': 'AW-866293486/RcuNCIri7HsQ7q2KnQM'});
//Facebook Pixel Code
fbq('track', 'Lead');
$('#contactus')[0].reset();
waitingDialog.hide();
});
},
// Do not change code below
errorPlacement: function (error, element) {
error.insertAfter(element.parent());
}
});
var virtualposform = $("#virtualposform").validate({
// Rules for form validation
rules:
{
nome:
{
required: true
},
cognome:
{
required: true
},
email:
{
required: true,
email: true
},
causale:
{
required: true
},
importo:
{
required: true
},
privacyok:
{
required: true
}
},
// Messages for form validation
messages:
{
nome:
{
required: 'Campo obbligatorio.'
},
cognome:
{
required: 'Campo obbligatorio.'
},
email:
{
required: 'Campo obbligatorio.',
email: 'Si prega di inserire un indirizzo email corretto.'
},
causale:
{
required: 'Campo obbligatorio.'
},
importo:
{
required: 'Campo obbligatorio.'
},
privacyok:
{
required: 'Campo obbligatorio.'
}
},
// Ajax form submition
submitHandler: function (form) {
if ($(form).valid()) {
form.submit();
waitingDialog.show('Ti stiamo trasferendo ');
}
},
// Do not change code below
errorPlacement: function (error, element) {
error.insertAfter(element.parent());
}
});
var signupform = $("#signupform").validate({
// Rules for form validation
rules:
{
nome:
{
required: function (element) {
if ($("#signupform #ragionesociale").val() == '' || !$("#signupform #ragionesociale").val()) {
$('#user .asterisco').show();
$('#company .asterisco').hide();
return true;
}
else {
$('#user .asterisco').hide();
$('#company .asterisco').show();
return false;
}
}
},
cognome:
{
required: function (element) {
if ($("#signupform #ragionesociale").val() == '' || !$("#signupform #ragionesociale").val())
return true;
else
return false;
}
},
luogonascita:
{
required: function (element) {
if ($("#signupform #ragionesociale").val() == '' || !$("#signupform #ragionesociale").val())
return true;
else
return false;
}
},
giorno:
{
required: function (element) {
if ($("#signupform #ragionesociale").val() == '' || !$("#signupform #ragionesociale").val())
return true;
else
return false;
}
},
mese:
{
required: function (element) {
if ($("#signupform #ragionesociale").val() == '' || !$("#signupform #ragionesociale").val())
return true;
else
return false;
}
},
anno:
{
required: function (element) {
if ($("#signupform #ragionesociale").val() == '' || !$("#signupform #ragionesociale").val())
return true;
else
return false;
}
},
cf:
{
required: function (element) {
if ($("#signupform #ragionesociale").val() == '' || !$("#signupform #ragionesociale").val())
return true;
else
return false;
}
},
indirizzo:
{
required: function (element) {
if ($("#signupform #ragionesociale").val() == '' || !$("#signupform #ragionesociale").val())
return true;
else
return false;
}
},
comunetxt:
{
required: function (element) {
if ($("#signupform #ragionesociale").val() == '' || !$("#signupform #ragionesociale").val())
return true;
else
return false;
}
},
cap:
{
required: function (element) {
if ($("#signupform #ragionesociale").val() == '' || !$("#signupform #ragionesociale").val())
return true;
else
return false;
}
},
provincia:
{
required: function (element) {
if ($("#signupform #ragionesociale").val() == '' || !$("#signupform #ragionesociale").val())
return true;
else
return false;
}
},
stato:
{
required: function (element) {
if ($("#signupform #ragionesociale").val() == '' || !$("#signupform #ragionesociale").val())
return true;
else
return false;
}
},
indirizzo_dom:
{
required: function (element) {
if ($("#signupform #ragionesociale").val() == '' || !$("#signupform #ragionesociale").val())
return false;
else
return false;
}
},
comune_dom:
{
required: function (element) {
if ($("#signupform #ragionesociale").val() == '' || !$("#signupform #ragionesociale").val())
return false;
else
return false;
}
},
comunetxt_dom:
{
required: function (element) {
if ($("#signupform #ragionesociale").val() == '' || !$("#signupform #ragionesociale").val())
return false;
else
return false;
}
},
cap_dom:
{
required: function (element) {
if ($("#signupform #ragionesociale").val() == '' || !$("#signupform #ragionesociale").val())
return false;
else
return false;
}
},
provincia_dom:
{
required: function (element) {
if ($("#signupform #ragionesociale").val() == '' || !$("#signupform #ragionesociale").val())
return false;
else
return false;
}
},
stato_dom:
{
required: function (element) {
if ($("#signupform #ragionesociale").val() == '' || !$("#signupform #ragionesociale").val())
return false;
else
return false;
}
},
email:
{
required: true,
email: true
},
ragionesociale:
{
required: function (element) {
if ($("#signupform #ragionesociale").val() != '')
return true;
else
return false;
}
},
piva:
{
required: function (element) {
if ($("#signupform #ragionesociale").val() != '')
return true;
else
return false;
}
},
indirizzopg:
{
required: function (element) {
if ($("#signupform #ragionesociale").val() != '')
return true;
else
return false;
}
},
comunepgtxt:
{
required: function (element) {
if ($("#signupform #ragionesociale").val() != '')
return true;
else
return false;
}
},
cappg:
{
required: function (element) {
if ($("#signupform #ragionesociale").val() != '')
return true;
else
return false;
}
},
provinciapg:
{
required: function (element) {
if ($("#signupform #ragionesociale").val() != '')
return true;
else
return false;
}
},
statopg:
{
required: function (element) {
if ($("#signupform #ragionesociale").val() != '')
return true;
else
return false;
}
},
password:
{
required: true,
minlength: 8
},
privacyok:
{
required: true
}
},
// Messages for form validation
messages:
{
nome:
{
required: 'Campo obbligatorio.'
},
cognome:
{
required: 'Campo obbligatorio.'
},
luogonascita:
{
required: 'Campo obbligatorio.'
},
giorno:
{
required: 'Campo obbligatorio.'
},
mese:
{
required: 'Campo obbligatorio.'
},
anno:
{
required: 'Campo obbligatorio.'
},
cf:
{
required: 'Campo obbligatorio.'
},
indirizzo:
{
required: 'Campo obbligatorio.'
},
comunetxt:
{
required: 'Campo obbligatorio.'
},
cap:
{
required: 'Campo obbligatorio.'
},
provincia:
{
required: 'Campo obbligatorio.'
},
stato:
{
required: 'Campo obbligatorio.'
},
email:
{
required: 'Campo obbligatorio.',
email: 'Si prega di inserire un indirizzo email corretto.'
},
ragionesociale:
{
required: 'Campo obbligatorio.'
},
piva:
{
required: 'Campo obbligatorio.'
},
indirizzopg:
{
required: 'Campo obbligatorio.'
},
comunepgtxt:
{
required: 'Campo obbligatorio.'
},
cappg:
{
required: 'Campo obbligatorio.'
},
provinciapg:
{
required: 'Campo obbligatorio.'
},
statopg:
{
required: 'Campo obbligatorio.'
},
password:
{
required: 'Campo obbligatorio.',
minlength: 'Si prega di inserire una password di almeno 8 caratteri'
},
privacyok:
{
required: 'Campo obbligatorio.'
}
},
// Ajax form submition
submitHandler: function(form) {
var vars = $("#signupform").serialize();
$.post("/_apps/post.inc.html?" + vars, function (result) {
var resultsplit = result.split('|');
waitingDialog.hide();
if (resultsplit[0] == 'warning') {
showalertmsg(resultsplit[0], resultsplit[1], '1500');
}
else {
showalertmsg(resultsplit[0], resultsplit[1], '1500');
$('#signupform')[0].reset();
$('li.login').hide();
$('li.logged').html(' MY RUN ').show().append('