(function () {
var contacts = {
default: {
titre: "CT CONCEPT SAS - TROTRX® FRANCE",
adresse: "64 ALLÉE DES ENTREPRENEURS
84210 - VENASQUE, FRANCE",
tel: "+33 (0)4 90 34 62 45",
mail: "
[email protected]",
info: "DU LUNDI AU VENDREDI
8h30-12h30 | 13h30-16h30",
map: "64 Allée des Entrepreneurs, 84210 Venasque, France"
},
BE: {
titre: "ARDENNE ACTIVITY — TROTRX® BELGIQUE",
adresse: "12 RUE DES BERGERS
4950 - WAIMES, BELGIQUE",
tel: "+32 495 644 090",
mail: "
[email protected]",
info: "DU LUNDI AU DIMANCHE
10h00-17h00",
map: "12 Rue des Bergers, 4950 Waimes, Belgique"
},
CH: {
titre: "THIBAUD MAROTTA — TROTRX® SUISSE",
adresse: "35 HAUPTSTRASSE
2552 - ORPUND, SUISSE",
tel: "+41 79 501 95 82",
mail: "
[email protected]",
info: "",
map: "35 Hauptstrasse, 2552 Orpund, Suisse"
},
PT: {
titre: "WATT ADVENTURE — TROTRX® PORTUGAL",
adresse: "19 RUA FERNANDO PESSOA, QUINTA DA ALVORADA
8200-372 - ALBUFEIRA, PORTUGAL",
tel: "+351 915 329 312",
mail: "
[email protected]",
info: "DU LUNDI AU DIMANCHE
9h00-19h30",
map: "19 Rua Fernando Pessoa, Quinta da Alvorada, 8200-372 Albufeira, Portugal"
}
};
function setContent(id, content) {
var widget = document.getElementById(id);
if (!widget) return;
var target = widget.querySelector(
".elementor-heading-title, .elementor-icon-list-text"
);
if (!target) return;
target.innerHTML = content || "";
}
function updateMap(address) {
var mapWidget = document.getElementById("contact-map");
if (!mapWidget) return;
var iframe = mapWidget.querySelector("iframe");
if (!iframe) return;
var newSrc =
"https://maps.google.com/maps?q=" +
encodeURIComponent(address) +
"&t=m&z=15&output=embed&iwloc=near";
if (iframe.getAttribute("src") !== newSrc) {
iframe.setAttribute("src", newSrc);
}
}
function clearContact() {
setContent("contact-titre", "");
setContent("contact-adresse", "");
setContent("contact-tel", "");
setContent("contact-mail", "");
setContent("contact-info", "");
}
function updateContact(select) {
var country = select.value ?
select.value.replace(/^\s+|\s+$/g, "") :
"";
if (!country) {
clearContact();
return;
}
var contact = contacts[country] || contacts.default;
setContent("contact-titre", contact.titre);
setContent("contact-adresse", contact.adresse);
setContent("contact-tel", contact.tel);
setContent("contact-mail", contact.mail);
setContent("contact-info", contact.info);
updateMap(contact.map);
}
function findSelect() {
var form = document.querySelector(
'form[name="select_country"]'
);
if (form) {
var select = form.querySelector(
'select[name="form_fields[pays]"]'
);
if (select) return select;
}
return document.querySelector("#form-field-pays");
}
function init() {
var select = findSelect();
if (!select) return false;
if (select.getAttribute("data-trotrx-contact-init") === "1") {
return true;
}
select.setAttribute(
"data-trotrx-contact-init",
"1"
);
select.addEventListener("change", function () {
updateContact(select);
});
select.addEventListener("input", function () {
updateContact(select);
});
updateContact(select);
return true;
}
function start() {
if (init()) return;
var observer = new MutationObserver(function () {
if (init()) {
observer.disconnect();
}
});
observer.observe(document.documentElement, {
childList: true,
subtree: true
});
var attempts = 0;
var timer = setInterval(function () {
attempts++;
if (init() || attempts >= 20) {
clearInterval(timer);
}
}, 500);
}
if (document.readyState === "loading") {
document.addEventListener(
"DOMContentLoaded",
start
);
} else {
start();
}
})();
document.addEventListener("DOMContentLoaded", function () {
const form = document.querySelector('form[name="select_country"]');
if (!form) return;
const button = form.querySelector('button[type="submit"]');
if (!button) return;
button.addEventListener("click", function (event) {
event.preventDefault();
const email = "
[email protected]";
const subject = "Demande pour devenir représentant TROTRX®";
const body =
`Bonjour,
Je souhaite obtenir davantage d’informations afin de devenir représentant TROTRX®.
Pays :
Nom / Société :
Téléphone :
Cordialement,`;
window.location.href =
"mailto:" + email +
"?subject=" + encodeURIComponent(subject) +
"&body=" + encodeURIComponent(body);
});
});