gwpNo = {50: "1", 51: "1", 52: "1", 53: "1", 54: "1", 103: "1", 104: "1", 105: "1", 106: "1", 107: "1", 108: "1", 115: "1", 116: "1", 117: "1", 118: "1", 119: "1", 130: "1", 131: "1", 132: "1", 133: "1", 134: "1", 135: "1", 136: "1", 137: "1", 138: "1", 139: "1", 140: "1", 141: "1", 142: "1", 143: "1", 144: "1", 145: "1", 146: "1", 147: "1", 163: "3", 164: "2", 165: "2", 166: "2", 167: "2", 168: "2", 169: "2", 170: "2", 171: "2", 172: "2", 189: "1", 190: "1", 191: "1", 192: "1", 193: "1", 194: "1", 195: "1", 196: "1", 197: "1", 198: "1", 199: "1", 200: "1", 201: "1", 202: "1", 203: "1", 204: "1", 272: "1", 273: "1", 274: "1", 275: "1", 276: "1", 277: "1", 278: "1", 279: "1", 280: "1", 281: "1", 282: "1", 283: "1", 284: "1", 365: "1", 366: "1", 367: "1", 368: "1", 369: "1", 370: "1", 371: "1", 372: "1", 373: "1", 374: "1", 391: "1", 392: "1", 393: "1", 394: "1", 395: "1", 396: "1", 397: "1", 398: "1", 399: "1", 400: "1", 401: "2", 402: "2", 403: "2", 404: "2", 419: "1", 420: "1", 421: "1", 422: "1", 423: "1", 424: "1", 425: "1", 426: "1", 427: "1", 428: "1", 429: "1", 430: "1", 440: "1", 441: "1", 442: "1", 446: "1", 447: "1", 448: "1", 449: "1", 450: "1", 451: "1", 452: "1", 453: "1", 454: "1", 455: "1", 456: "1", 457: "1", 458: "1", 478: "1", 479: "1", 490: "1", 491: "1", 492: "1", 493: "1", 494: "1", 495: "1", 496: "1", 497: "1", 498: "1", 499: "1", 500: "1", 501: "1", 502: "1", 503: "1", 504: "1", 505: "1", 506: "1", 507: "1", 508: "1", 509: "1", 522: "1", 523: "2", 524: "1", 525: "1", 526: "1", 527: "1", 528: "1", 529: "1", 539: "1", 540: "1", 541: "1", 625: "1", 626: "1", 627: "1", 628: "1", 629: "1", 630: "1", 640: "1", 641: "1", 642: "1", 643: "1", 644: "1", 645: "1", 680: "1", 681: "1", 682: "1", 683: "1", 684: "1", 685: "1", 702: "1", 703: "1", 724: "1", 725: "1", 728: "1", 729: "1", 730: "1", 731: "1", 747: "1", 748: "1", 805: "1", 806: "1", 816: "1", 817: "1", 818: "1", 819: "1", 820: "1", 821: "1", 822: "1", 823: "1", 824: "1", 825: "1", 826: "1", 827: "1", 828: "1", 829: "1", 830: "1", 831: "1", 832: "1", 833: "1", 834: "2", 835: "1", 836: "1", 837: "1", 838: "1", 839: "1", 840: "1", 841: "1", 842: "1", 859: "1", 860: "1", 861: "1", 862: "1", 863: "1", 864: "1", 865: "1", 866: "1", 867: "1", 868: "1", 869: "1", 870: "1", 871: "1", 872: "1", 873: "1", 874: "1", 875: "1", 876: "1", 877: "1", 878: "1", 879: "1", 880: "1", 881: "1", 882: "1", 883: "1", 884: "1", 885: "1", 886: "1", 887: "1", 888: "1", 889: "1", 890: "1", 891: "1", 892: "1", 893: "1", 906: "1", 907: "1", 908: "1", 909: "1", 910: "1", 911: "1", 928: "1", 929: "1", 930: "1", 931: "1", 932: "1", 933: "1", 938: "1", 939: "1", 940: "1", 956: "1", 957: "1", 958: "1", 959: "1", 960: "1", 961: "1", 962: "1", 963: "1", 964: "1", 965: "1", 966: "1", 967: "1", 989: "1", 990: "1", 991: "1", 992: "1", 993: "1", 994: "1", 1004: "1", 1005: "1", 1006: "1", 1007: "1", 1008: "1", 1009: "1", 1010: "1", 1011: "1", 1012: "1", 1013: "1", 1018: "1", };var opt_list = [9,24,26,31,32,33,43,51,66,67,75,76,82,83,90,91,98,103,107,109,117,127,128,133,135,136,143,151,170,180,188,191,199,201,212,231,237,238,239,240,246,247,252,257,258,259,269,272,275,283,286,292,297,298]; var more_txt = [], less_txt = [], optTmp = [], isStock = 0; var sid = '296'; var url = 'https://gwp.brweb.pl/i/296/'; 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 showPrevMobile(e) { var id = e.id; var aId = id.split('__'); var prev_id = 'gwp_div_preview_'+aId[0].replace('option_',''); 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 prev_id = 'gwp_div_preview_'+aId[0].replace('option_',''); var prev_div = document.getElementById(prev_id); prev_div.style.display = 'none'; prev_div.innerHTML = ''; } function hideDiv() { document.getElementById(prevMopen).style.display = 'none'; } 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 = ''; } 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; 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.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();