(function(){ var html = ''; function GetProducts(top) { var productArray = [{"pid":64052436,"name":"Substral Mniszek Ultra 070 Ew 500Ml","price":49.1000,"sprice":"49,10","url":"https://www.ceneo.pl/64052436;basket#pid=16578&crid=164080&cid=25957","imgurl":"//image.ceneostatic.pl/data/products/64052436/f-substral-mniszek-ultra-070-ew-500ml.jpg","newpage":true,"format":"750x150","rating":4.59,"drawchance":1,"urltype":0,"position":1},{"pid":94783417,"name":"Atmosphera Sztuczna Roślina W Doniczce Trawa, 30 Cm","price":41.9900,"sprice":"41,99","url":"https://www.ceneo.pl/94783417;basket#pid=16578&crid=164080&cid=25957","imgurl":"//image.ceneostatic.pl/data/products/94783417/f-atmosphera-sztuczna-roslina-w-doniczce-trawa-30-cm.jpg","newpage":true,"format":"750x150","rating":5.0,"drawchance":1,"urltype":0,"position":2},{"pid":92782880,"name":"ProsperPlast Kompostownik CompoGreen 220l (IKST220CS411)","price":99.0000,"sprice":"99,00","url":"https://www.ceneo.pl/92782880;basket#pid=16578&crid=164080&cid=25957","imgurl":"//image.ceneostatic.pl/data/products/92782880/f-prosperplast-kompostownik-compogreen-220l-ikst220cs411.jpg","newpage":true,"format":"750x150","rating":3.32,"drawchance":1,"urltype":0,"position":3},{"pid":135911982,"name":"Kwietnik na kwiaty drewniany stojak drabinka","price":85.4200,"sprice":"85,42","url":"https://www.ceneo.pl/135911982#pid=16578&crid=164080&cid=25957","imgurl":"//image.ceneostatic.pl/data/products/135911982/f-kwietnik-na-kwiaty-drewniany-stojak-drabinka.jpg","newpage":true,"format":"750x150","rating":0.0,"drawchance":1,"urltype":0,"position":4}]; var sum = 4; var result = []; var i = 0, n = 0; for (var n = 0; n < top; n++) { var r = Math.floor(Math.random() * sum); var lsum = 0; for (i = 0; i < productArray.length; i++) { var prod = productArray[i]; lsum += prod.drawchance; if (r < lsum) { sum -= prod.drawchance; result.push(prod); productArray.splice(i, 1); break; } } } return result; } function htmlEncode(value){ var div = document.createElement('div'); var text = document.createTextNode(value); div.appendChild(text); return div.innerHTML; } var products = GetProducts(4); html += '
'; var first = true, i = 0; html += '
'; for (i = 0; i< products.length; i++) { html += '
'; first = false; html += ''; html += '' + products[i].name + ''; html += ''; html += ''; html += products[i].name; html += ''; if(products[i].urltype == 0){ html += ''; html += 'Od ' + products[i].sprice + ' zł'; html += ''; } if(products[i].urltype == 1){ html += ''; html += 'Sprawdź'; } html += '
'; } html += '
'; html += '
'; html += ''; html += '
'; html += '
'; try { var _logo = document.getElementById('ceneoaff-logo'); if (_logo != null) { _logo.parentNode.removeChild(_logo); } } catch(err) {} if($CeneoAP.options.ad_onAfterRender != null) $CeneoAP.options.ad_onAfterRender(); document.getElementById('ceneoaffcontainer164080').innerHTML = html; if (false === true) { var hrefs = document.getElementById('ceneoaffcontainer164080').querySelectorAll(".ceneoaff-items a"); for (i = 0; i < hrefs.length; i++) { var href = hrefs[i]; (function(href) { href.addEventListener('click', function(event) { var pid = href.parentElement.getAttribute('data-pid'); var request = '' + "?productId=" + pid + "&creationId=" + $CeneoAP.options.ad_creation + "&referrerUrl=" + encodeURIComponent(window.location); var img = new Image(); img.src = request; } , false) ; } ) (href); } var percentage = 0; var trackView = false; if (percentage === 100) { trackView = true; } else { var rotatorRandomVal = Math.floor((Math.random()*100) + 1); if (rotatorRandomVal < percentage) { trackView = true; } } if (trackView) { var stamp = parseInt(new Date().getTime()/86400, 10); var img = new Image(); var imgSrc = location.protocol + '' + '&_=' + (new Date).getTime(); img.src = imgSrc.replace(/&/g,'&'); } } })();