/*var select = document.getElementById('select2-countryForm-container');
var selectDiv = document.getElementsByClassName('form-item-country')[0];
var stateForm;

select.addEventListener('click', function() {
  if (select.title === 'USA' || select.value === '美国' || select.value === '美國' || select.value === 'Vereinigte Staaten' || select.value === 'Estados Unidos' || select.value === 'États-Unis' || select.value === 'Stati Uniti' || select.value === '미국' || select.value === 'Canada' || select.value === '加拿大' || select.value === 'Kanada' || select.value === 'Canadá' || select.value === '캐나다') {
    if (!stateForm) {
      stateForm = document.createElement('div');
      stateForm.className = 'form-group mb-3 col-12 col-md-6 js-form-item js-form-type-select form-type-select js-form-item-state form-item-state';
      stateForm.id = 'stateForm';
      selectDiv.insertAdjacentElement('afterend', stateForm);
    }

    stateForm.innerHTML = `
      <label class="control-label js-form-required form-required">State</label>
      <select class="form-control" name='071-915bf206-ebf2-43e7-8072-465cc2c590b1' required>
        <option value='' selected disabled>Choose your state*</option>
        ${select.title === 'USA' ? `
          <option value='AL'>Alabama</option>
        <option value='AK'>Alaska</option>
        <option value='AZ'>Arizona</option>
        <option value='AR'>Arkansas</option>
        <option value='CA'>California</option>
        <option value='CO'>Colorado</option>
        <option value='CT'>Connecticut</option>
        <option value='DE'>Delaware</option>
        <option value='DC'>District of Columbia</option>
        <option value='FL'>Florida</option>
        <option value='GA'>Georgia</option>
        <option value='HI'>Hawaii</option>
        <option value='ID'>Idaho</option>
        <option value='IL'>Illinois</option>
        <option value='IN'>Indiana</option>
        <option value='IA'>Iowa</option>
        <option value='KS'>Kansas</option>
        <option value='KY'>Kentucky</option>
        <option value='LA'>Louisiana</option>
        <option value='ME'>Maine</option>
        <option value='MD'>Maryland</option>
        <option value='MA'>Massachusetts</option>
        <option value='MI'>Michigan</option>
        <option value='MN'>Minnesota</option>
        <option value='MS'>Mississippi</option>
        <option value='MO'>Missouri</option>
        <option value='MT'>Montana</option>
        <option value='NE'>Nebraska</option>
        <option value='NV'>Nevada</option>
        <option value='NH'>New Hampshire</option>
        <option value='NJ'>New Jersey</option>
        <option value='NM'>New Mexico</option>
        <option value='NY'>New York</option>
        <option value='NC'>North Carolina</option>
        <option value='ND'>North Dakota</option>
        <option value='OH'>Ohio</option>
        <option value='OK'>Oklahoma</option>
        <option value='OR'>Oregon</option>
        <option value='PA'>Pennsylvania</option>
        <option value='PR'>Puerto Rico</option>
        <option value='RI'>Rhode Island</option>
        <option value='SC'>South Carolina</option>
        <option value='SD'>South Dakota</option>
        <option value='TN'>Tennessee</option>
        <option value='TX'>Texas</option>
        <option value='UT'>Utah</option>
        <option value='VT'>Vermont</option>
        <option value='VI'>Virgin Islands</option>
        <option value='VA'>Virginia</option>
        <option value='WA'>Washington</option>
        <option value='WV'>West Virginia</option>
        <option value='WI'>Wisconsin</option>
        <option value='WY'>Wyoming</option>
        ` : `
          <option value='BC'>British Columbia</option>
        <option value='AB'>Alberta</option>
        <option value='SK'>Saskatchewan</option>
        <option value='MB'>Manitoba</option>
        <option value='ON'>Ontario</option>
        <option value='QC'>Quebec</option>
        <option value='NB'>New Brunswick</option>
        <option value='NS'>Nova Scotia</option>
        <option value='PE'>Prince Edward Island</option>
        <option value='NL'>Newfoundland and Labrador</option>
        `}
      </select>
    `;
  } else {
    if (stateForm) {
      stateForm.remove();
      stateForm = null;
    }
  }
});

*/

    if ((window.location.href.indexOf('utm_visitor') > 0)) {
      //Ybug.open('feedback');
      //alert("your url contains the name utm");
          (function() {
        window.ybug_settings = {"id":"snzaa973cz9dgf3s544q"};
        var ybug = document.createElement('script'); ybug.type = 'text/javascript'; ybug.async = true;
        ybug.src = 'https://widget.ybug.io/button/'+window.ybug_settings.id+'.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ybug, s);
    })();

    // YBUG Feedback settings
// language detector + traduzione ybug
var usrlang = document.documentElement.lang;
console.log("User's preferred language is: " + usrlang);
let myLang = usrlang;
let ybugSettings = {
    id:'snzaa973cz9dgf3s544q',
     onload: function() {
       Ybug.open('feedback');
    },
  language_override: myLang,
};
if ((document.documentElement.lang === "de-DE") || (document.documentElement.lang === "de")) {
    console.log("de");
    ybugSettings.translate = {
"feedbackForm.Heading": "Feedback",
"launcherButton.Title": "Feedback",
       "feedbackForm.RatingLabel": "Wie würden Sie Ihre Erfahrung mit unserer Website bewerten?",
 "feedbackForm.TextPlaceholder": "Verfassen Sie einen Kommentar oder beschreiben Sie ein Problem (optional)",
"feedbackForm.OptionalText": " ",
 "feedbackForm.Consent.Label": "Ich stimme den  {tos}",
"feedbackForm.Consent.TosLabel": "Nutzungsbedingungen zu",
"feedbackForm.ButtonSubmit": "Feedback senden",
    }
} else if ((document.documentElement.lang === "it-IT") || (document.documentElement.lang === "it")) {
    console.log("it");
    ybugSettings.translate = {
       "feedbackForm.Heading": "Feedback",
"launcherButton.Title": "Feedback",
       "feedbackForm.RatingLabel": "Come valuteresti la tua esperienza di utilizzo del nostro sito Web?",
 "feedbackForm.TextPlaceholder": "Scrivi un commento o descrivi il problema (opzionale)",
"feedbackForm.OptionalText": " ",
 "feedbackForm.Consent.Label": "Accetto le {tos}",
"feedbackForm.Consent.TosLabel": "condizioni del servizio",
"feedbackForm.ButtonSubmit": "Invia feedback",
    }
} else if ((document.documentElement.lang === "bg-BG") || (document.documentElement.lang === "bg")) {
    console.log("bg");
    ybugSettings.translate = {
        "feedbackForm.Heading": "Обратна връзка",
"launcherButton.Title": "Обратна връзка",
       "feedbackForm.RatingLabel": "Как бихте оценили опита си с нашия уебсайт?",
 "feedbackForm.TextPlaceholder": "Напишете коментар или опишете проблем (по избор)",
"feedbackForm.OptionalText": " ",
 "feedbackForm.Consent.Label": "Приемам {tos}",
"feedbackForm.Consent.TosLabel": "условията за ползване на услугата",
"feedbackForm.ButtonSubmit": "Изпратете обратна връзка",
    }
} else if ((document.documentElement.lang === "zh-CN") || (document.documentElement.lang === "zh") || (document.documentElement.lang === "zh-hans")) {
    console.log("zh-CN");
    ybugSettings.translate = {
       "feedbackForm.Heading": "评价",
"launcherButton.Title": "评价",
       "feedbackForm.RatingLabel": "请评价您对于我们网站的体验？",
 "feedbackForm.TextPlaceholder": "写下您的评价或留下您的问题（选填）",
"feedbackForm.OptionalText": " ",
 "feedbackForm.Consent.Label": "我同意 {tos}",
"feedbackForm.Consent.TosLabel": "服务条款",
"feedbackForm.ButtonSubmit": "提交评价",
    }
} else if ((document.documentElement.lang === "zh-TW") || (document.documentElement.lang === "zh-hant")) {
    console.log("zh-TW");
    ybugSettings.translate = {
  "feedbackForm.Heading": "評價",
"launcherButton.Title": "評價",
       "feedbackForm.RatingLabel": "您對於我們網站體驗的評價？",
 "feedbackForm.TextPlaceholder": "寫一個評價或描述一個問題（選填）",
"feedbackForm.OptionalText": " ",
 "feedbackForm.Consent.Label": "我同意 {tos}",
"feedbackForm.Consent.TosLabel": "服務條款",
"feedbackForm.ButtonSubmit": "提交評價",
    }
} else if ((document.documentElement.lang === "fr-FR") || (document.documentElement.lang === "fr")) {
    console.log("fr");
    ybugSettings.translate = {
       "feedbackForm.Heading": "Retour",
"launcherButton.Title": "Retour",
       "feedbackForm.RatingLabel": "Comment évaluez-vous votre expérience sur notre site web ?",
 "feedbackForm.TextPlaceholder": "Écrire un commentaire ou décrire un problème (facultatif)",
"feedbackForm.OptionalText": " ",
 "feedbackForm.Consent.Label": "J'accepte les {tos}",
"feedbackForm.Consent.TosLabel": "conditions d'utilisation du service",
"feedbackForm.ButtonSubmit": "Soumettre un commentaire",
    }
} else if ((document.documentElement.lang === "ko-KO") || (document.documentElement.lang === "ko")) {
    console.log("ko");
    ybugSettings.translate = {
       "feedbackForm.Heading": "피드백",
"launcherButton.Title": "피드백",
       "feedbackForm.RatingLabel": "당사 웹사이트에 대한 사용 경험을 어떻게 평가하시겠습니까?",
 "feedbackForm.TextPlaceholder": "의견 작성 또는 문제 설명(선택 사항)",
"feedbackForm.OptionalText": " ",
 "feedbackForm.Consent.Label": "{tos} 동의합니다",
"feedbackForm.Consent.TosLabel": "서비스 약관",
"feedbackForm.ButtonSubmit": "피드백 제출",
    }
} else if ((document.documentElement.lang === "es-ES") || (document.documentElement.lang === "es")) {
    console.log("es");
    ybugSettings.translate = {
       "feedbackForm.Heading": "Comentarios",
"launcherButton.Title": "Comentarios",
       "feedbackForm.RatingLabel": "¿Cómo calificaría su experiencia con nuestro sitio web?",
 "feedbackForm.TextPlaceholder": "Escriba un comentario o describa un problema (opcional)",
"feedbackForm.OptionalText": " ",
 "feedbackForm.Consent.Label": "Acepto los {tos}",
"feedbackForm.Consent.TosLabel": " Términos de Servicio",
"feedbackForm.ButtonSubmit": "Enviar comentarios",
    }
} else {
    console.log("en");
myLang= "en";
    ybugSettings.translate = {
       "feedbackForm.Heading": "Feedback",
"launcherButton.Title": "Feedback",
       "feedbackForm.RatingLabel": "How would you rate your experience with our website?",
 "feedbackForm.TextPlaceholder": "Write a comment or describe a problem (optional)",
"feedbackForm.OptionalText": " ",
 "feedbackForm.Consent.Label": "I agree to the {tos}",
"feedbackForm.Consent.TosLabel": "Terms of Service",
"feedbackForm.ButtonSubmit": "Submit feedback",
    }
}
window.ybug_settings = ybugSettings;
    }

document.getElementById('productForm').addEventListener('submit', function(event) {

    // Elimina il valore dal localStorage
    localStorage.removeItem('mediaValue');

});