$(document).ready(function() { // FECHAS $('#datepicker1').datepicker({ language: "es", "setDate": new Date() }).datepicker("setDate", "now").on('changeDate', function (selected) { check(); document.getElementById('datepicker2').value = document.getElementById('datepicker1').value ; $(this).datepicker('hide'); // Tag Manager var dataObject = { 'event': 'Select_Fecha1', selectedElement_fecha1: document.getElementById('datepicker1').value }; if(typeof dataLayer != 'undefined'){ dataLayer.push(dataObject); } }) $('#datepicker2').datepicker({ language: "es", toggleActive: false, }).datepicker("setDate", "now").on('changeDate', function (selected) { check(); //document.getElementById('datepicker1').value = document.getElementById('datepicker2').value ; $(this).datepicker('hide'); // Tag Manager var dataObject = { 'event': 'Select_Fecha2', selectedElement_fecha2: document.getElementById('datepicker2').value }; if(typeof dataLayer != 'undefined'){ dataLayer.push(dataObject); } }) // ---------------------------------- // SEARCH DOC -DOCTORES var bestPictures = new Bloodhound({ datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'), queryTokenizer: Bloodhound.tokenizers.whitespace, "identify": function(obj) { return obj.title; } ,remote: { url: 'https://www.horalibre.cl/get?action=doctor2&q=%QUERY', wildcard: '%QUERY', cache: false } }); $('#remote11 .typeahead').typeahead({ hint: true, highlight: true, }, { name: 'best-pictures', display: 'value', source: bestPictures, limit: 30 // Debe ser el doble de la cantidad real Dataset }).on('typeahead:select typeahead:autocompleteds', function(ev, suggestion) { //$('#id_titulo').val(suggestion.title); window.location = suggestion.title; }); // ------------------------------------------------ // SEARCH DOC -HOME var bestPictures2 = new Bloodhound({ datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'), queryTokenizer: Bloodhound.tokenizers.whitespace, "identify": function(obj) { return obj.title; } ,remote: { url: 'https://www.horalibre.cl/get?'+id_clinica+'&action=doctor2&q=%QUERY', replace: function(url, uriEncodedQuery) { var q = document.getElementById('buscar_doc2').value; return 'https://www.horalibre.cl/get?id_clinica='+id_clinica+'&id_sucursal='+id_sucursal+'&action=doctor&term='+q }, wildcard: '%QUERY', cache: false } }); $('#remote12 .typeahead').typeahead({ hint: true, highlight: true, }, { name: 'best-pictures2', display: 'value', source: bestPictures2, limit: 30 // Debe ser el doble de la cantidad real Dataset }).on('typeahead:select typeahead:autocompleteds', function(ev, suggestion) { $('#id_doctor').val(suggestion.id); // Tag Manager var dataObject = { 'event': 'Select_Doctor', selectedElement_doctor: suggestion.value }; if(typeof dataLayer != 'undefined'){ dataLayer.push(dataObject); } check(); }); // ------------------------------------------------ //-------------------------- $("#buscar_doc").addClear({ top : 5, onClear: function( ){ //inicio_sitio=0; //doneTyping (); //$("#tabla_search_noticias").html(''); // event.preventDefault(); $("#buscar_doc").val('').trigger("input"); $("#buscar_doc").empty(); //alert("Input Cleared!"); } }); $("#buscar_doc2").addClear({ top : 5, onClear: function( ){ //inicio_sitio=0; //doneTyping (); //$("#tabla_search_noticias").html(''); // event.preventDefault(); $("#buscar_doc2").val('').trigger("input"); $("#buscar_doc2").empty(); document.getElementById('id_doctor').value="0"; check(); // Tag Manager var dataObject = { 'event': 'Clear_Doctor_Home' }; if(typeof dataLayer != 'undefined'){ dataLayer.push(dataObject); } //alert("Input Cleared!"); } }); $("#mail").addClear({ top : 65, right : 18, onClear: function( ){ //inicio_sitio=0; //doneTyping (); //$("#tabla_search_noticias").html(''); // event.preventDefault(); $("#mail").val('').trigger("input"); $("#mail").empty(); //alert("Input Cleared!"); } }); $("#hora1").change(function(){ // Tag Manager var dataObject = { 'event': 'Select_hora1', selectedElement_hora1: document.getElementById('hora1').options[document.getElementById('hora1').selectedIndex].text }; if(typeof dataLayer != 'undefined'){ dataLayer.push(dataObject); } }); $("#hora2").change(function(){ // Tag Manager var dataObject = { 'event': 'Select_hora2', selectedElement_hora2: document.getElementById('hora2').options[document.getElementById('hora2').selectedIndex].text }; if(typeof dataLayer != 'undefined'){ dataLayer.push(dataObject); } }); $("#ver_mas").click(function(){ // Tag Manager var dataObject = { 'event': 'Click_Ver_mas' }; if(typeof dataLayer != 'undefined'){ dataLayer.push(dataObject); } }); //END DOCUMENT READY try{ check(); } catch(e){} }); var id_clinica=0; var id_sucursal=0; var id_tipo=0; var fecha_ini=0; var fecha_fin=0; var hora_ini=0; var hora_fin=0; var id_doctor=0; var id_especialidad=0; var id_sub_especialidad=0; var id_examen=0; var id_sub_examen=0; var mail=""; var celular=""; var recaptcha_challenge_field; var recaptcha_response_field; var continuacion = ""; var id_finaliza_sinapp = 0; function check_569() { var cel = document.getElementById('celular').value; if (cel.substring(0,3) == "569") { alert("Solo debes ingresar tu celular sin +56-9"); document.getElementById('celular').value = ""; } if (cel.substring(0,1) == "+") { alert("Solo debes ingresar tu celular sin +56-9"); document.getElementById('celular').value = ""; } } function resizeReCaptcha() { var width = $( ".g-recaptcha" ).parent().width(); if (width < 302) { var scale = width / 302; } else { var scale = 1; } $( ".g-recaptcha" ).css('transform', 'scale(' + scale + ')'); $( ".g-recaptcha" ).css('-webkit-transform', 'scale(' + scale + ')'); $( ".g-recaptcha" ).css('transform-origin', '0 0'); $( ".g-recaptcha" ).css('-webkit-transform-origin', '0 0'); }; function clinica_sub_especialidad(clinica) { if (clinica == 2 || clinica == 3 || clinica == 4 || clinica == 7 || clinica == 11) { return true; } else { return false; } } function reset_form(val=0) { if (val==1) {} else { setOption("doc_esp_exa",0); } setOption("clinica",0); setOption("sucursal",0); document.getElementById('c_especialidades_doctor').style.display = 'none'; document.getElementById('c_sub_especialidad').style.display = 'none'; document.getElementById('c_doctor').style.display = 'none'; document.getElementById('c_examenes').style.display = 'none'; document.getElementById('c_sub_examenes').style.display = 'none'; $("#b_continuar").disable(true); $('#formCheck-1').prop('checked', false); var a = $('#clinica').attr("class"); a = a.replace("bg-white", "bg-light"); $('#clinica').attr('class', a); $("#clinica").prop("disabled", "disabled"); var a = $('#sucursal').attr("class"); a = a.replace("bg-white", "bg-light"); $('#sucursal').attr('class', a); $("#sucursal").prop("disabled", "disabled"); var a = $('#buscar_doc2').attr("class"); a = a.replace("bg-white", "bg-light"); $('#buscar_doc2').attr('class', a); $("#buscar_doc2").prop("disabled", "disabled"); $("#buscar_doc2").val('').trigger("input"); $("#buscar_doc2").empty(); } function get_clinicas(id,id_tipo) { var randomnumber=Math.random()*11; id_tipo = document.getElementById('doc_esp_exa').options[document.getElementById('doc_esp_exa').selectedIndex].value; if (id_tipo != 0) { $('#c_clinicas').load('https://www.horalibre.cl/get?action=clinicas&clinica='+id+'&id_tipo='+id_tipo+'&'+randomnumber); // Tag Manager var dataObject = { 'event': 'Select_Tipo', selectedElement_tipo: document.getElementById('doc_esp_exa').options[document.getElementById('doc_esp_exa').selectedIndex] }; if(typeof dataLayer != 'undefined'){ dataLayer.push(dataObject); } } } function get_sucursales(id_clinica,id) { id_clinica = id_clinica; var randomnumber=Math.random()*11; id_tipo = document.getElementById('doc_esp_exa').options[document.getElementById('doc_esp_exa').selectedIndex].value; $('#c_sucursales').load('https://www.horalibre.cl/get?action=sucursales&id_sucursal='+id+'&id_clinica='+id_clinica+'&'+randomnumber); // Tag Manager var dataObject = { 'event': 'Select_Clinica', selectedElement_clinica: document.getElementById('clinica').options[document.getElementById('clinica').selectedIndex] }; if(typeof dataLayer != 'undefined'){ dataLayer.push(dataObject); } if (id_tipo != 0) { //get_especialidades_doctor(id_tipo,'',''); } check(); } function get_sub_especialidad(id) { id_clinica = document.getElementById('clinica').options[document.getElementById('clinica').selectedIndex].value; id_sucursal = document.getElementById('sucursal').options[document.getElementById('sucursal').selectedIndex].value; id_especialidad = document.getElementById('especialidad').options[document.getElementById('especialidad').selectedIndex].value; if (clinica_sub_especialidad(id_clinica)) { document.getElementById('c_sub_especialidad').style.display = 'block'; var randomnumber=Math.random()*11; $('#c_sub_especialidad').load('https://www.horalibre.cl/get?action=sub_especialidades&id_sub_especialidad='+id+'&id_clinica='+id_clinica+'&id_sucursal='+id_sucursal+'&id_especialidad='+id_especialidad+'&'+randomnumber, function() {if (id != '') {show_fechas();check();}}); } else { show_fechas(); } } function get_sub_examen(id) { id_clinica = document.getElementById('clinica').options[document.getElementById('clinica').selectedIndex].value; id_sucursal = document.getElementById('sucursal').options[document.getElementById('sucursal').selectedIndex].value; id_examen = document.getElementById('examen').options[document.getElementById('examen').selectedIndex].value; if (clinica_sub_especialidad(id_clinica)) { document.getElementById('c_sub_examenes').style.display = 'block'; var randomnumber=Math.random()*11; $('#c_sub_examenes').load('https://www.horalibre.cl/get?action=sub_examen&id_sub_examen='+id+'&id_clinica='+id_clinica+'&id_sucursal='+id_sucursal+'&id_examen='+id_examen+'&'+randomnumber, function() {if (id != '') {show_fechas();check();}}); } else { show_fechas(); } } function get_especialidades_doctor(valor,id,id2) { // Tag Manager var dataObject = { 'event': 'Select_Sucursal', selectedElement_sucursal: document.getElementById('sucursal').options[document.getElementById('sucursal').selectedIndex] }; if(typeof dataLayer != 'undefined'){ dataLayer.push(dataObject); } id_clinica = document.getElementById('clinica').options[document.getElementById('clinica').selectedIndex].value; id_sucursal = document.getElementById('sucursal').options[document.getElementById('sucursal').selectedIndex].value; if (valor == '1') { document.getElementById('c_especialidades_doctor').style.display = 'none'; document.getElementById('c_sub_especialidad').style.display = 'none'; document.getElementById('c_doctor').style.display = 'block'; document.getElementById('c_examenes').style.display = 'none'; document.getElementById('c_sub_examenes').style.display = 'none'; var a = $('#buscar_doc2').attr("class"); a = a.replace("bg-light", "bg-white"); $('#buscar_doc2').attr('class', a); $("#buscar_doc2").prop("disabled", ""); } else if (valor == '2') { document.getElementById('c_doctor').style.display = 'none'; document.getElementById('c_especialidades_doctor').style.display = 'block'; document.getElementById('c_sub_especialidad').style.display = 'none'; document.getElementById('c_examenes').style.display = 'none'; document.getElementById('c_sub_examenes').style.display = 'none'; var randomnumber=Math.random()*11; $('#c_especialidades_doctor').load('https://www.horalibre.cl/get?action=especialidades&id_especialidad='+id+'&id_clinica='+id_clinica+'&id_sucursal='+id_sucursal+'&'+randomnumber, function() { if (id != '') {get_sub_especialidad(id2);}}); } else if (valor == '3') { document.getElementById('c_doctor').style.display = 'none'; document.getElementById('c_especialidades_doctor').style.display = 'none'; document.getElementById('c_sub_especialidad').style.display = 'none'; document.getElementById('c_examenes').style.display = 'block'; document.getElementById('c_sub_examenes').style.display = 'none'; var randomnumber=Math.random()*11; $('#c_examenes').load('https://www.horalibre.cl/get?action=examenes&id_examen='+id+'&id_clinica='+id_clinica+'&id_sucursal='+id_sucursal+'&'+randomnumber, function() { if (id != '') {get_sub_especialidad(id2);}}); } set_variables(); try { document.getElementById('especialidad').options[document.getElementById('especialidad').selectedIndex].value =0; document.getElementById('examen').options[document.getElementById('examen').selectedIndex].value =0; } catch(err) {} try { document.getElementById('sub_especialidad').options[document.getElementById('sub_especialidad').selectedIndex].value =0; document.getElementById('sub_examen').options[document.getElementById('sub_examen').selectedIndex].value =0; } catch(err) {} try { if (id_doctor_temporal == 1) { id_doctor_temporal = 0; } else { document.getElementById('id_doctor').value = "0"; $("#buscar_doc2").val('').trigger("input"); $("#buscar_doc2").empty(); } } catch(err) {} check(); } function show_especialidad() { id_clinica = document.getElementById('clinica').options[document.getElementById('clinica').selectedIndex].value; id_sucursal = document.getElementById('sucursal').options[document.getElementById('sucursal').selectedIndex].value; if (id_tipo != 0) { get_especialidades_doctor(id_tipo,'',''); } if( document.getElementById('sucursal').options[document.getElementById('sucursal').selectedIndex].value != '0') { document.getElementById("doc_esp_exa").disabled=false; //document.getElementById('doctor_especialidad').style.display='block'; } else { document.getElementById("doc_esp_exa").disabled=true; //document.getElementById('doctor_especialidad').style.display='none'; } } function show_fechas() { /* if( document.getElementById('clinica').options[document.getElementById('clinica').selectedIndex].value != '0') { document.getElementById('fechas').style.display='block'; } else { document.getElementById('fechas').style.display='none'; } check(); */ } function volver() { document.getElementById('tabla1').style.display='block'; document.getElementById('tabla2').style.display='none'; } function continuar() { check(); document.getElementById('confirma_paso1').style.display = 'block'; document.getElementById('confirma_paso1_sinapp').style.display = 'none'; document.getElementById('confirma_paso2').style.display = 'none'; set_confirmacion(); grecaptcha.reset(); document.getElementById("error_modal").style.display='none'; $("#b_continuar2").disable(false); $("#b_continuar2").html('Ingresar Solicitud') $('#modal_confirmar').modal('show'); resizeReCaptcha(); /* document.getElementById('tabla1').style.display='none'; document.getElementById('tabla2').style.display='block'; document.getElementById('mail_incorrecto').style.display='none'; // document.getElementById('captcha_incorrecto').style.display='none'; document.getElementById('celular_incorrecto').style.display='none'; document.getElementById('ya_ingresado').style.display='none'; document.getElementById("mail").focus(); */ } function finalizar() { check(); $("#b_continuar2").disable(true); $("#b_continuar2").html('Ingresando tu Solicitud... '); document.getElementById('error_modal').style.display='none'; if (id_tipo == 3) { id_especialidad = id_examen; id_sub_especialidad = id_sub_examen; } $.post("https://www.horalibre.cl/get", {recaptcha:grecaptcha.getResponse(), id_clinica: id_clinica, id_sucursal: id_sucursal, id_tipo: id_tipo, id_doctor: id_doctor, id_especialidad: id_especialidad,id_sub_especialidad: id_sub_especialidad, fecha_ini: fecha_ini, fecha_fin: fecha_fin, hora_ini: hora_ini, hora_fin: hora_fin, mail: mail, celular: celular, recaptcha_challenge_field: recaptcha_challenge_field,recaptcha_response_field:recaptcha_response_field,consulta:'1',continuacion:continuacion}) .done(async function(data) { if (data.indexOf("error",0)>=0) { await sleep(2000); var texto = data.split("|"); document.getElementById('error_modal').innerHTML = texto[1]; document.getElementById('error_modal').style.display='block'; $("#b_continuar2").disable(false); $("#b_continuar2").html('Ingresar Solicitud') grecaptcha.reset(); } if (data.trim() == 'ok') { document.getElementById('confirma_paso2').style.display='block'; document.getElementById('confirma_paso1').style.display='none'; reset_form(); } if (data.indexOf("ok2",0)>=0) { var texto = data.split("|"); id_finaliza_sinapp = texto[1]; document.getElementById('confirma_paso1_sinapp').style.display='block'; document.getElementById('confirma_paso1').style.display='none'; } //alert("Data Loaded: " + data); }) ; } function finalizar_sinapp() { $.post("https://www.horalibre.cl/get", {finalizar_sinapp:'1',id:id_finaliza_sinapp}) .done(async function(data) { if (data.trim() == 'ok') { document.getElementById('confirma_paso2').style.display='block'; document.getElementById('confirma_paso1_sinapp').style.display='none'; //reset_form(); } }) ; } function set_confirmacion() { document.getElementById('clinica_conf2').innerHTML = document.getElementById('clinica').options[document.getElementById('clinica').selectedIndex].text; document.getElementById('sucursal_conf2').innerHTML = document.getElementById('sucursal').options[document.getElementById('sucursal').selectedIndex].text; document.getElementById('tipo_conf2').innerHTML = document.getElementById('doc_esp_exa').options[document.getElementById('doc_esp_exa').selectedIndex].text; //Doctor if (document.getElementById('doc_esp_exa').options[document.getElementById('doc_esp_exa').selectedIndex].value == 1) { document.getElementById('especialidad_conf').style.display='none'; document.getElementById('sub_especialidad_conf').style.display='none'; document.getElementById('sub_examen_conf').style.display='none'; document.getElementById('examen_conf').style.display='none'; document.getElementById('doctor_conf').style.display='block'; document.getElementById('doctor_conf2').innerHTML = document.getElementById('buscar_doc2').value; } //Especialidades if (document.getElementById('doc_esp_exa').options[document.getElementById('doc_esp_exa').selectedIndex].value == 2) { document.getElementById('especialidad_conf').style.display='block'; document.getElementById('examen_conf').style.display='none'; document.getElementById('doctor_conf').style.display='none'; document.getElementById('sub_especialidad_conf').style.display='none'; document.getElementById('sub_examen_conf').style.display='none'; document.getElementById('especialidad_conf2').innerHTML = document.getElementById('especialidad').options[document.getElementById('especialidad').selectedIndex].text; if (clinica_sub_especialidad(id_clinica)) { document.getElementById('sub_especialidad_conf').style.display='block'; document.getElementById('sub_especialidad_conf2').innerHTML = document.getElementById('sub_especialidad').options[document.getElementById('sub_especialidad').selectedIndex].text; } else { document.getElementById('sub_especialidad_conf').style.display='none'; document.getElementById('sub_especialidad_conf2').innerHTML = ""; } } //Examenes if (document.getElementById('doc_esp_exa').options[document.getElementById('doc_esp_exa').selectedIndex].value == 3) { document.getElementById('especialidad_conf').style.display='none'; document.getElementById('examen_conf').style.display='block'; document.getElementById('doctor_conf').style.display='none'; document.getElementById('sub_especialidad_conf').style.display='none'; document.getElementById('sub_examen_conf').style.display='none'; document.getElementById('examen_conf2').innerHTML = document.getElementById('examen').options[document.getElementById('examen').selectedIndex].text; if (clinica_sub_especialidad(id_clinica)) { document.getElementById('sub_examen_conf').style.display='block'; document.getElementById('sub_examen_conf2').innerHTML = document.getElementById('sub_examen').options[document.getElementById('sub_examen').selectedIndex].text; } else { document.getElementById('sub_examen_conf').style.display='none'; document.getElementById('sub_examen_conf2').innerHTML = ""; } } document.getElementById('fechas_conf2').innerHTML = "entre "+document.getElementById('datepicker1').value+" y "+document.getElementById('datepicker2').value; if (document.getElementById('hora1').value != 0 && document.getElementById('hora2').value != 0) { document.getElementById('horas_conf').style.display='block'; document.getElementById('horas_conf2').innerHTML = "entre "+document.getElementById('hora1').options[document.getElementById('hora1').selectedIndex].text+" y "+document.getElementById('hora2').options[document.getElementById('hora2').selectedIndex].text; } else { document.getElementById('horas_conf').style.display='none'; } //document.getElementById('id_mail_conf').innerHTML = document.getElementById('mail').value; //document.getElementById('id_cel_conf').innerHTML = '+56-9-'+document.getElementById('celular').value; } function set_variables() { id_clinica = document.getElementById('clinica').options[document.getElementById('clinica').selectedIndex].value; try { id_sucursal = document.getElementById('sucursal').options[document.getElementById('sucursal').selectedIndex].value; } catch(err) { id_sucursal = 0; } id_tipo = document.getElementById('doc_esp_exa').options[document.getElementById('doc_esp_exa').selectedIndex].value; fecha_ini = document.getElementById('datepicker1').value; fecha_fin = document.getElementById('datepicker2').value; hora_ini = document.getElementById('hora1').value; hora_fin = document.getElementById('hora2').value; mail = document.getElementById('mail').value; celular = document.getElementById('celular').value; // recaptcha_challenge_field = document.getElementById('recaptcha_challenge_field').value; // recaptcha_response_field = document.getElementById('recaptcha_response_field').value; } function check() { set_variables(); if (id_clinica != 0 && id_sucursal != 0 && id_tipo != 0) { if (id_tipo == 1) // Doctor { id_doctor = document.getElementById('id_doctor').value; if (id_doctor != 0) { if ($('#formCheck-1').is(":checked")) { $("#b_continuar").disable(false); //$('#b_continuar').button('enable'); // document.getElementById("b_continuar").disabled=false; } else { $("#b_continuar").disable(true); //$('#b_continuar').button('disable'); } } else { $("#b_continuar").disable(true); //$('#b_continuar').button('disable'); } } if (id_tipo == 2) // Especialidad { if (clinica_sub_especialidad(id_clinica)) { try { id_especialidad = document.getElementById('especialidad').options[document.getElementById('especialidad').selectedIndex].value; } catch(err) { id_especialidad = 0; } try { id_sub_especialidad = document.getElementById('sub_especialidad').options[document.getElementById('sub_especialidad').selectedIndex].value; } catch(err) { id_sub_especialidad = 0; } if (id_especialidad != 0 && id_sub_especialidad != 0) { if ($('#formCheck-1').is(":checked")) { $("#b_continuar").disable(false); //$('#b_continuar').button('enable'); } else { $("#b_continuar").disable(true); //$('#b_continuar').button('disable'); } } else { $("#b_continuar").disable(true); //$('#b_continuar').button('disable'); } } else { try { id_especialidad = document.getElementById('especialidad').options[document.getElementById('especialidad').selectedIndex].value; } catch(err) { id_especialidad = 0; } if (id_especialidad != 0) { if ($('#formCheck-1').is(":checked")) { $("#b_continuar").disable(false); //$('#b_continuar').button('enable'); } else { $("#b_continuar").disable(true); //$('#b_continuar').button('disable'); } } else { $("#b_continuar").disable(true); //$('#b_continuar').button('disable'); } } } if (id_tipo == 3) // Examenes { if (clinica_sub_especialidad(id_clinica)) { try { id_examen = document.getElementById('examen').options[document.getElementById('examen').selectedIndex].value; } catch(err) { id_examen = 0; } try { id_sub_examen = document.getElementById('sub_examen').options[document.getElementById('sub_examen').selectedIndex].value; } catch(err) { id_sub_examen = 0; } if (id_examen != 0 && id_sub_examen != 0) { if ($('#formCheck-1').is(":checked")) { $("#b_continuar").disable(false); //$('#b_continuar').button('enable'); } else { $("#b_continuar").disable(true); //$('#b_continuar').button('disable'); } } else { $("#b_continuar").disable(true); //$('#b_continuar').button('disable'); } } else { try { id_examen = document.getElementById('examen').options[document.getElementById('examen').selectedIndex].value; } catch(err) { id_examen = 0; } if (id_examen != 0) { if ($('#formCheck-1').is(":checked")) { $("#b_continuar").disable(false); //$('#b_continuar').button('enable'); } else { $("#b_continuar").disable(true); //$('#b_continuar').button('disable'); } } else { $("#b_continuar").disable(true); //$('#b_continuar').button('disable'); } } } } else { $("#b_continuar").disable(true); //$('#b_continuar').button('disable'); } } function fnIsAppleMobile() { if (navigator && navigator.userAgent && navigator.userAgent != null) { var strUserAgent = navigator.userAgent.toLowerCase(); var arrMatches = strUserAgent.match(/(iphone|ipod|ipad)/); if (arrMatches) return true; } // End if (navigator && navigator.userAgent) return false; } // End Function fnIsAppleMobile function set_static(valor) { if (fnIsAppleMobile()) { if (valor == "1") { document.getElementById('ft').style.position = 'static'; } if (valor == "2") { document.getElementById('ft').style.position = 'fixed'; } } } function setOption(selectElement, value) { var options = document.getElementById(selectElement).options; for (var i = 0, optionsLength = options.length; i < optionsLength; i++) { if (options[i].value == value) { options.selectedIndex = i; return true; } } return false; } // Disable function jQuery.fn.extend({ disable: function(state) { return this.each(function() { this.disabled = state; }); } }); function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }