function qSeclector(elem){ return d.querySelector(elem); };var qAll = function(elem){ return d.querySelectorAll(elem); };var load =qSeclector("#"+IdDiv);load.innerHTML=`
`; async function loadMap(){var t=qSeclector('#appScriptForms'),a=d.createElement("script");a.type="text/javascript",a.id="apiMap",a.loaded="async",a.async=!0,a.src="https://maps.googleapis.com/maps/api/js?key=AIzaSyD4EnKn-u2jXwq0KPQSadqX7YaS4OYDrgw&libraries=places",t.after(a)} function initMapPace(inputIdAddress, showMap) { var searchInput = inputIdAddress; const input = document.getElementById(searchInput); const searchBox = new google.maps.places.SearchBox(input); const myLatLng = { lat:40.0992, lng:-83.1141}; console.log('lat', myLatLng.lat, 'lng', myLatLng.lng);let markers=[]; if(showMap && document.getElementById("map").style.display!='none'){ let e=new google.maps.Map(document.getElementById("map"),{center:myLatLng,zoom:17,mapTypeId:"roadmap"});e.addListener("bounds_changed",()=>{searchBox.setBounds(e.getBounds())}) } searchBox.addListener("places_changed",()=>{ let e=searchBox.getPlaces(); if(0!=e.length){ let address_components = {'address': null,'city': null,'state': null,'zip': null}; e[0].address_components.find((component) =>{ if (component['types'].indexOf('street_number')>-1){ if (address_components['address']){address_components['address'] += ' ' + component['long_name']} else{address_components['address'] = component['long_name']} } if (component['types'].indexOf('route')>-1){ if (address_components['address']){address_components['address'] += ' ' + component['long_name']} else{address_components['address'] = component['long_name']} } if (component['types'].indexOf('locality')>-1){ address_components['city'] = component['long_name'] } if (component['types'].indexOf('administrative_area_level_1')>-1){ address_components['state'] = component['long_name'] } if (component['types'].indexOf('postal_code')>-1){ address_components['zip'] = component['long_name'] } });document.getElementById("address_short").value = address_components['address']; document.getElementById("city_short").value = address_components['city']; document.getElementById("state_short").value = address_components['state']; document.getElementById("zip_short").value = address_components['zip']; } if(showMap && document.getElementById("map").style.display!='none'){ 0!=e.length&&(markers.forEach(e=>{e.setMap(null)}),markers=[],e.forEach(e=>{if(!e.geometry||!e.geometry.location){console.log("Returned place contains no geometry");return}null!=map&&(map.panTo(e.geometry.location),map.setZoom(19),e.icon,new google.maps.Size(71,71),new google.maps.Point(0,0),new google.maps.Point(17,34),new google.maps.Size(25,25),markers.push(new google.maps.Marker({map,title:e.name,position:e.geometry.location})))})) } }); }; function noEnter(e) {if (e.which === 13 && !e.shiftKey) {e.preventDefault();console.log('no enter');return false;}} var urlCssMain='#appForms{display:flex;justify-content:center;width:99%;position:absolute;height:80vh;align-items:center;background:rgba(0,0,0,.2)}.loading{position:relative;top:0;left:0;right:0;bottom:0;background-color:rgb(0 0 0 / 32%);display:flex!important;justify-content:center;align-items:center;z-index:9999;transition:1s all;opacity:0}.loading.show{opacity:1}.loading .spin{border:3px solid hsla(185,100%,62%,.2);border-top-color:#019720;background-color:transparent!important;border-radius:50%;width:3em;height:3em;animation:spin 1s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.c1-1{width:100%;float:left}.c1-2{width:50%;float:left}.c1-3{width:33.333%;float:left}.c1-4{width:25%;float:left}@media(max-width:767px){.c1-2{width:100%}.c1-3{width:100%}.c1-4{width:100%}}div#formApp{display:flex;margin:0 auto;width:100%;max-width:1000px;font-family:arial;margin-top:15px}form.builder .form-group{display:flex;margin-bottom:10px;flex-direction:column;padding:0 10px;box-sizing:border-box}form.builder label{display:block;width:100%;margin-top:0;display:inline-block;margin-bottom:.1rem;color:#6a7a8c;font-size:14px;font-weight:400}form.builder input[type=checkbox],form.builder input[type=radio]{vertical-align:middle;min-height:0}label.c-input.c-radio{width:100%;display:block}form.builder input[type=button],form.builder input[type=file],form.builder input[type=image],form.builder input[type=reset],form.builder input[type=submit],form.builder input[type=text],form.builder select{min-height:30px;display:flex;flex-direction:row;-webkit-border-radius:0px;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:0 0 #000;box-shadow:0 0 #000;border:1px solid #c3c3c3;padding:.375rem .75rem;line-height:inherit;height:30px}form.builder textarea{min-height:30px;height: 100px;display:flex;flex-direction:row;-webkit-border-radius:0px;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:0 0 #000;box-shadow:0 0 #000;border:1px solid #c3c3c3;padding:.375rem .75rem;line-height:inherit}.form-group.c1-1.btn-formApp{flex-direction:initial}.form-group.c1-1.btn-formApp label{display:none}form.builder button{-webkit-box-shadow:none;box-shadow:none;border:1px solid #222223;padding:10px 20px;cursor:pointer;display:block;margin: auto;}.alertx{position:relative;padding:.75rem 1.25rem;margin-bottom:1rem;border:1px solid transparent;border-radius:.25rem;padding-right:20px}.alert-successx{color:#155724;background-color:#d4edda;border-color:#c3e6cb}.alert-dangerx{color:#721c24;background-color:#f8d7da;border-color:#f5c6cb}.closex:not(:disabled):not(.disabled){cursor:pointer}.closex{font-size:24px!important;float:right;font-weight:700;line-height:1;color:#000!important;text-shadow:0 1px 0 #fff;opacity:.5;border:none;background:0 0;position:absolute;right:-15px;top:-10px}button,select{text-transform:none}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}@-webkit-keyframes hvr-buzz{50%{-webkit-transform:translateX(3px) rotate(2deg);transform:translateX(3px) rotate(2deg)}100%{-webkit-transform:translateX(-3px) rotate(-2deg);transform:translateX(-3px) rotate(-2deg)}}@keyframes hvr-buzz{50%{-webkit-transform:translateX(3px) rotate(2deg);transform:translateX(3px) rotate(2deg)}100%{-webkit-transform:translateX(-3px) rotate(-2deg);transform:translateX(-3px) rotate(-2deg)}}.rInvalid{border:2px solid red!important;-webkit-transform:perspective(1px) translateZ(0);transform:perspective(1px) translateZ(0);box-shadow:0 0 1px transparent;-webkit-animation-name:hvr-buzz;animation-name:hvr-buzz;-webkit-animation-duration:.15s;animation-duration:.15s;-webkit-animation-timing-function:linear;animation-timing-function:linear;-webkit-animation-iteration-count:1;animation-iteration-count:1}div#lockScreen iframe{width:300px;height:400px;overflow:hidden;border:1px solid #ddd;border-radius:4px}div#lockScreen{position:fixed;top:0;left:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center;border:0 solid #000;background-color:rgb(0 0 0 / 50%);z-index:9999}div#lockScreen button{position:absolute;margin-top:-370px;margin-right:-275px;padding:0;background-color:transparent;border-color:transparent;color:#000;font-size:45px}textarea#address-google { height: 36px;resize: none;}';var urlStyles='form.builder label{display:inline-block;margin-bottom:0.1rem;color:rgba(106, 122, 140, 1);font-size:14px;font-weight:400;}form.builder .form-controlx{display:block;width:100%;padding:0.375rem0.75rem;font-size:14px;color:rgba(79, 84, 103, 1);font-weight:400;border:1pxsolidrgba(169, 169, 169, 1);line-height:1.5;background-color:#fff;background-clip:padding-box;border-radius:2px;margin-bottom:0.5rem;-webkit-transition:border-color0.15sease-in-out,-webkit-box-shadow0.15sease-in-out;transition:border-color0.15sease-in-out,-webkit-box-shadow0.15sease-in-out;transition:border-color0.15sease-in-out,box-shadow0.15sease-in-out;transition:border-color0.15sease-in-out,box-shadow0.15sease-in-out,-webkit-box-shadow0.15sease-in-out;}form.builder .form-controlx::placeholder{color:rgba(79, 84, 103, 1);font-size:14px;font-weigth:400;opacity:1;}form.builder .form-controlx:-ms-input-placeholder{color:rgba(79, 84, 103, 1);font-size:14px;font-weigth:400;}form.builder .form-controlx::-ms-input-placeholder{color:rgba(79, 84, 103, 1);font-size:14px;font-weigth:400;}form.builder button{padding:10px 20px;font-size:14px;color:rgba(255,255,255,1);font-weight:400;background-color:rgba(1,151,32,1);border-width:1px;border-style:solid;border-color:rgba(1,151,32,1);box-shadow:none;-webkit-box-shadow:none;}form.builder button:hover{padding:10px 20px;font-size:14px;color:rgba(255,255,255,1);font-weight:400;background-color:rgba(1,151,32,1);border-width:1px;border-style:solid;border-color:rgba(1,151,32,1);box-shadow:none;-webkit-box-shadow:none;}';var textCss = urlCssMain+''+urlStyles;var s=d.createElement("style");s.type="text/css";s.rel="stylesheet";s.id="maincss";s.innerHTML=textCss;load.parentNode.insertBefore(s,load);var divCode=d.createElement("div");divCode.id="formApp";load.after(divCode);var form=d.createElement("form");var builderID='builder-317';form.id=builderID;form.classList.add('builder');form.style.display="none";var formApp =qSeclector("#formApp");formApp.append(form);var formMain =qSeclector("#"+builderID);var eUrlDAta= '[{"label_width":"c1-2","label_display":1,"label_id":"name","label_class":"","label_style":"","label_name":"Name:","label_for":"name","campo_name":"name","campo_id":"name","campo_type":"text","campo_class":"","campo_required":1,"campo_height":"auto","campo_placeholder":"Douglas","campo_value":"","campo_style":"","campo_error":""},{"label_width":"c1-2","label_display":1,"label_id":"lastname","label_class":"","label_style":"","label_name":"Last Name:","label_for":"","campo_name":"lastname","campo_id":"lastname","campo_type":"text","options":[],"campo_class":"","campo_required":"1","campo_height":"auto","campo_placeholder":"Duff","campo_value":"","campo_style":"","campo_error":""},{"label_width":"c1-2","label_display":1,"label_id":"telephone","label_class":"","label_style":"","label_name":"Phone:","label_for":"","campo_name":"telephone","campo_id":"telephone","campo_type":"text","options":[],"campo_class":"","campo_required":"1","campo_height":"auto","campo_placeholder":"744-123-4567","campo_value":"","campo_style":"","campo_error":""},{"label_width":"c1-2","label_display":1,"label_id":"email","label_class":"","label_style":"","label_name":"Email:","label_for":"email","campo_name":"email","campo_id":"email","campo_placeholder":"your_email@domain.com","campo_type":"text","campo_class":"","campo_required":1,"campo_height":"auto","campo_value":"","campo_style":"","campo_error":""},{"label_width":"c1-1","label_display":1,"label_id":"address-google","label_class":"address-google","label_style":"","label_name":"Address:","label_for":"","campo_name":"address-google","campo_id":"address-google","campo_error":"","campo_type":"textarea","options":[],"campo_class":"","campo_required":1,"campo_height":"auto","campo_placeholder":"Type your address here","campo_value":"","campo_style":"","showMap":"0"},{"label_width":"c1-1","label_display":1,"label_id":"comments","label_class":"","label_style":"","label_name":"Comments:","label_for":"comments","campo_name":"comments","campo_id":"comments","campo_placeholder":"Type Message","campo_type":"textarea","campo_class":"","campo_required":1,"campo_height":"auto","campo_value":"","campo_style":"","campo_error":""},{"label_width":"c1-1","label_display":0,"label_id":"","label_class":"","label_style":"","label_name":"","label_for":"","campo_name":"send","campo_id":"send","campo_placeholder":"","campo_type":"submit","campo_class":"","campo_required":0,"campo_height":"auto","campo_value":"Send Message","campo_style":"","campo_error":""}]';localStorage.setItem('error_text', 'Error, there was a problem, please try again later. copy');localStorage.removeItem("apiMap"); var html="";html+='",html+='";var a=JSON.parse(eUrlDAta),count=0;for(var t in a){if(html+='
',html+=a[t].label_name,html+="","text"==a[t].campo_type&&(count++,html+='",html+=a[t].campo_value,html+="","address-google"==a[t].campo_id&&(html+=' ',html+='
{await loadMap(),setTimeout(()=>{initMapPace("address-google",1)},3e3)})))),"select"==a[t].campo_type){count++,html+='"}if("radio"==a[t].campo_type){count++;var l=a[t].options;for(var e in l)html+='"}if("checkbox"==a[t].campo_type){count++;var l=a[t].options;for(var e in l)html+='"}"submit"==a[t].campo_type&&(html+='"),html+="
"}html+=''; formMain.innerHTML=html; formMain.style.display="block";load.style.display="none";window.addEventListener("click", function() {var t = window.document.getElementById("closext");t.addEventListener("click", function() {document.getElementById("alertTrue").style.display = "none";});var k = window.document.getElementById("closexf");k.addEventListener("click", function() {document.getElementById("alertFalse").style.display = "none";}); }); window.codPass=true; document.querySelector('#'+builderID+' [type="submit"]').addEventListener('click', function(e){e.preventDefault();var elems = document.querySelectorAll('#'+builderID+' [required]');var rInvalid = 0;elems.forEach((i) =>{if(i.classList.contains('rInvalid')){i.classList.remove('rInvalid');}if (!i.checkValidity()) {i.classList.add('rInvalid');rInvalid++;} else if(i.name == "email"){var emailRegex = /^[-\w.%+]{1,64}@(?:[A-Z0-9-]{1,63}\.){1,125}[A-Z]{2,63}$/i; if(!emailRegex.test(i.value)){i.classList.add('rInvalid');rInvalid++;document.getElementById("alertFalse").style.display = "block";document.getElementById("error_text").innerHTML = 'Wrong email format!';}}});if(rInvalid == 0){console.log('enviar form');var elem = document.getElementById("controlAntiSpam");if(elem.value) {console.log('es un robot');return false;} else {console.log('no es robot'); if(window.codPass){ load.style.display="flex",document.getElementById("alertTrue").style.display="none",document.getElementById("alertFalse").style.display="none";var f=new FormData(this.parentElement.parentElement),l=this.parentElement.parentElement,data=[];var customer_name="";var a = JSON.parse('[{"label_width":"c1-2","label_display":1,"label_id":"name","label_class":"","label_style":"","label_name":"Name:","label_for":"name","campo_name":"name","campo_id":"name","campo_type":"text","campo_class":"","campo_required":1,"campo_height":"auto","campo_placeholder":"Douglas","campo_value":"","campo_style":"","campo_error":""},{"label_width":"c1-2","label_display":1,"label_id":"lastname","label_class":"","label_style":"","label_name":"Last Name:","label_for":"","campo_name":"lastname","campo_id":"lastname","campo_type":"text","options":[],"campo_class":"","campo_required":"1","campo_height":"auto","campo_placeholder":"Duff","campo_value":"","campo_style":"","campo_error":""},{"label_width":"c1-2","label_display":1,"label_id":"telephone","label_class":"","label_style":"","label_name":"Phone:","label_for":"","campo_name":"telephone","campo_id":"telephone","campo_type":"text","options":[],"campo_class":"","campo_required":"1","campo_height":"auto","campo_placeholder":"744-123-4567","campo_value":"","campo_style":"","campo_error":""},{"label_width":"c1-2","label_display":1,"label_id":"email","label_class":"","label_style":"","label_name":"Email:","label_for":"email","campo_name":"email","campo_id":"email","campo_placeholder":"your_email@domain.com","campo_type":"text","campo_class":"","campo_required":1,"campo_height":"auto","campo_value":"","campo_style":"","campo_error":""},{"label_width":"c1-1","label_display":1,"label_id":"address-google","label_class":"address-google","label_style":"","label_name":"Address:","label_for":"","campo_name":"address-google","campo_id":"address-google","campo_error":"","campo_type":"textarea","options":[],"campo_class":"","campo_required":1,"campo_height":"auto","campo_placeholder":"Type your address here","campo_value":"","campo_style":"","showMap":"0"},{"label_width":"c1-1","label_display":1,"label_id":"comments","label_class":"","label_style":"","label_name":"Comments:","label_for":"comments","campo_name":"comments","campo_id":"comments","campo_placeholder":"Type Message","campo_type":"textarea","campo_class":"","campo_required":1,"campo_height":"auto","campo_value":"","campo_style":"","campo_error":""},{"label_width":"c1-1","label_display":0,"label_id":"","label_class":"","label_style":"","label_name":"","label_for":"","campo_name":"send","campo_id":"send","campo_placeholder":"","campo_type":"submit","campo_class":"","campo_required":0,"campo_height":"auto","campo_value":"Send Message","campo_style":"","campo_error":""}]');for(var e in a){var lan=0;for(var t in l){if(l.hasOwnProperty(t)&&("text"==a[e].campo_type&&"text"==l[t].type&&"name"==a[e].campo_name&&"name"==l[t].name&&lan==t&&(customer_name+=" "+l[t].value),"text"==a[e].campo_type&&"text"==l[t].type&&"name"==a[e].campo_name&&"full-name"==l[t].name&&lan==t&&(customer_name+=" "+l[t].value),"text"==a[e].campo_type&&"text"==l[t].type&&"name"==a[e].campo_name&&"first-name"==l[t].name&&lan==t&&(customer_name+=" "+l[t].value),"text"==a[e].campo_type&&"text"==l[t].type&&"name"==a[e].campo_name&&"last-name"==l[t].name&&lan==t&&(customer_name+=" "+l[t].value),a[e].campo_name==l[t].name)){var c="";data.push({type:a[e].campo_type,campo:a[e].label_name,name:a[e].campo_name,value:l[t].value,action:c})}lan++}}c="";var dat=[],chk=[],rdo=[];var this_maste=this.parentElement.parentElement;this_maste.querySelectorAll("input[type=radio]").length>0&&this_maste.querySelectorAll("input[type=radio]").each(function(){radio_this=this.parentElement.parentElement,1==radio_this.context.checked&&rdo.push({status:radio_this.context.checked,type:"radio",value:radio_this.context.id,name:radio_this.context.name})});var this_master=this.parentElement.parentElement;this_maste.querySelectorAll("input[type=checkbox]").length>0&&this_master.querySelectorAll('input[type="checkbox"]').each(function(){var e=this.parentElement.parentElement;1==e.context.checked&&chk.push({status:e.context.checked,type:"checkbox",value:e.context.id,name:e.context.name})});for(var e in data){if("checkbox"!==data[e].type&&"radio"!==data[e].type&&dat.push({type:data[e].type,campo:data[e].campo,value:data[e].value,action:c}),"radio"==data[e].type)for(var a in rdo)data[e].value==rdo[a].value&&1==rdo[a].status&&data[e].name==rdo[a].name&&(c=!0,dat.push({type:data[e].type,campo:data[e].campo,value:data[e].value,action:c}));if("checkbox"==data[e].type)for(var a in chk)data[e].value==chk[a].value&&1==chk[a].status&&(c=!0,dat.push({type:data[e].type,campo:data[e].campo,value:data[e].value,action:c}))};var email=[]; var fz = [];var fzr = [];for(var k in dat){if(dat[k].type == 'checkbox'){fz.push(dat[k])}if(dat[k].type == 'radio'){fzr.push(dat[k])}}const mapc = Array.from(new Set(fz.map(x => x.campo)));const mapr = Array.from(new Set(fzr.map(x => x.campo)));if(document.getElementById("address-google")){ if(document.getElementById("address_short")){ dat.push({type: 'text',campo: 'address_google',value: document.getElementById("address_short").value}); } if(document.getElementById("city_short")){ dat.push({type: 'text',campo: 'city_google',value: document.getElementById("city_short").value}); } if(document.getElementById("state_short")){ dat.push({type: 'text',campo: 'state_google',value: document.getElementById("state_short").value}); } if(document.getElementById("zip_short")){ dat.push({type: 'text',campo: 'zip_google',value: document.getElementById("zip_short").value}); } }var url = 'https://marketeaaccounts.com/api/forms/send/1721106027069';var send = {form_id: '317',type: 1, message: dat,campoc:mapc,campor:mapr,customer_name: customer_name,send_email_notification: '1',user_ip: '18.225.156.45'};fetch(url, {method: 'POST',body: JSON.stringify(send),headers:{'Content-Type': 'application/json'}}).then(res => res.json()).catch(error => {document.getElementById("alertFalse").style.display = "block";console.error('Error:', error);formMain.style.display="block";load.style.display="none";}).then(response => {console.log('Success:', response);var active_uri = 0;var open_top = 0;if(response.status == true ){if(active_uri== 0){document.getElementById("alertTrue").style.display = "block";setTimeout(function(){ document.getElementById("alertTrue").style.display = "none";}, 5000);qSeclector('#'+builderID).reset();}}else{document.getElementById("alertFalse").style.display = "block"; if(response.errorCampos){ console.log(response.msj);document.getElementById("error_text").innerHTML = response.msj;}}if(response.status == true && active_uri == 1){setTimeout(function(){if(open_top == 0){window.location.href=window.location.origin+'/';}else{window.location.href='';}}, 200);}formMain.style.display="block";load.style.display="none";});}}} else {console.log('rInvalid', rInvalid)}});