const dominiobucket = "https://cdn.aseguratuviaje.com"; const url_api = "https://sistema.aseguratuviaje.com/webapi18/api"; const url_app = "https://sistema.aseguratuviaje.com/ventas18/lista/"; var datos; var resultado; var idreference = ""; var lang; var raiz; var createlanding = function (reference, res, theme, cultura, iralraiz) { resultado = res; idreference = reference; lang = cultura; raiz = iralraiz; document.onreadystatechange = function() { if (document.readyState === 'complete') { var landing = document.getElementById("landing"); if(landing ==null){ return; } include(dominiobucket + '/scripts/diccionarios/clientdiccionario_' + lang + '.js',function(){ setIdiomaCoti(); armarCotizador(landing); }); } }; }; var armarCotizador = function(landing){ var html = ''; html += ''; if(landing.offsetWidth <= 300) { html += '
'; html += '
'; html += '
'; html += '
'; html += '
'; html += '
'; html += ''; html += '
'; html += '
'; html += ''; html += '
'; //html += '
'; //html += ''; //html += '
'; html += '
'; html += ''; html += '
'; html += '
'; } else { html += '
'; html += '
'; html += '
'; html += '
'; html += '
'; html += ''; html += '
'; html += '
'; html += ''; html += '
'; //html += '
'; //html += ''; //html += '
'; html += '
'; html += ''; html += '
'; } if (landing.offsetWidth <= 300) { html += '
'; } landing.innerHTML=html; loadDropDown(); initDates(); compararFechas(); }; var loadDropDown = function () { var htmlorigen = ''; var htmlorigenColombia = ''; var htmlorigenEcuador = ''; var htmlorigenMexico = ''; var htmlorigenPeru = ''; var htmlorigenVenezuela = ''; var htmlorigenOtros = ''; var htmlorigenEspana = ''; var htmlorigenBrasil = ''; var htmlorigenChile = ''; var htmlorigenArgentina = ''; var htmldestino = ''; var htmltipoviaje = ''; for(var index in destino) { htmldestino += ''; } for(var index in tipoviaje) { htmltipoviaje += ''; } residence.sort(function (x, y) { return x.name < y.name ? -1 : 1;}); for(var index in residence) { switch (residence[index].id) { case 32: htmlorigenArgentina += ''; break; case 76: htmlorigenBrasil += ''; break; case 152: htmlorigenChile += ''; break; case 170: htmlorigenColombia += ''; break; case 218: htmlorigenEcuador += ''; break; case 724: htmlorigenEspana += ''; break; case 484: htmlorigenMexico += ''; break; case 604: htmlorigenPeru += ''; break; case 862: htmlorigenVenezuela += ''; break; case 840: htmlorigenVenezuela += ''; break; default: htmlorigenOtros += ''; } } document.getElementById("ddlpaisresidencia").innerHTML= "" + htmlorigen + htmlorigenArgentina + htmlorigenBrasil + htmlorigenChile + htmlorigenColombia + htmlorigenEcuador + htmlorigenEspana + htmlorigenMexico + htmlorigenPeru + htmlorigenVenezuela + "" + htmlorigenOtros; document.getElementById("ddlpaisdestino").innerHTML = htmldestino; document.getElementById("ddltipoviaje").innerHTML = htmltipoviaje; }; var initDates= function(){ var now = new Date(); var nowDesde = addDays(now, 1); var nowHasta = addDays(now, 2); var monthDesde = ("0" + (nowDesde.getMonth() + 1)).slice(-2); var monthHasta = ("0" + (nowHasta.getMonth() + 1)).slice(-2); var today = nowDesde.getFullYear() + "-" + (monthDesde) + "-" + ("0" + (nowDesde.getDate())).slice(-2); var tomorrow = nowHasta.getFullYear() + "-" + (monthHasta) + "-" + ("0" + (nowHasta.getDate())).slice(-2); document.getElementById("fdesde").value = today; document.getElementById("fhasta").value = tomorrow; }; var compararFechas = function() { var txtfdesde = document.getElementById("fdesde").value; var txtfhasta = document.getElementById("fhasta").value; var fdesde = new Date(txtfdesde); var fhasta = new Date(txtfhasta); var diff = new Date(fhasta - fdesde); var days = (diff / 1000 / 60 / 60 / 24) + 1; if (diff <= 0) { initDates(); document.getElementById("uicantdias").innerHTML ="2"; } else { document.getElementById("uicantdias").innerHTML =days; } }; var cambioFechaDesde = function() { compararFechas(); }; var cambioFechaHasta = function() { compararFechas(); }; var validarcoti = function() { if (document.getElementById("uiemail").value == '') { alert(idioma.tx66); return false; } if (!validateEmail(document.getElementById("uiemail").value)) { alert(idioma.tx67); return false; } if (document.getElementById("ddlpaisresidencia").value == 0) { alert(idioma.tx68); return false; } if (document.getElementById("ddlpaisdestino").value== 0) { alert(idioma.tx69); return false; } if (document.getElementById("ddltipoviaje").value == 0) { alert(idioma.tx51); return false; } if (document.getElementById("uitraveler1").value.trim() == '') { alert(idioma.tx70); return false; } var edad1 = document.getElementById("uitraveler1").value.trim(); var edad2 = document.getElementById("uitraveler2").value.trim(); var edad3 = document.getElementById("uitraveler3").value.trim(); var edad4 = document.getElementById("uitraveler4").value.trim(); var edad5 = document.getElementById("uitraveler5").value.trim(); if (edad1 != '' && (edad1 <= 0 || isNaN(parseInt(edad1)))) { alert(idioma.tx71); return false; } if (edad2 != '' && (edad2 <= 0 || isNaN(parseInt(edad2)))) { alert(idioma.tx71); return false; } if (edad3 != '' && (edad3 <= 0 || isNaN(parseInt(edad3)))) { alert(idioma.tx71); return false; } if (edad4 != '' && (edad4 <= 0 || isNaN(parseInt(edad4)))) { alert(idioma.tx71); return false; } if (edad5 != '' && (edad5 <= 0 || isNaN(parseInt(edad5)))) { alert(idioma.tx71); return false; } return true; }; var cotizar = function(){ if (!validarcoti()) { return; } document.getElementById("btncotizar").innerHTML = "
"; var tipoviaje = document.getElementById("ddltipoviaje").value; var gestation = "0"; var desde = document.getElementById("fdesde").value; var hasta = document.getElementById("fhasta").value; var edad1 = parseInt(document.getElementById("uitraveler1").value > 0 ? document.getElementById("uitraveler1").value : 0); var edad2 = parseInt(document.getElementById("uitraveler2").value > 0 ? document.getElementById("uitraveler2").value : 0); var edad3 = parseInt(document.getElementById("uitraveler3").value > 0 ? document.getElementById("uitraveler3").value : 0); var edad4 = parseInt(document.getElementById("uitraveler4").value > 0 ? document.getElementById("uitraveler4").value : 0); var edad5 = parseInt(document.getElementById("uitraveler5").value > 0 ? document.getElementById("uitraveler5").value : 0); datos = { PaisDesde: parseInt(document.getElementById("ddlpaisresidencia").value), PaisHasta: parseInt(document.getElementById("ddlpaisdestino").value), TipoViaje: tipoviaje, FechaDesde: desde, FechaHasta: hasta, Edad1: edad1, Edad2: edad2, Edad3: edad3, Edad4: edad4, Edad5: edad5, Cultura: lang, Email: document.getElementById("uiemail").value.trim(), Telefono: document.getElementById("uiwhatsapp").value.trim(), WebService: idreference, SemanaGestacion: gestation, Source: "", Token: "" }; var xhttp = null; if (window.XMLHttpRequest){ xhttp=new XMLHttpRequest(); } else{ xhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xhttp.onreadystatechange = function() { if (this.readyState == 4) { if(this.status == 200){ var result = JSON.parse(this.response); window.location.href = url_app + result.Token; } else{ document.getElementById("btncotizar").innerHTML = idioma.tx18; } } }; xhttp.open("POST", url_api + "/CotizacionSeguroViajero", true); xhttp.setRequestHeader("Content-type", "application/json; charset=utf-8"); xhttp.send(JSON.stringify(datos)); } /*****************************************************************************************************/ function validateEmail(email) { var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(email); } var addDays = function(fecha,dias) { return new Date(fecha.getTime() + dias *24*60*60*1000); }; var include = function(filename, onload) { var head = document.getElementsByTagName('head')[0]; var script = document.createElement('script'); script.src = filename; script.type = 'text/javascript'; script.onload = script.onreadystatechange = function() { if (script.readyState) { if (script.readyState === 'complete' || script.readyState === 'loaded') { script.onreadystatechange = null; onload(); } } else { onload(); } }; head.appendChild(script); };
https://sistema.aseguratuviaje.com/scripts/clientcotimin.js