window.websenseInit = function(parentElement) { if (parentElement) { var toPushFunction = function() { var width = parentElement.offsetWidth; var height = parentElement.offsetHeight; width = width || document.documentElement.clientWidth; height = height || document.documentElement.clientHeight; var url = encodeURI(window.location.protocol + '//dynacrems.wp.pl/staticad/'); if (typeof WP !== 'undefined' && typeof WP.crux !== 'undefined') { url = WP.crux.mess(url); } var xhr = new XMLHttpRequest(); xhr.open('POST', url, true); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.onload = function() { if (xhr.status === 200) { data = JSON.parse(xhr.responseText) var div = document.createElement('div'); div.innerHTML = data.Style; parentElement.appendChild(div.childNodes[0]); div.innerHTML = data.Ad; parentElement.appendChild(div.childNodes[0]); } else if (xhr.status !== 200) { } } xhr.send(JSON.stringify({ userSTAC: '', width: width, height: height, campaignId: 18776, dmn: window.location.hostname, redir: '', debug: '', wpjslib: '1' , })); } if (typeof WP !== 'undefined' && typeof WP.push !== 'undefined') { WP.push(toPushFunction) } else { toPushFunction() } } else { console.error('missing dynacrems container'); } }(document.getElementById('dynacrems-adv-18776'))