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(4, 1fr); gap: 0px; width: 100%; } .gwp-opt { box-sizing: border-box; text-align: center; border:2px solid transparent; padding:1px; margin:0px; border-radius:3px; 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:3px; } .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 = {1458: "1", 1459: "1", 1460: "1", 1461: "1", 1462: "1", 1463: "1", 1464: "1", 1465: "1", 1466: "1", 1467: "1", 1470: "1", 1452: "1", 1453: "1", 1451: "1", 1606: "2", 1607: "1", 1608: "1", 1609: "1", 1610: "1", 1613: "1", 1611: "1", 1614: "2", 1612: "1", 1615: "1", 1616: "1", 1617: "1", 1618: "1", 1619: "1", 1620: "1", 1621: "1", 1622: "1", 1623: "1", 1624: "1", 1625: "1", 1687: "2", 1688: "2", 1689: "1", 1690: "1", 1691: "1", 1692: "1", 1693: "1", 1656: "1", 1657: "1", 1658: "1", 1659: "1", 1660: "1", 1661: "1", 1662: "1", 1663: "1", 1664: "1", 1665: "1", 1682: "1", 1683: "1", 1673: "1", 1679: "1", 1678: "1", 1677: "1", 1676: "1", 1675: "1", 1674: "1", 1666: "1", 1667: "1", 1668: "1", 1669: "1", 1670: "1", 1671: "1", 1672: "1", 1701: "1", 1702: "1", 1703: "1", 1539: "1", 1540: "1", 1541: "1", 1542: "1", 1546: "1", 1547: "1", 1548: "1", 1550: "1", 1551: "1", 1552: "1", 1545: "", 1716: "1", 1717: "1", 1718: "1", 1719: "1", 1720: "1", 1721: "1", 1722: "1", 1723: "1", 1724: "1", 1725: "1", 1726: "1", 1727: "1", 1728: "1", 1729: "1", 1730: "1", 1731: "1", 1732: "1", 1733: "2", 1734: "1", 1735: "1", 1736: "1", 1737: "1", 1738: "1", 1742: "1", 1746: "1", 1750: "1", 1747: "1", 1748: "1", 1751: "1", 1752: "1", 1753: "1", 1754: "1", 1773: "", 1771: "3", 1774: "1", 1777: "1", 1778: "1", 1775: "", 1776: "2", 1783: "1", 1784: "1", 1785: "1", 1823: "1", 1824: "1", 1825: "1", 1821: "1", 1822: "1", 1788: "1", 1789: "1", 1795: "1", 1796: "1", 1781: "1", 1782: "1", 1797: "1", 1798: "1", 1799: "1", 1791: "1", 1792: "1", 1790: "1", 1845: "1", 1846: "1", 1847: "1", 1848: "1", 1833: "1", 1834: "1", 1835: "1", 1836: "1", 1837: "1", 2083: "1", 2084: "2", 2082: "1", 2047: "1", 2048: "1", 2049: "1", 2050: "1", 2021: "3", 2022: "2", 2023: "3", 2024: "3", 2026: "2", 2042: "2", 2041: "2", 2029: "1", 2037: "2", 2038: "3", 2039: "2", 2040: "2", 2036: "2", 2035: "1", 2027: "3", 2028: "1", 2025: "3", 2085: "1", 2086: "1", 2087: "1", 2088: "1", 2089: "1", 2094: "1", 2090: "1", 2091: "1", 2092: "1", 2093: "1", 2095: "1", 802: "1", 801: "1", 800: "2", 799: "13", 803: "1", 814: "1", 821: "1", 822: "1", 820: "1", 818: "1", 819: "1", 816: "1", 817: "1", 815: "1", 2153: "3", 2154: "3", 2152: "3", 2150: "2", 2151: "2", 2149: "1", 2164: "1", 2165: "1", 2166: "1", 2167: "1", 2168: "2", 2186: "1", 2187: "2", 2188: "1", 2189: "1", 2190: "1", 2191: "1", 2185: "3", 2184: "2", 2030: "1", 2031: "1", 2032: "1", 2033: "1", 2183: "1", 2034: "1", 2201: "1", 2200: "2", 2199: "1", 2195: "1", 2194: "1", 2196: "1", 2197: "1", 2198: "1", 2240: "1", 2241: "1", 2276: "1", 2277: "1", 2278: "1", 2279: "1", 2333: "1", 2335: "1", 2336: "1", 2334: "1", 2330: "1", 2331: "1", 2332: "1", 2337: "1", 2338: "1", 2339: "1", 2340: "1", 2341: "1", 1868: "2", 1867: "2", 1871: "2", 1870: "2", 1869: "2", 1866: "1", 1857: "1", 1858: "1", 1859: "1", 1860: "1", 1861: "1", 1862: "1", 1863: "1", 1864: "3", 1865: "1", 2346: "1", 2347: "1", 2348: "1", 2344: "1", 2345: "1", 1875: "1", 1874: "1", 1872: "1", 1873: "1", 2364: "1", 2365: "1", 2363: "1", 2362: "1", 2361: "1", 2360: "1", 2368: "1", 2367: "1", 2366: "1", 2357: "1", 2358: "1", 2359: "1", 2373: "1", 2174: "1", 2175: "2", 2388: "1", 2389: "2", 2173: "1", 2043: "", 2044: "", 2045: "", 2046: "", 2176: "2", 2177: "2", 2178: "2", 2179: "2", 2180: "1", 2169: "1", 2170: "1", 2387: "1", 2171: "1", 2172: "1", 2202: "1", 2192: "1", 2193: "1", 2204: "1", 2203: "1", };var opt_list = [211,208,235,236,237,238,239,240,241,242,244,248,250,251,254,224,255,256,257,258,259,268,274,276,347,338,341,348,115,116,357,360,361,367,368,369,362,364,373,374,376,377,378,379,381,303,302,384,383,387,365,363,370,371]; var more_txt = [], less_txt = [], optTmp = [], optTmpVal = [], isStock = 0; var changeStock = 0; var sid = '362'; var gwpurl = 'https://gwp.brweb.pl/i/index.php?path=/i/362/'; var imgLimit = '10'; 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 = '
'+e.title+'
'; 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 showPrevMobile(e) { var id = e.id; var aId = id.split('__'); var aSO = aId[0].split('_'); var soptid = aSO[1]; var prev_id = 'gwp_div_preview_'+soptid; var prev_div = document.getElementById(prev_id); if (prevMopen != '' && prevMopen != prev_div) document.getElementById(prevMopen).style.display = 'none'; prev_div.style.display = 'block'; prev_div.innerHTML = ''+e.title+'
'; console.log(prev_div.innerHTML); prev_div.style.position = 'absolute'; prev_div.style.left = '0px'; prev_div.style.bottom = '20px'; prev_div.style.margin = '0px 10px'; prev_div.style.width = 'calc(100% - 20px)'; prevMopen = prev_id; } function hidePrevMobile(e) { var id = e.id; var aId = id.split('__'); var aSO = aId[0].split('_'); var soptid = aSO[1]; var prev_id = 'gwp_div_preview_'+soptid; var prev_div = document.getElementById(prev_id); prev_div.style.display = 'none'; prev_div.innerHTML = ''; } function hideDiv() { document.getElementById(prevMopen).style.display = 'none'; } 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; if (window.innerWidth < 700) showPrevMobile(e); } } 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; if (window.innerWidth < 700) showPrevMobile(e); 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 += '