var pb=2; gwpNo = {68: "0", 823: "0", 449: "0", 448: "0", 838: "0", 443: "0", 445: "0", 818: "0", 442: "0", 452: "0", 453: "0", 831: "0", 833: "0", 837: "0", 450: "0", 451: "0", 1022: "0", 69: "0", 430: "0", 435: "0", 436: "0", 437: "0", 438: "0", 441: "0", 444: "0", 455: "0", 456: "0", 780: "0", 779: "0", 781: "0", 817: "0", 821: "0", 822: "0", 825: "0", 826: "0", 827: "0", 830: "0", 832: "0", 836: "0", 996: "0", 1025: "0", 1212: "0", 1213: "0", 1214: "0", 1215: "0", 1216: "0", 1217: "0", 1218: "0", 1224: "0", 1225: "0", 1226: "0", 1227: "0", 1228: "0", 1229: "0", 1230: "0", 1231: "0", 1232: "0", 1233: "0", 1234: "0", 1235: "0", 1236: "0", 1237: "0", 1238: "0", 1239: "0", 1240: "0", 1241: "0", 1242: "0", 1243: "0", 1244: "0", 1245: "0", 1246: "0", 1247: "0", 1248: "0", 1249: "0", 1250: "0", 1251: "0", 1252: "0", 1253: "0", 1254: "0", 1255: "0", 1256: "0", 1257: "0", 1258: "0", 1259: "0", 1260: "1", 1261: "0", 1262: "0", 1263: "0", 1264: "0", 1265: "0", 1266: "0", 1267: "0", 1268: "0", 1269: "0", 1371: "1", 1373: "2", 1374: "1", 1375: "2", 1376: "2", 1377: "2", 1378: "2", 1379: "2", 1380: "3", 1381: "2", 1382: "2", 1383: "2", 1384: "2", 1385: "2", 1386: "2", 1387: "2", 1388: "2", 1389: "2", 1390: "2", 1391: "2", 1392: "2", 1393: "2", 1394: "2", 1395: "2", 1396: "2", 1397: "2", 1398: "2", 1399: "2", 1400: "2", 1401: "2", 1402: "2", 1403: "2", 1404: "2", 1405: "2", 1406: "2", 1407: "2", 1408: "2", 1409: "2", 1410: "2", 1411: "3", 1412: "2", 1413: "2", 1414: "2", 1415: "2", 1416: "3", 1417: "2", 1419: "1", 1418: "1", 1794: "1", 1795: "1", 1796: "1", 1797: "1", 1798: "1", 1804: "1", 1800: "1", 1801: "1", 1799: "1", 1802: "1", 1803: "1", };var opt_list = [16,49,65]; var more_txt = [], less_txt = [], optTmp = [], isStock = 0; var sid = '172'; var url = 'https://gwp.brweb.pl/i/172/'; var selcolor = '#731A63'; var imgLimit = '12'; var moreLabel = 'więcej'; var lessLabel = 'zwiń'; var showMLcnt = 0; 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 += '
'; var lwl = 4; 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') { imgNo++; sColors += '
imgLimit || (imgNo == imgLimit && imgNo != optCnt)) ? ' class="gwpHidden'+opt_id+' gwp-opt" ' : 'class="gwp-opt"') + '>
'; if (imgNo % lwl == 0) { sColors += '
imgLimit || (imgNo == imgLimit && imgNo != optCnt)) ? ' class="gwpHidden'+opt_id+'" ' : '') + '>
'; } } } 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 += '
'; var lwl = 4; 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 (imgNo % lwl == 0) { sColors += '
'; } } } 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();