(function(){ var html = ''; function GetProducts(top) { var productArray = [{"pid":91166314,"name":"Goodride ALL SEASON ELITE Z-401 205/55R16 94V ","price":177.9900,"sprice":"177,99","url":"https://www.ceneo.pl/91166314;basket#pid=22390&crid=355534&cid=38383","imgurl":"//image.ceneostatic.pl/data/products/91166314/f-goodride-all-season-elite-z-401-205-55r16-94v.jpg","newpage":false,"format":"750x200","rating":4.81,"drawchance":1,"urltype":0,"position":1},{"pid":90502967,"name":"Gm 1942003 Olej Opel Gm Dexos2 5W30 5L","price":140.1700,"sprice":"140,17","url":"https://www.ceneo.pl/90502967;basket#pid=22390&crid=355534&cid=38383","imgurl":"//image.ceneostatic.pl/data/products/90502967/f-gm-1942003-olej-opel-gm-dexos2-5w30-5l.jpg","newpage":false,"format":"750x200","rating":4.8,"drawchance":1,"urltype":0,"position":2},{"pid":31054123,"name":"Thule EuroRide 940","price":1239.0000,"sprice":"1239,00","url":"https://www.ceneo.pl/31054123;basket#pid=22390&crid=355534&cid=38383","imgurl":"//image.ceneostatic.pl/data/products/31054123/f-thule-euroride-940.jpg","newpage":false,"format":"750x200","rating":4.85,"drawchance":1,"urltype":0,"position":3},{"pid":1838168,"name":"Thule Proride 591","price":599.0000,"sprice":"599,00","url":"https://www.ceneo.pl/1838168;basket#pid=22390&crid=355534&cid=38383","imgurl":"//image.ceneostatic.pl/data/products/1838168/f-thule-proride-591.jpg","newpage":false,"format":"750x200","rating":4.65,"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('ceneoaffcontainer355534').innerHTML = html; if (false === true) { var hrefs = document.getElementById('ceneoaffcontainer355534').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,'&'); } } })();