if (!gwpstyle) { var gwpstyle = document.createElement('style'); gwpstyle.textContent = ' .gwp-div { clear: both; position:relative; } .sm-gwp-img-list { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0px; width: 100%; } .gwp-opt { box-sizing: border-box; text-align: center; border:2px solid transparent; padding:1px; margin:0px; border-radius:7px; overflow-x:hidden; position: relative; } .gwp-opt:hover { border-top:0px solid #EEEEEE; padding:1px; } .gwp-opt:hover .gwp-opt-name { padding-top:2px; } .gwp-opt-sel:hover .gwp-opt-name { padding-top: 0px; } .gwp-opt-sel { border:2px solid #777777 !important; padding:1px; } .gwp-opt-sel:hover { padding:1px; } .gwp-opt-name { text-align: center; width: 100%; } .gwp-opt-title { min-height: 1em; padding: 11px 0px; } .gwp-opt-prev { position:relative; width: 100%; } .gwp-opt-prev div { position:absolute; left:-505px; width:500px; display:none; z-index:1000; border:1px solid #bcbcbc; background-color:#FFFFFF; box-shadow:3px 3px 6px #AAAAAA; } .gwp-opt img { cursor:pointer; border-radius:7px; } .gwp-opt-more { position:relative; cursor:pointer; border-radius:7px; border:1px solid #888888; color:#888888; padding-top:100%; } .gwp-opt-more div { font-size:14px; text-align:center; line-height:12px; position:absolute; top:50%; left:0px; width:100%; margin-top:-0.5em; } .gwp-opt-prev-title { display: block; text-align: center; } .gwp-opt-title { font-weight:bold; padding: 0px 20px; display: inline-block; } .gwp-opt-prev .icon { width:auto; height:auto; speak: none; font-style: normal; font-weight: normal; font-variant: normal; text-transform: none; line-height: 1; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } .gwp-opt-prev .icon-close:before { content: "✕"; font-weight: bold; } '; document.head.appendChild(gwpstyle); } gwpNo = {2822: "1", 2823: "1", 2824: "1", 2825: "1", 2826: "1", 2827: "1", 2828: "1", 2830: "1", 2832: "1", 2831: "2", 2821: "1", 2834: "1", 2833: "1", 2829: "1", 2812: "1", 2813: "1", 2814: "1", 2815: "1", 2816: "1", 2817: "1", 2818: "1", 2819: "1", 2820: "1", 1569: "1", 1570: "1", 1571: "1", 1572: "1", 1573: "1", 1574: "1", 1575: "1", 1576: "1", 1577: "1", 1675: "1", 1676: "1", 1586: "4", 1587: "1", 1588: "1", 2667: "2", 1578: "2", 1579: "1", 1925: "1", 1580: "1", 1581: "1", 1583: "1", 1584: "1", 2666: "1", 1589: "1", 1591: "1", 1592: "1", 1593: "1", 1594: "1", 1595: "1", 1596: "1", 2104: "1", 2105: "1", 2670: "1", 2925: "1", 1598: "1", 1599: "1", 2467: "1", 2468: "1", 1601: "2", 1602: "2", 2927: "1", 2928: "1", 2929: "2", 2930: "1", 2931: "1", 2932: "1", 2933: "1", 2934: "1", 2935: "1", 2936: "1", 2938: "1", 2926: "1", 3148: "1", 2939: "2", 1597: "1", 1600: "1", 2905: "1", 2907: "2", 2908: "2", 2909: "1", 2910: "2", 2911: "1", 2912: "1", 2913: "2", 2914: "2", 2906: "1", 2916: "1", 2917: "1", 3131: "1", 2915: "1", 2918: "1", 2920: "1", 2921: "1", 2922: "1", 2923: "1", 2919: "1", 2873: "1", 2874: "1", 2875: "1", 2876: "1", 2877: "1", 2878: "1", 2879: "1", 2880: "1", 2881: "1", 2882: "1", 2883: "1", 2884: "1", 2885: "1", 2886: "2", 2888: "1", 2889: "1", 2890: "1", 2891: "1", 2892: "1", 2887: "1", 1700: "1", 1701: "1", 1702: "1", 1703: "1", 1704: "1", 1705: "1", 1706: "1", 1707: "1", 1708: "1", 1709: "1", 1710: "1", 1711: "1", 1712: "1", 1713: "1", 1714: "1", 1715: "1", 1717: "1", 1718: "1", 1719: "1", 1720: "1", 1722: "1", 3151: "1", 1721: "1", 1724: "1", 1725: "1", 1727: "1", 1728: "1", 1729: "1", 1730: "1", 3150: "1", 2792: "1", 2793: "2", 1726: "2", 1723: "1", 1833: "1", 1834: "1", 1835: "1", 1836: "1", 1837: "1", 1838: "1", 1839: "1", 1840: "1", 1841: "1", 1842: "2", 1843: "1", 1845: "1", 1924: "1", 1844: "1", 2663: "1", 2665: "1", 2664: "1", 1846: "1", 1847: "1", 1885: "1", 1851: "1", 1852: "1", 1853: "1", 1886: "1", 1887: "1", 1645: "1", 1646: "1", 1647: "1", 1648: "1", 1649: "1", 1650: "1", 1651: "1", 1652: "1", 1653: "1", 1655: "1", 1654: "1", 1656: "1", 1657: "1", 1923: "1", 2660: "1", 2661: "1", 2662: "1", 1660: "1", 1661: "1", 1672: "1", 1669: "1", 1670: "1", 1671: "1", 1673: "1", 1674: "1", 3128: "1", 1667: "1", 1668: "1", 1666: "1", 1665: "2", 1664: "1", 1663: "2", 1662: "1", 1658: "1", 1659: "1", 1405: "1", 1406: "1", 1407: "1", 1408: "1", 1409: "1", 1410: "1", 1411: "1", 1412: "1", 1413: "1", 1414: "1", 1415: "1", 1416: "1", 1419: "1", 1420: "1", 1421: "1", 1422: "1", 1423: "1", 1424: "2", 1425: "1", 1426: "1", 1636: "1", 2454: "1", 3129: "1", 1427: "1", 1428: "1", 1429: "1", 1430: "1", 1431: "1", 1435: "1", 1436: "1", 2568: "1", 1437: "1", 1434: "1", 1897: "1", 1898: "1", 1899: "1", 1900: "1", 1901: "1", 1902: "1", 1903: "1", 1904: "1", 1905: "1", 1906: "1", 1907: "1", 1908: "1", 1909: "1", 1910: "1", 1912: "1", 1913: "1", 1914: "1", 1926: "1", 2668: "1", 2669: "1", 1915: "1", 1916: "1", 1917: "1", 1918: "1", 1919: "1", 2465: "1", 2466: "1", 1921: "1", 1922: "1", 1920: "1", 1862: "1", 1863: "1", 1864: "1", 1865: "1", 1866: "1", 1867: "1", 1868: "1", 1869: "1", 1870: "1", 1871: "1", 1872: "1", 1873: "1", 1874: "1", 1876: "1", 2455: "1", 3130: "1", 1877: "1", 1878: "1", 1880: "1", 1881: "1", 1879: "1", 1883: "1", 1884: "1", 1882: "1", };var opt_list = [433,432,426,425,270,271,274,272,273,275,435,429,430,292,293,294,295,296,313,314,315,324,317,281,282,283,284,285,286,234,235,238,239,241,326,327,328,329,330,319,320,321,322,323]; var more_txt = [], less_txt = [], optTmp = [], optTmpVal = [], isStock = 0; var changeStock = 0; var sid = '448'; var gwpurl = 'https://gwp.brweb.pl/i/index.php?path=/i/448/'; var imgLimit = '12'; var moreLabel = '+'; var lessLabel = '-'; var showMLcnt = 1; var prevMopen = ''; var selectLangVal = ['','wybierz','choose','wählen','Vybrat','vali','izvēlēties','pasirinkti','választ','vyberte si','вибрати','-1']; function showPrev(e) { if (window.innerWidth < 700) return null; var id = e.id; var aId = id.split('__'); var aSO = aId[0].split('_'); var soptid = aSO[1]; var pid = soptid; var prev_div = document.getElementById('gwp_div_preview_'+pid); prev_div.style.display = 'block'; prev_div.innerHTML = ''; setTimeout(movePrev,10,pid); } function hidePrev(e) { if (window.innerWidth < 700) return null; var id = e.id; var aId = id.split('__'); var aSO = aId[0].split('_'); var soptid = aSO[1]; var pid = soptid; var prev_div = document.getElementById('gwp_div_preview_'+pid); prev_div.style.display = 'none'; prev_div.innerHTML = ''; prev_div.style.top = '0px'; } function movePrev(pid) { var prev_div = document.getElementById('gwp_div_preview_'+pid); if (prev_div) { var imgH = prev_div.getElementsByTagName('IMG')[0]; if (!imgH) { setTimeout(movePrev,10,pid); return false; } const recti = imgH.getBoundingClientRect(); if (recti.height == 0) { setTimeout(movePrev,10,pid); return false; } var hcorr = (recti.top + recti.height - window.innerHeight + 20) * -1; hcorr = (hcorr < 0 ? hcorr : 0); if (recti.top < 20) { hcorr = (recti.top + hcorr - 20) * -1; } if (recti.top > 20 && recti.height + 40 > window.innerHeight) { hcorr = (recti.top - 20) * -1; } prev_div.style.top = hcorr + 'px'; } } function oClick(e,type) { if (type == 'S') { selectClick(e); } else { radioClick(e); } setTimeout(showGWP,500); } function setValToInput(optInput,optValue) { if (optInput) { optInput.value = optValue; } else { setTimeout(function() { setValToInput(optInput,optValue); }, 500); } } function selectClick(e) { var id = e.id; var aId = id.split('__'); var optId = aId[0].replace('option_',''); var srl = document.getElementsByName(aId[0]); var sr = null; var optInput = null; var optValue = null; for( var k = 0; k < srl.length; k++){ if (srl[k].tagName == 'H-DROPDOWN-CONTENT') { sr = srl[k]; } if (srl[k].tagName == 'INPUT') { optInput = srl[k]; } } if (sr == null) { srl[1].click(); setTimeout(function() { selectClick(e); }, 500); return false; } sr = document.getElementsByTagName('H-OPTION'); for( var k = 0; k < sr.length; k++){ if (sr[k].value == aId[1]) { sr[k].click(); optValue = aId[1]; /* if (e.parentNode.classList.contains('gwp-opt-sel')) { optValue = ''; } */ setValToInput(optInput,optValue); var aSO = aId[0].split('_'); var soptid = aSO[1]; if (document.getElementById('gwp_div_title_'+soptid)) document.getElementById('gwp_div_title_'+soptid).innerHTML = e.title; } } var c = document.getElementsByClassName('c_' + aId[0]); for( var i = 0; i < c.length; i++){ c[i].parentElement.className = c[i].parentElement.className.replace(' gwp-opt-sel'); if ( c[i].id == id ) { c[i].parentElement.className = c[i].parentElement.className + ' gwp-opt-sel'; } } } function radioClick(e) { var id = e.id; var aId = id.split('__'); document.getElementById(aId[0].replaceAll('_','-')+'-'+aId[1]).click(); var aSO = aId[0].split('_'); var soptid = aSO[1]; if (document.getElementById('gwp_div_title_'+soptid)) document.getElementById('gwp_div_title_'+soptid).innerHTML = e.title; var c = document.getElementsByClassName('c_' + aId[0]); for( var i = 0; i < c.length; i++){ c[i].parentElement.className = c[i].parentElement.className.replace(' gwp-opt-sel',''); if ( c[i].id == id ) c[i].parentElement.className = c[i].parentElement.className + ' gwp-opt-sel'; } } function gwpMore(oid) { var h = document.getElementsByClassName('gwpHidden'+oid); var type = more_txt[oid] == document.getElementById('gwp_more'+oid).innerHTML ? 'block' : 'none'; for( var i = 0; i < h.length; i++){ h[i].style.display = (h[i].className == 'gwp-opt gwpHidden'+oid+' gwp-opt-sel') ? 'block' : type; } document.getElementById('gwp_more'+oid).innerHTML = type == 'block' ? less_txt[oid] : more_txt[oid] ; } function showGWP() { var isLoading = 0; var isDiff = 0; opt_list.forEach(function(opt_id) { var pv = document.getElementsByTagName('product-variants')[0]; var radiov = ''; var srl = document.getElementsByName('option_'+opt_id); if (pv && srl.length == 0) { radiov = '_'+pv.getAttribute("product-instance-key"); srl = document.getElementsByName('option_'+opt_id+radiov); } if (srl.length == 0) { return; } var optValue = ''; var sr = null; if (srl[0].tagName == 'H-DROPDOWN') { srl[0].style.display = 'none'; var smain = srl[0].parentElement.parentElement.parentElement.parentElement; for( var k = 0; k < srl.length; k++){ if (srl[k].tagName == 'H-DROPDOWN-CONTENT') { sr = srl[k]; } if (srl[k].tagName == 'INPUT') { optValue = srl[k].value; } } if (sr == null) { srl[1].click(); setTimeout(function() { var srl = document.getElementsByName('option_'+opt_id); for( var k = 0; k < srl.length; k++){ if (srl[k].tagName == 'H-DROPDOWN-CONTENT') { sr = srl[k]; } if (srl[k].tagName == 'INPUT') { optValue = srl[k].value; } } }, 500); } var optType = 'S'; var s = sr; var c = sr.getElementsByTagName('h-option'); } else { var optType = 'R'; var s = srl[0].parentElement.parentElement.parentElement.parentElement; var smain = srl[0].parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement; if (sid == 497 || sid == 562 || sid == 588 || sid == 602) { s = srl[0].parentElement.parentElement.parentElement.parentElement.parentElement; smain = srl[0].parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement; } s.parentElement.style.display = 'none'; var c = srl; for( var j = 0; j < c.length; j++){ if (c[j].checked == true) { optValue = c[j].dataset.userValue; } } } isDiff = (!optTmp[opt_id] || optTmp[opt_id] != s.innerText.replace(/\s+/g, '') || (sid != 367 && optTmpVal[opt_id] != optValue)) ? 1 : 0; if (sid == 562) { isDiff = (!optTmp[opt_id] || optTmp[opt_id] != s.innerHTML.replace(/\s+/g, '') || (optTmpVal[opt_id] != optValue)) ? 1 : 0; } if (smain.getAttribute("stock-order") > 0 && smain.className.indexOf('loading') != -1) { isLoading++; } if (isDiff == 1 || changeStock == 1) { var sOptions = '', sPreview = '', sTitle = ''; var imgNo = 0; var optCnt = (optType == 'S') ? c.length : c.length; if (optType == 'R') { for( var j = 0; j < c.length; j++){ if (c[j].parentElement.getAttribute("hidden") != null) { optCnt--; } } } more_txt[opt_id] = moreLabel + (showMLcnt == 1 ? (optCnt - imgLimit + 1) : ''); less_txt[opt_id] = lessLabel + (showMLcnt == 1 ? (optCnt - imgLimit + 1) : ''); var smTitle = ''; for( var j = 0; j< c.length; j++){ if (!selectLangVal.includes(c[j].value) && c[j].parentElement.className != 'radio-wrap none' && !c[j].hidden) { imgNo++; var smIsSelect = ((optType == 'S' && (optValue == c[j].value)) || (optType == 'R' && c[j].checked == true)) ? 1 : 0; smItenSelect = smIsSelect == 1 ? ' gwp-opt-sel' : ''; smItenDisplay = (imgNo < imgLimit || (imgNo == imgLimit && imgNo == optCnt)) ? 'block' : 'none'; var lastOpt = (imgNo == imgLimit - 1) ? '!important' : ''; var lastOptClass = (imgNo == imgLimit - 1) ? ' toHidden ' : ''; var lastOptId = (imgNo == imgLimit - 1) ? ' id="gwp_loi_'+oId+'" ' : ''; if (smIsSelect == 1) { smItenDisplay = 'block'; if (imgNo > imgLimit || (imgNo == imgLimit && imgNo < optCnt)) { sOptions = sOptions.replace('block!important','none'); sOptions = sOptions.replace('toHidden','gwpHidden'+opt_id); } } smItenHidden = (imgNo > imgLimit || (imgNo == imgLimit && imgNo != optCnt)) ? ' gwpHidden'+opt_id+' ' : ''; oName = c[j].dataset.userValue ; var smItemUnavailable = (c[j].hasAttribute('data-option-value-unavailable')) ? ' gwp-opt-unavailable' : ''; if (c[j].dataset.priceModifier && c[j].dataset.priceModifier != '') { oName += ' (' + c[j].dataset.priceModifier + ')'; } oId = (optType == 'S') ? s.name : c[j].name; if (smItenSelect == ' gwp-opt-sel') { smTitle = oName; } sOptions += '