var Loader = function () { } Loader.prototype = { require: function (scripts, callback) { this.loadCount = 0; this.totalRequired = scripts.length; this.callback = callback; for (var i = 0; i < scripts.length; i++) { this.writeScript(scripts[i]); } }, loaded: function (evt) { this.loadCount++; if (this.loadCount == this.totalRequired && typeof this.callback == "function") this.callback.call(); }, writeScript: function (src) { var self = this; var s = document.createElement("script"); s.type = "text/javascript"; s.async = true; s.src = src; s.addEventListener("load", function (e) { self.loaded(e); }, false); var head = document.getElementsByTagName("head")[0]; head.appendChild(s); } } window.onload = function() { if (typeof $== "function") { console.log("si hay"); Comenzar_ejecucion_divapitcoti(); }else{ console.log("no hay"); var l = new Loader(); l.require(["https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"], function() { // Callback console.log("All Scripts Loaded"); Comenzar_ejecucion_divapitcoti(); }); } } function findPos(obj) { var curtop = 0; if (obj.offsetParent) { do { curtop += obj.offsetTop; } while (obj = obj.offsetParent); return [curtop]; } } function Comenzar_ejecucion_divapitcoti(){ console.log("inicio"); sessionStorage.setItem("outside", "true"); $("html").css({"font-size":"10px"}); if(window.jQuery) { console.log("Jquery ya cargado"); sessionStorage.setItem("jquery_loaded",true); }else{ console.log("Jquery no esta cargado"); sessionStorage.setItem("jquery_loaded",false); } if(sessionStorage.getItem("session_id")===null){ sessionStorage.setItem("session_id", makeid(23)); } if(sessionStorage.getItem("caminos")!=null){ sessionStorage.setItem("caminos",""); } if(sessionStorage.getItem("caminos_pos")!=null){ if(sessionStorage.getItem("caminos_pos")!="0"){ sessionStorage.setItem("caminos_pos","0"); } } sessionStorage.setItem("ce", "calculadordeseguroses"); sessionStorage.setItem("url_server", "https://api.eseguros.es"); sessionStorage.setItem("apikey", "b9d14113-5043-11eb-8f7f-0cc47adc276e"); sessionStorage.setItem("caminos_para_ruta", "DIAS"); var url_padre = window.location.origin+window.location.pathname; sessionStorage.setItem("url_generadora_div",url_padre); var url=""; if(window.location.href.charAt(window.location.href.length-1).localeCompare("#") == 0){ url= window.location.href.substring(0,window.location.href.length-1); }else{ url = window.location.href; } //////////////// vemnos si existe una variable get en la url, se miran las get asi porque no estamos en el mismo servidor acceder como _get no es posible ni viable if(url.split(window.location.origin+window.location.pathname)[1].length>0){ // camino donde hay variables get if(window.location.href.split(window.location.origin+window.location.pathname)[1].includes("ramo")){ // camino donde esas variables get nos pertenecen var datos_get = window.location.href.split(window.location.origin+window.location.pathname)[1].split("?")[1]; sessionStorage.setItem("gets_enviar_email",datos_get); $("#divapicoti_padre").html("