var getutm = () => { var search = new URLSearchParams(window.location.search); return `${search.get('utm_source')??''}/${search.get('utm_medium')??''}/${search.get('utm_campaign')??''}/${search.get('utm_content')??''}/${search.get('utm_term')??''}`; } function getScriptTag(apikey) { const tags = document.querySelectorAll("script[src*=invoke]"); return Array.from(tags).find(p => p.src.includes(apikey)); } function draw(serverUrl, apikey, container, w) { const iframe = document.createElement('iframe'); iframe.id = `cnet-frame-${apikey}`; iframe.src = `${serverUrl}cotizador?codigo=${apikey}&utm=${getutm()}`; iframe.frameborder = 0; iframe.height = 547; if (w >= 769 && w <= 1279) iframe.height = 310; if (w >= 1280 && w <= 1919) iframe.height = 249; if (w >= 1920) iframe.height = 188; iframe.width = w ?? '100%'; iframe.scrolling = 'no'; iframe.title = 'Cotizador'; iframe.style.margin = 0; iframe.style.border = 0; iframe.style['max-width'] = w ?? '100%'; container.appendChild(iframe); } document.addEventListener('DOMContentLoaded', function() { let serverUrl = 'https://www.sistemacnet.com'; if (!serverUrl.endsWith('/')) serverUrl += '/'; const apikey = '1662341768-1826613045-4088576527-3934497524'; const tag = getScriptTag(apikey); const query = new URLSearchParams(tag.src.split('?')[1]); draw(serverUrl, apikey, tag.parentNode, query.get('w')); });