////////////// ############# CHOIX PAYS ################# ///////////////////// function choix_pays(id_pays) { if (!id_pays || id_pays == "" || document.details.area.value == "") { // Pas de pays fournis if (document.details.station) document.details.station.selectedIndex = 0; if (document.details.tdropoff) document.details.tdropoff.selectedIndex = 0; }else if (document.details.area.value == "none") { // Pas de sous-pays choisis if (document.details.station) document.details.station.selectedIndex = 0; if (document.details.tdropoff) document.details.tdropoff.selectedIndex = 0; alert("Merci de sélectionner un pays de destination"); }else{ // Un pays est choisis if (quick_search) { // Quick search --> tarifs.asp document.details.action = "tarifs.asp"; charge_liste_destination_alle(id_pays); }else{ // Pas de quick search --> devis.asp document.details.action = "devis.asp"; valider(); } } } function charge_liste_destination_alle(pays_destination) { // Creation iframe (si besoin) if (! window.frames["dropoff"]) { var new_frame = document.createElement("IFRAME"); new_frame.id = "dropoff"; document.body.appendChild(new_frame); } // Bandeau d'information rouge document.getElementById("station").length = 1; document.getElementById("station").options[0].text = "recherche en cours ..."; document.getElementById("station").options[0].style.color = "#FF0000"; if (document.getElementById("tdropoff")) document.getElementById("tdropoff").length = 1; if (document.getElementById("tdropoff")) document.getElementById("tdropoff").selectedIndex = 0; // Chargement iframe url = "frame_charge_destination.asp?area=" + pays_destination; document.all.dropoff.src = url; } function charge_liste_destination_retour(destination_alle) { // Creation iframe (si besoin) if (! window.frames["dropoff"]) { var new_frame = document.createElement("IFRAME"); new_frame.id = "dropoff"; document.body.appendChild(new_frame); } // Bandeau d'information rouge if (document.getElementById("tdropoff")) document.getElementById("tdropoff").length = 1; if (document.getElementById("tdropoff")) document.getElementById("tdropoff").options[0].text = "recherche en cours ..."; if (document.getElementById("tdropoff")) document.getElementById("tdropoff").options[0].style.color = "#FF0000"; // Chargement iframe url = "frame_charge_retour.asp?destination=" + destination_alle; window.frames["dropoff"].location.href = (url); } function valider() { validation_ok = false; if (document.details.duration) { // Validation avec controle des dates addduration(); // Corrige le pb de date eventuel if (document.details.duration.value == "" || isNaN(document.details.duration.value) || document.details.duration.value <= 0) { document.details.duration.value = 1; addduration(); }else if (document.getElementById("area").value == "") { alert("Merci de saisir un pays de destination"); }else if (document.getElementById("station").value == "") { alert("Merci de sélectionner une ville de destination"); }else if (document.getElementById("dropoff").value == "") { alert("Merci de sélectionner une ville de retour."); }else if (document.details.duration.value == "" || isNaN(document.details.duration.value) || document.details.duration.value <= 0) { // Durée négative ou mal renseignée document.details.duration.value = 1; addduration(); }else if (document.details.fiDriverAge && document.details.fiDriverAge.value == "") { alert("Merci de saisir l'age du conducteur."); }else{ validation_ok = true; } }else{ // Validation sans controle des dates validation_ok = true; } if (validation_ok) { if (document.details.tlocation && document.details.station) document.details.tlocation.value = document.details.station.value; document.details.pays.value = document.details.area.options[document.details.area.selectedIndex].text; document.details.submit(); } } function quick_link(id_pays, destination) { // Bandeau d'information rouge document.getElementById("station").length = 1; document.getElementById("station").options[0].text = "recherche en cours ..."; document.getElementById("station").options[0].style.color = "#FF0000"; document.getElementById("tdropoff").length = 1; document.getElementById("tdropoff").options[0].text = "recherche en cours ..."; document.getElementById("tdropoff").options[0].style.color = "#FF0000"; document.details.area.value = id_pays; //document.details.pays.value = document.details.area.options[document.details.area.selectedIndex].text; document.form_lien_direct.area.value = document.details.area.value; document.form_lien_direct.ville.value = destination; document.form_lien_direct.action = "devis.asp"; document.form_lien_direct.submit(); }