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:3px solid transparent; border-bottom: 0px; padding:1px 1px 5px 1px; margin:0px; border-radius:7px; overflow-x:hidden; position: relative; } .gwp-opt:hover { border:0px solid #EEEEEE; padding:1px; } .gwp-opt-sel { border:4px solid #4c322b !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; } .gwp-opt-prev div { position:absolute; left:-225px; width:220px; 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; }'; document.head.appendChild(gwpstyle); } gwpNo = {618: "5", 619: "5", 620: "5", 621: "5", 622: "5", 623: "5", 1494: "2", 1495: "1", 1496: "1", 1497: "1", 1498: "1", 1499: "1", 1500: "1", 1501: "1", 1502: "1", 1504: "1", 1505: "1", 1508: "1", 1507: "1", 1503: "1", 1506: "1", 1509: "1", 1510: "1", 1511: "1", 1512: "1", 2548: "1", 2549: "1", 2550: "1", 2551: "1", 2552: "2", 2553: "1", 2554: "1", 2555: "1", 2556: "1", 2557: "1", 2558: "1", 2559: "1", 2560: "1", 2561: "1", 2562: "1", 2564: "1", 2565: "1", 2566: "1", 2567: "1", 2563: "1", 1546: "1", 1547: "1", 1796: "1", 2568: "1", 2569: "1", 2570: "1", 1516: "1", 1941: "1", 1517: "1", 1518: "1", 1519: "1", 1659: "1", 1660: "1", 1661: "1", 1662: "1", 1663: "1", 1664: "1", 1665: "2", 1675: "1", 1676: "1", 1677: "1", 1678: "1", 1679: "1", 1680: "1", 1681: "1", 1682: "1", 1683: "1", 1684: "1", 2571: "1", 2572: "1", 1564: "1", 1565: "1", 1566: "1", 1567: "1", 1568: "1", 1569: "1", 685: "1", 686: "1", 687: "1", 688: "1", 689: "1", 690: "1", 2295: "1", 2296: "1", 2297: "1", 2298: "1", 2299: "1", 2300: "1", 2016: "1", 2017: "1", 2018: "1", 2019: "1", 2020: "1", 2021: "1", 2022: "1", 2023: "1", 2024: "2", 2025: "1", 1196: "1", 1197: "1", 1198: "1", 1199: "1", 1200: "1", 1201: "1", 1202: "1", 1203: "1", 1204: "1", 1205: "1", 1206: "1", 1207: "1", 1465: "", 1275: "1", 1276: "1", 1277: "1", 1278: "1", 1279: "1", 1280: "1", 1281: "1", 1282: "1", 1283: "1", 1284: "1", 1285: "1", 1286: "1", 1062: "1", 1063: "1", 1064: "1", 1065: "1", 1066: "1", 1067: "1", 1077: "1", 1078: "1", 1079: "1", 1080: "1", 1081: "1", 1082: "1", 1715: "1", 1716: "1", 1717: "1", 1718: "1", 1226: "1", 1227: "1", 1228: "1", 1229: "1", 1230: "1", 1231: "1", 1232: "1", 1233: "1", 1234: "1", 1235: "1", 1236: "1", 1237: "1", 724: "1", 725: "1", 726: "1", 727: "1", 728: "1", 729: "1", 698: "1", 699: "1", 700: "1", 701: "1", 702: "1", 703: "1", 2033: "1", 2034: "1", 2035: "1", 2036: "1", 2037: "1", 2038: "1", 2039: "1", 2040: "1", 2041: "1", 2042: "1", 2043: "1", 2044: "1", 2359: "1", 2360: "1", 2361: "1", 2362: "1", 2363: "1", 2364: "1", 974: "1", 975: "1", 976: "1", 977: "1", 978: "1", 979: "1", 1013: "1", 1014: "1", 1015: "1", 1016: "1", 1017: "1", 1018: "1", 904: "1", 905: "1", 906: "1", 907: "1", 908: "1", 909: "1", 2217: "1", 2218: "1", 2219: "1", 2220: "1", 2221: "1", 2222: "1", 2106: "1", 2107: "1", 2108: "1", 2109: "1", 2110: "1", 2111: "1", 1431: "1", 1432: "1", 1433: "1", 1434: "1", 1435: "1", 1436: "1", 1302: "1", 1303: "1", 1304: "1", 1305: "1", 1306: "1", 1307: "1", 2574: "1", 2575: "1", };var opt_list = [132,311,312,325,145,474,404,405,257,258,272,273,226,232,354,261,262,155,150,410,488,411,211,219,197,456,420,301,277]; var more_txt = [], less_txt = [], optTmp = [], optTmpVal = [], isStock = 0; var changeStock = 0; var sid = '421'; var url = 'https://gwp.brweb.pl/i/421/'; var imgLimit = '6'; 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','вибрати']; 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); 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 = ''; 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 selectClick(e) { var id = e.id; var aId = id.split('__'); if (document.getElementById(aId[0]).value != aId[1] || document.getElementById(aId[0]).length == 1) { if (window.innerWidth < 700) showPrevMobile(e); document.getElementById(aId[0]).value = aId[1]; if (document.getElementById('gwp_div_title_'+aId[0].replace('option_',''))) document.getElementById('gwp_div_title_'+aId[0].replace('option_','')).innerHTML = e.title; } else { if (window.innerWidth < 700) hidePrevMobile(e); document.getElementById(aId[0]).selectedIndex = '0'; if (document.getElementById('gwp_div_title_'+aId[0].replace('option_',''))) document.getElementById('gwp_div_title_'+aId[0].replace('option_','')).innerHTML = ''; id = aId[0] + '__' + document.getElementById(aId[0]).value; } document.getElementById(aId[0]).dispatchEvent(new Event('change')); 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'; } } optTmpVal[aId[0].replace('option_','')] = document.getElementById(aId[0]).value; } function radioClick(e) { var id = e.id; if (window.innerWidth < 700) showPrevMobile(e); var aId = id.split('__'); document.getElementById(aId[0]+'_'+aId[1]).click(); if (document.getElementById('gwp_div_title_'+aId[0].replace('option_',''))) document.getElementById('gwp_div_title_'+aId[0].replace('option_','')).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 sr = document.getElementsByName('option_'+opt_id); if (sr.length == 0) { return; } var optValue = ''; if (sr[0].id == sr[0].name ) { var optType = 'S'; var s = sr[0]; var c = s.getElementsByTagName('option'); var optValue = s.value; } else { var optType = 'R'; var s = sr[0].parentElement.parentElement; var c = sr; for( var j = 0; j < c.length; j++){ if (c[j].checked == true) { optValue = c[j].innerHTML; } } } isDiff = (!optTmp[opt_id] || optTmp[opt_id] != s.innerHTML || optTmpVal[opt_id] != s.value) ? 1 : 0; var eStock = (optType == 'S') ? s.parentElement.className : sr[0].parentElement.className; if (eStock.indexOf('option_truestock ') != -1 && eStock.indexOf('loading') != -1) { isLoading++; } if (isDiff == 1 || changeStock == 1) { console.log('gwp'); if (optType == 'R') { s.style.visibility = 'hidden'; s.style.width = '0px'; s.style.height = '0px'; s.style.position = 'absolute'; s.style.bottom = '0px'; } else { s.style.display = 'none'; } var sOptions = '', sPreview = '', sTitle = ''; var imgNo = 0; var optCnt = (optType == 'S') ? c.length - 1 : c.length; if (optType == 'R') { for( var j = 0; j < c.length; j++){ if (c[j].parentElement.className == 'radio-wrap none') { optCnt--; } } var rlabels = s.getElementsByTagName('label'); var rDict = new Array(); for( var rli = 0; rli < rlabels.length; rli++){ if (rlabels[1].innerHTML != '' || !rlabels[rli]) rDict[rlabels[rli].getAttribute('for')] = rlabels[rli].innerHTML; } } 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') { imgNo++; var smIsSelect = ((optType == 'S' && (s.options[s.selectedIndex].value == c[j].value || s.value == 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 = (optType == 'S') ? c[j].innerHTML : rDict[c[j].id]; oId = (optType == 'S') ? s.id : c[j].name; if (smItenSelect == ' gwp-opt-sel') { smTitle = oName; } sOptions += '