gwpNo = {200: "0", 201: "0", 202: "0", 203: "0", 204: "0", 205: "0", 207: "0", 208: "0", 220: "0", 221: "0", 222: "0", 230: "0", 231: "0", 232: "0", 233: "0", 234: "0", 235: "0", 237: "0", 238: "0", 240: "0", 241: "0", 242: "0", 846: "0", 224: "0", 225: "0", 226: "0", 227: "0", 245: "0", 246: "0", 247: "0", 248: "0", 249: "0", 251: "0", 252: "0", 254: "0", 255: "0", 256: "0", 409: "0", 847: "0", 472: "0", 347: "0", 348: "0", 378: "0", 144: "0", 145: "0", 146: "0", 147: "0", 148: "0", 149: "0", 150: "0", 151: "0", 152: "0", 153: "0", 154: "0", 155: "0", 156: "0", 157: "0", 158: "0", 159: "0", 161: "0", 162: "0", 163: "0", 164: "0", 165: "0", 166: "0", 167: "0", 168: "0", 171: "0", 172: "0", 173: "0", 174: "0", 175: "0", 176: "0", 178: "0", 177: "0", 179: "0", 170: "0", 135: "0", 136: "0", 137: "0", 138: "0", 140: "0", 141: "0", 142: "0", 143: "0", 857: "0", 858: "0", 859: "0", 861: "0", 860: "0", 862: "0", 863: "0", 864: "0", 865: "0", 866: "0", 868: "0", 867: "0", 869: "0", 870: "0", 871: "0", 872: "0", 873: "0", 874: "0", 876: "0", 875: "0", 877: "0", 878: "0", 880: "0", 879: "0", 881: "0", 882: "0", 883: "0", 884: "0", 531: "0", 532: "0", 533: "0", 534: "0", 535: "0", 536: "0", 537: "0", 538: "0", 539: "0", 540: "0", 541: "0", 542: "0", 543: "0", 544: "0", 545: "0", 546: "0", 547: "0", 565: "0", 566: "0", 567: "0", 568: "0", 569: "0", 570: "0", 571: "0", 572: "0", 573: "0", 574: "0", 575: "0", 576: "0", 577: "0", 578: "0", 579: "0", 580: "0", 581: "0", 582: "0", 583: "0", 586: "0", 584: "0", 585: "0", 665: "0", 666: "0", 667: "0", 668: "0", 669: "0", 670: "0", 671: "0", 672: "0", 673: "0", 674: "0", 675: "0", 676: "0", 677: "0", 678: "0", 679: "0", 887: "0", 888: "0", 889: "0", 890: "0", 891: "0", 892: "0", 894: "0", 643: "0", 644: "0", 645: "0", 646: "0", 647: "0", 648: "0", 649: "0", 650: "0", 651: "0", 652: "0", 653: "0", 654: "0", 655: "0", 656: "0", 657: "0", 658: "0", 659: "0", 660: "0", 661: "0", 662: "0", 663: "0", 664: "0", 698: "0", 699: "0", 700: "0", 701: "0", 702: "0", 703: "0", 704: "0", 705: "0", 706: "0", 707: "0", 708: "0", 709: "0", 710: "0", 711: "0", 712: "0", 713: "0", 714: "0", 715: "0", 716: "0", 717: "0", 718: "0", 719: "0", 896: "0", 897: "0", 898: "0", 899: "0", 720: "0", 721: "0", 722: "0", 723: "0", 724: "0", 725: "0", 726: "0", 727: "0", 728: "0", 729: "0", 730: "0", 731: "0", 757: "0", 758: "0", 759: "0", 760: "0", 761: "0", 762: "0", 763: "0", 764: "0", 765: "0", 766: "0", 767: "0", 768: "0", 769: "0", 770: "0", 771: "0", 775: "0", 885: "0", 886: "0", 900: "0", 901: "0", 902: "0", 903: "0", 904: "0", 905: "0", 906: "0", 907: "0", 908: "0", 909: "0", 910: "0", 911: "0", 912: "0", 913: "0", 914: "0", 915: "0", 916: "0", 917: "0", 918: "0", 919: "0", 920: "0", 921: "0", 922: "0", 923: "0", 924: "0", 929: "0", 930: "0", 931: "0", 932: "0", 933: "0", 934: "0", 935: "0", 936: "0", 937: "0", 938: "0", 939: "0", 940: "0", 941: "0", 943: "0", 949: "0", 951: "0", 944: "0", 945: "0", 946: "0", 947: "0", 948: "0", 974: "0", 975: "0", 953: "0", 955: "0", 957: "0", 959: "0", 960: "0", 961: "0", 962: "0", 963: "0", 964: "0", 965: "0", 966: "0", 967: "0", 968: "0", 969: "0", 970: "0", 971: "0", 972: "0", 973: "0", 1018: "1", 1019: "1", 1020: "1", 1021: "1", 1022: "1", 1023: "1", 1024: "1", 1025: "1", 1026: "1", 1027: "1", 1028: "1", 1029: "1", 1031: "1", 1032: "1", 1033: "1", 1034: "1", 1035: "1", 1036: "1", 1037: "1", 1038: "1", 1039: "1", 1040: "1", 1041: "1", 1042: "1", 1043: "1", 1044: "1", 1045: "1", 1046: "1", 1047: "1", 1048: "1", 1049: "1", 1050: "1", 1051: "1", 1052: "1", 1053: "1", 1054: "1", 1055: "1", 1056: "1", 1057: "1", 1058: "1", 1059: "1", 1061: "1", 1060: "1", 1062: "1", 1063: "1", 1064: "1", 1066: "1", 405: "1", 406: "2", 407: "1", 408: "1", 851: "2", 852: "2", 1080: "1", 1082: "1", 1081: "1", 1083: "1", 1084: "1", 1085: "1", 1086: "1", 1094: "1", 1087: "2", };var opt_list = [17,27,30,31,74,18,100,101,102,103,104,105,109,108,111,112,106,107,110,126,131]; var more_txt = [], less_txt = [], optTmp = [], isStock = 0; var sid = '132'; var url = 'https://gwp.brweb.pl/i/132/'; var selcolor = '#E80E0E'; 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();