gwpNo = {1554: "0", 1555: "0", 1556: "0", 1557: "0", 1558: "0", 1559: "1", 1560: "1", 1561: "0", 1562: "0", 1563: "0", 1564: "0", 1565: "0", 1566: "1", 1631: "0", 1632: "0", 1636: "1", 1467: "0", 1468: "0", 1469: "0", 1470: "0", 1471: "0", 1472: "0", 1473: "0", 1474: "0", 1475: "0", 1476: "0", 1477: "1", 1483: "1", 1484: "1", 1633: "0", 1634: "0", 1635: "1", 1456: "0", 1457: "0", 1458: "0", 1459: "0", 1460: "0", 1461: "0", 1462: "0", 1463: "0", 1464: "0", 1465: "1", 1466: "1", 1481: "1", 1482: "1", 1642: "0", 1643: "0", 1644: "0", 295: "0", 296: "0", 1666: "0", 1667: "0", 1020: "2", 1021: "2", 1494: "1", 1676: "1", 1677: "1", 1316: "2", 1008: "2", 1005: "2", 1023: "2", 1004: "2", 564: "2", 565: "2", 563: "3", 1007: "2", 1009: "0", 1018: "2", 1019: "2", 1152: "2", 1678: "2", 1679: "2", 524: "0", 525: "0", 1682: "0", 1687: "1", 1688: "1", 1689: "1", 1690: "1", 1002: "0", 1003: "0", 1546: "0", 1547: "0", 1548: "0", 1549: "0", 1550: "0", 1551: "0", 1552: "0", 1580: "0", 1581: "0", 1582: "0", 1583: "0", 1584: "0", 1585: "1", 1591: "0", 1592: "0", 1597: "0", 1645: "0", 1646: "0", 1238: "0", 1710: "0", 1711: "0", 1708: "0", 1709: "0", 1712: "0", 1713: "0", 1720: "0", 1721: "0", 1722: "0", 1723: "0", 1725: "0", 1726: "0", 1738: "0", 1739: "0", 1758: "0", 1759: "0", 1760: "0", 1761: "0", 1762: "0", 1763: "0", 1577: "0", 1578: "0", 1579: "0", 1789: "0", 1790: "0", 1791: "0", 1792: "0", 1793: "0", 1794: "0", 1795: "0", 1796: "0", 1811: "0", 1812: "0", 1837: "0", 1576: "0", 1575: "0", 1488: "0", 1489: "0", 1490: "0", 1491: "0", 1454: "0", 1455: "0", 1853: "0", 1854: "0", 1855: "0", 1856: "0", 1704: "2", 1705: "1", 1706: "1", 1707: "1", 1868: "1", 1869: "1", 1870: "1", 1871: "1", 1872: "1", 1873: "1", 1874: "1", 1875: "2", 1876: "2", 1877: "1", 561: "1", 1006: "1", 1495: "1", 1891: "2", 1892: "2", 1893: "2", 1894: "2", 1900: "2", 1901: "1", 1902: "1", 1905: "1", 1906: "1", 1909: "1", 1910: "1", 1911: "1", 1912: "2", 1913: "2", 1914: "2", 1915: "2", 1022: "1", };var opt_list = [250,245,249,231,236,230,26,74,68,261,243,268,269,271,272,277,278,279,280,281,283,235,229,285,288,289,290,292,295,296,297]; var more_txt = [], less_txt = [], optTmp = [], isStock = 0; var sid = '135'; var url = 'https://gwp.brweb.pl/i/135/'; var selcolor = '#F0520A'; var imgLimit = '16'; var moreLabel = 'Zobacz więcej +'; var lessLabel = '-'; var showMLcnt = 1; var prevMopen = ''; function showPrev(e) { if (window.innerWidth < 700) return null; var id = e.id; var aId = id.split('__'); var prev_div = document.getElementById('gwp_div_preview_'+aId[0].replace('option_','')); prev_div.style.display = 'block'; prev_div.innerHTML = ''; } function hidePrev(e) { if (window.innerWidth < 700) return null; var id = e.id; var aId = id.split('__'); var prev_div = document.getElementById('gwp_div_preview_'+aId[0].replace('option_','')); prev_div.style.display = 'none'; prev_div.innerHTML = ''; } 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) { 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 { 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 = ''; } 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.style.border = '1px solid transparent'; if ( c[i].id == id ) c[i].parentElement.style.border = '1px solid ' + selcolor; } } function radioClick(e) { var id = e.id; 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.style.border = '1px solid transparent'; if ( c[i].id == id ) c[i].parentElement.style.border = '1px solid ' + selcolor; } } 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 = type; } document.getElementById('gwp_more'+oid).innerHTML = type == 'block' ? less_txt[oid] : more_txt[oid] ; } function showGWP() { opt_list.forEach(function(opt_id) { var s = document.getElementById('option_'+opt_id); if (s && (!optTmp[opt_id] || optTmp[opt_id] != s.innerHTML)) { s.style.display = 'none'; optTmp[opt_id] = s.innerHTML; var sColors = ''; if (s.parentElement.className.indexOf('option_truestock ') != -1 && isStock == 0) { isStock = 1; const intervalGWP = setInterval(function() { showGWP(); if (s.value == 'wybierz') { var c30 = document.getElementsByClassName('c_option_' + opt_id); for( var i30 = 0; i30 < c30.length; i30++){ if (c30[i30].parentElement.style.border != '1px solid transparent') { selectClick(document.getElementById(c30[i30].id)); } } } }, 500); } sColors += '
'; sColors += '
'; sColors += '
'; var c = s.getElementsByTagName('option'); var imgNo = 0; var optCnt = c.length - 1; more_txt[opt_id] = moreLabel + (showMLcnt == 1 ? (optCnt - imgLimit + 1) : ''); less_txt[opt_id] = lessLabel + (showMLcnt == 1 ? (optCnt - imgLimit + 1) : ''); for( var j = 0; j< c.length; j++){ if (c[j].value != '' && c[j].value != 'wybierz' && c[j].value != 'choose' && c[j].value != 'wählen' && c[j].value != 'Vybrat' && c[j].value != 'vali' && c[j].value != 'izvēlēties' && c[j].value != 'pasirinkti' && c[j].value != 'választ' && c[j].value != 'vyberte si' && c[j].value != 'вибрати') { imgNo++; sColors += '
imgLimit || (imgNo == imgLimit && imgNo != optCnt)) ? ' class="gwpHidden'+opt_id+' gwp-opt" ' : 'class="gwp-opt"') + '>
'; } } if (optCnt > imgLimit) { sColors += '
' + more_txt[opt_id] + '
'; } sColors += '
'; if (document.getElementById('gwp_div_'+opt_id)) { div = document.getElementById('gwp_div_'+opt_id); div.innerHTML = sColors; s.parentElement.appendChild(div); } else { const div = document.createElement('div'); div.innerHTML = sColors; div.id = 'gwp_div_'+opt_id; div.className = 'gwp-div'; div.style = 'position:relative;'; s.parentElement.appendChild(div); } } var sr = document.getElementsByName('option_'+opt_id); if (sr && sr.length > 0 && (!optTmp[opt_id] || optTmp[opt_id] != s.innerHTML)) { optTmp[opt_id] = sr[0].parentElement.parentElement.innerHTML; var sColors = ''; var imgNo = 0; var optCnt = sr.length; for( var ri = 0; ri < sr.length; ri++){ if (sr[ri].parentElement.className == 'radio-wrap none') { optCnt--; } } more_txt[opt_id] = moreLabel + (showMLcnt == 1 ? (optCnt - imgLimit + 1) : ''); less_txt[opt_id] = lessLabel + (showMLcnt == 1 ? (optCnt - imgLimit + 1) : ''); var rlabels = sr[0].parentElement.parentElement.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; } sColors += '
'; sColors += '
'; sColors += '
'; for( var ri = 0; ri < sr.length; ri++){ if (sr[ri].parentElement.className != 'radio-wrap none') { imgNo++; sColors += '
imgLimit || (imgNo == imgLimit && imgNo != optCnt)) ? ' class="gwpHidden'+opt_id+' gwp-opt" ' : 'class="gwp-opt"') + '>
'; } } if (optCnt > imgLimit) { sColors += '
' + more_txt[opt_id] + '
'; } sColors += '
'; if (document.getElementById('gwp_div_'+opt_id)) { div = document.getElementById('gwp_div_'+opt_id); div.innerHTML = sColors; s.parentElement.appendChild(div); } else { const div = document.createElement('div'); div.innerHTML = sColors; div.id = 'gwp_div_'+opt_id; div.style = 'position:relative;'; div.className = 'gwp-div'; sr[0].parentElement.parentElement.parentElement.appendChild(div); sr[0].parentElement.parentElement.style.height = '0px'; sr[0].parentElement.parentElement.style.visibility = 'hidden'; } } }); } showGWP();