gwpNo = {2578: "0", 2580: "0", 2581: "0", 2583: "0", 2584: "0", 2577: "0", 2582: "0", 2612: "0", 2579: "0", 2611: "0", 5164: "0", 5165: "0", 5166: "0", 5167: "0", 5168: "0", 5169: "0", 5170: "0", 5171: "0", 5172: "0", 5173: "0", 5175: "0", 5176: "0", 5177: "0", 5163: "0", 5174: "0", 5178: "0", 5180: "0", 5181: "0", 5182: "0", 5183: "0", 5179: "0", 5225: "0", 5226: "0", 5227: "0", 5228: "0", 5229: "0", 5230: "0", 5231: "0", 5232: "1", 5233: "0", 5235: "0", 5236: "0", 5237: "0", 5238: "0", 5239: "0", 5240: "0", 5241: "0", 5242: "0", 5234: "0", 5303: "0", 5304: "0", 5305: "0", 5306: "0", 5307: "0", 5309: "0", 5310: "0", 5311: "0", 5312: "0", 5313: "0", 5316: "0", 5317: "0", 5318: "0", 5319: "0", 5320: "0", 5321: "0", 5322: "0", 5323: "0", 5326: "0", 5327: "0", 5314: "0", 5315: "0", 5328: "0", 5329: "0", 5331: "0", 5332: "0", 5337: "0", 5339: "0", 5340: "0", 5341: "0", 5342: "0", 5308: "0", 5324: "0", 5343: "0", 5333: "0", 5334: "0", 5336: "0", 5330: "0", 5335: "0", 5338: "0", 5279: "0", 5280: "0", 5281: "0", 5282: "0", 5283: "0", 5284: "0", 5285: "0", 5286: "0", 5287: "0", 5288: "0", 5289: "0", 5290: "0", 5291: "0", 5292: "0", 5293: "0", 5294: "0", 5295: "0", 5296: "0", 5297: "0", 5298: "0", 5299: "0", 5357: "0", 5358: "0", 5359: "0", 5360: "0", 5361: "0", 5362: "0", 5363: "0", 5364: "0", 5365: "0", 5366: "0", 5367: "0", 5368: "0", 5369: "0", 5370: "0", 5371: "0", 5372: "0", 5373: "0", 5374: "0", 5375: "0", 5376: "0", 5377: "0", 5378: "0", 5399: "0", 5400: "0", 5401: "0", 5402: "0", 5403: "0", 5404: "0", 5405: "0", 5406: "0", 5407: "0", 5408: "0", 5409: "0", 5410: "0", 5411: "0", 5412: "0", 5413: "0", 5414: "0", 5415: "0", 5417: "0", 5418: "0", 5491: "0", 5492: "0", 5493: "0", 5494: "0", 5495: "0", 5496: "0", 5497: "0", 5498: "0", 5499: "0", 5500: "0", 5501: "0", 5502: "0", 5503: "0", 5504: "0", 5505: "0", 5506: "0", 5508: "0", 5509: "0", 5510: "0", 5512: "0", 5507: "0", 5511: "0", 5513: "0", 5514: "0", 5515: "0", 5517: "0", 5539: "0", 5540: "0", 5541: "0", 5542: "0", 5543: "0", 5544: "0", 5545: "0", 5560: "0", 5561: "0", 5562: "0", 5563: "0", 5564: "0", 5565: "0", 5566: "0", 5567: "0", 5568: "0", 5569: "0", 5570: "0", 5571: "0", 5572: "0", 5573: "0", 5574: "0", 5575: "0", 5576: "0", 5577: "0", 5578: "0", 5618: "0", 5619: "0", 5623: "0", 5624: "0", 5625: "0", 5642: "0", 5643: "0", 5644: "0", 5645: "0", 5638: "0", 5639: "0", 5640: "0", 5641: "0", 5646: "0", 5647: "0", 5648: "0", 5649: "0", 5634: "0", 5635: "0", 5636: "0", 5637: "0", 5650: "0", 5651: "0", 5652: "0", 5653: "0", 5654: "0", 5655: "0", 5656: "0", 5657: "0", 5658: "0", 5659: "0", 5660: "0", 5661: "0", 5662: "0", 5663: "0", 5664: "0", 5665: "0", 5666: "0", 5667: "0", 5668: "0", 5669: "0", 5670: "0", 5671: "0", 5672: "0", 5673: "0", 5674: "0", 5675: "0", 5677: "0", 5676: "0", 5679: "0", 5680: "0", 5681: "0", 5683: "0", 5684: "0", 5685: "0", 5686: "1", 5687: "0", 5688: "0", 5689: "0", 5690: "0", 5691: "0", 5692: "0", 5693: "0", 5696: "0", 5696: "0", 5697: "0", 5698: "0", 5703: "0", 5704: "1", 5705: "0", 5707: "0", 5699: "1", 5700: "0", 5702: "0", 5701: "0", 5706: "0", 5726: "0", 5727: "0", 5728: "0", 5729: "0", 5708: "0", 5709: "0", 5710: "0", 5711: "0", 5712: "0", 5713: "0", 5714: "0", 5715: "0", 5716: "0", 5717: "0", 5718: "0", 5719: "0", 5720: "0", 5721: "0", 5722: "0", 5723: "0", 5724: "0", 5725: "0", 5730: "0", 5731: "0", 5732: "0", 5740: "1", 5741: "2", 5742: "1", 5743: "1", 5744: "1", 5745: "1", 5752: "2", 5753: "2", 5754: "2", 5755: "2", 5756: "2", 5757: "2", 5758: "1", 5760: "1", 5761: "1", 5762: "1", 5763: "1", 5765: "1", 5766: "1", 5767: "1", 5759: "1", 5764: "1", 5787: "1", 5788: "1", 5789: "1", 5790: "1", 5791: "1", 5792: "1", 5793: "1", 5796: "1", 5797: "1", 5794: "1", 5795: "1", 5798: "1", 5799: "1", 5800: "1", 5801: "1", 5802: "2", 5803: "1", 5804: "1", 5805: "2", 5806: "1", 5807: "1", 5808: "1", 5809: "1", 5810: "1", 5811: "1", 5812: "1", 5813: "1", 5814: "1", 5815: "1", 5816: "1", 5820: "1", 5821: "1", 5822: "1", 5829: "1", 5830: "1", 5831: "1", 5845: "1", 5826: "1", 5827: "1", 5828: "1", 5832: "1", 5833: "1", 5844: "1", 5835: "1", 5836: "1", 5837: "1", 5838: "1", 5839: "1", 5840: "1", 5841: "1", 5842: "1", 5843: "1", 5817: "1", 5818: "1", 5819: "1", 5823: "1", 5824: "1", 5825: "1", 5849: "1", 5850: "1", 5846: "1", 5848: "1", 5847: "1", 5851: "2", 5852: "1", 5853: "1", 5854: "2", 5855: "1", 5856: "1", 5857: "1", 5858: "1", 5859: "2", 5860: "1", 5861: "1", 5862: "2", 5863: "1", 5864: "2", 5865: "1", 5866: "2", 5867: "2", 5868: "1", 5869: "1", 5874: "1", 5875: "2", 5876: "2", 5877: "1", 5878: "1", 5879: "1", 5870: "1", 5871: "1", 5872: "3", 5873: "2", 5880: "1", 5881: "1", 5883: "2", 5882: "1", 5884: "1", 5885: "1", 5886: "1", 5887: "1", 5889: "1", 5888: "1", };var opt_list = [153,305,320,321,327,328,330,334,340,344,352,358,367]; var more_txt = [], less_txt = [], optTmp = [], isStock = 0; var sid = '94'; var url = 'https://gwp.brweb.pl/i/94/'; var selcolor = '#777777'; var imgLimit = '6'; var moreLabel = '+'; 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') { 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();