gwpNo = {566: "4", 691: "1", 692: "1", 693: "1", 694: "1", 567: "1", 568: "1", 581: "1", 582: "1", 583: "1", 584: "1", 585: "1", 678: "1", 679: "1", 680: "1", 705: "1", 706: "1", 707: "1", 708: "2", 709: "4", 710: "3", 711: "2", 712: "1", 713: "1", 714: "1", 715: "1", 716: "1", 717: "1", 718: "1", 719: "1", 720: "1", 721: "1", 722: "1", 723: "1", 724: "1", 725: "1", 726: "1", 727: "1", 728: "1", 729: "1", 730: "1", 731: "1", 732: "1", 733: "1", 734: "1", 735: "1", 736: "1", 737: "1", 738: "1", 739: "1", 740: "1", 741: "1", 742: "1", 743: "2", 744: "2", 745: "2", 746: "1", 747: "1", 748: "1", 749: "1", 750: "1", 751: "1", 752: "1", 753: "1", 754: "1", 755: "1", 756: "1", 757: "1", 758: "1", 759: "1", 760: "1", 761: "1", 762: "1", 763: "1", 764: "1", 765: "1", 766: "1", 767: "1", 768: "1", 769: "1", 770: "1", 771: "1", 772: "1", 773: "1", 774: "1", 775: "1", 776: "2", 777: "1", 778: "2", 779: "2", 780: "2", 781: "1", 782: "1", 783: "1", 784: "1", 785: "1", 786: "1", 787: "1", 788: "1", 789: "1", 790: "1", 791: "1", 792: "1", 793: "1", 794: "1", 795: "1", 796: "1", 797: "1", 798: "1", 799: "1", 800: "1", 801: "2", 816: "1", 817: "1", 802: "1", 803: "1", 804: "1", 805: "1", 806: "1", 807: "1", 808: "1", 809: "1", 810: "1", 811: "1", 812: "1", 813: "1", 814: "1", 815: "1", 818: "1", 819: "1", 820: "1", 821: "1", 822: "1", 823: "2", 824: "2", 825: "3", 826: "3", 827: "1", 828: "3", 829: "2", 830: "2", 831: "2", 832: "2", 833: "1", 834: "1", 835: "1", 836: "1", 837: "1", 838: "1", 839: "1", 840: "1", 841: "1", 842: "1", 843: "1", 844: "1", 845: "1", 846: "1", 847: "1", 848: "1", 849: "1", 850: "1", 851: "1", 852: "1", 853: "3", 854: "1", 855: "1", 856: "1", 857: "1", 858: "1", 859: "1", 860: "1", 861: "1", 862: "1", 863: "1", 864: "1", 865: "1", 866: "1", 867: "1", 868: "1", 897: "1", 898: "1", 899: "1", 900: "1", 901: "1", 902: "1", 903: "1", 904: "1", 905: "1", 906: "1", 907: "1", 908: "1", 909: "1", 910: "1", 911: "1", 912: "1", 913: "1", 914: "1", 915: "1", 916: "1", 917: "1", 918: "1", 919: "1", 920: "1", 921: "1", 922: "1", 923: "1", 924: "1", 925: "1", 926: "1", 927: "1", 928: "1", 929: "1", 930: "1", 931: "1", 932: "1", 933: "1", 934: "1", 935: "1", 936: "1", 937: "1", 938: "1", 939: "1", 940: "2", 941: "1", 942: "2", 943: "1", 944: "1", 945: "1", 946: "1", 947: "1", 948: "1", 949: "1", 950: "1", 951: "1", 952: "1", 953: "1", 954: "1", 955: "1", 956: "1", 966: "1", 967: "1", 968: "1", 969: "1", 970: "1", 971: "1", 972: "1", 973: "1", 974: "1", 975: "1", 976: "1", 977: "1", 978: "1", 979: "1", 980: "1", 981: "1", 982: "1", 983: "1", 984: "1", 985: "1", 986: "1", 987: "1", 988: "1", 989: "1", 990: "1", 991: "1", 992: "1", 993: "1", 994: "2", 995: "2", 998: "2", 997: "1", 996: "1", 999: "1", 1000: "1", 1002: "1", 1001: "1", 1003: "1", 1004: "1", 1005: "1", 1006: "1", 1007: "1", 1008: "1", 1028: "1", 1029: "1", 1030: "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: "2", 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", 1060: "1", 1061: "1", 1062: "1", 1063: "1", 1064: "1", 1065: "2", 1066: "1", 1067: "1", 1068: "1", 1069: "1", 1070: "1", 1071: "1", 1072: "1", 1073: "1", 1074: "1", 1075: "1", 1076: "1", 1077: "1", 1078: "1", 1079: "1", 1080: "1", 1081: "1", 1082: "1", 1083: "1", 1084: "1", 1085: "1", 1086: "1", 1087: "1", 1088: "1", 1089: "1", 1090: "1", 1091: "1", 1092: "1", 1093: "1", 1094: "1", 1095: "1", 1097: "1", 1096: "1", 1098: "1", 1099: "1", 1100: "1", 1101: "1", 1102: "1", 1103: "1", 1104: "2", 1105: "1", 1106: "1", 1107: "1", 1108: "1", 1109: "1", 1110: "1", 1111: "1", 1112: "1", 1113: "1", 1114: "1", 1115: "1", 1116: "1", 1139: "1", 1140: "1", 1143: "1", 1144: "1", 1145: "1", 1147: "1", 1149: "1", 1150: "1", 1151: "1", 1152: "1", 1153: "1", 1154: "1", 1155: "1", 1156: "1", 1157: "1", 1158: "1", 1159: "1", 1161: "1", 1162: "1", 1163: "1", 1164: "1", 1165: "1", 1166: "1", 1167: "1", 1168: "1", 1169: "1", 1170: "1", 1171: "1", 1172: "1", 1173: "1", 1174: "1", 1175: "1", 1176: "1", 1177: "1", 1178: "1", 1179: "1", 1180: "1", 1181: "1", 1182: "1", 1183: "1", 1184: "1", 1185: "1", 1186: "1", 1187: "1", 1188: "1", 1189: "1", 1190: "1", 1191: "1", 1192: "1", 1193: "1", 1194: "1", 1195: "1", 1196: "1", 1197: "1", 1198: "1", 1199: "1", 1200: "1", 1201: "1", 1202: "1", 1203: "1", 1204: "1", 1205: "1", 1206: "1", 1207: "1", 1208: "1", 1209: "1", 1210: "1", 1211: "1", 1212: "1", 1213: "1", 1214: "1", 1215: "1", 1216: "1", 1217: "1", 1218: "1", 1219: "1", 1220: "1", 1222: "1", 1223: "1", 1224: "1", 1225: "1", 1226: "1", 1227: "1", 1228: "1", 1229: "1", 1230: "1", 1231: "1", 1232: "1", 1233: "1", 1234: "1", 1235: "1", 1236: "1", 1237: "1", 1238: "1", 1239: "1", 1240: "1", 1241: "1", 1242: "1", 1243: "1", 1244: "1", 1245: "1", 1246: "1", 1247: "1", 1248: "1", 1249: "1", 1250: "1", 1251: "1", 1252: "1", 1253: "1", 1254: "1", 1255: "1", 1256: "1", 1257: "1", 1258: "1", 1259: "1", 1260: "1", 1261: "1", 1262: "1", 1263: "1", 1264: "1", 1265: "1", 1266: "1", 1267: "1", 1268: "1", 1269: "2", 1270: "1", 1271: "1", 1272: "1", 1273: "1", 1274: "1", 1275: "1", 1276: "1", 1277: "1", 1278: "1", 1279: "1", 1280: "1", 1281: "1", 1282: "1", 1283: "1", 1284: "1", 1285: "1", 1286: "1", 1287: "1", 1288: "1", 1289: "1", 1290: "1", 1291: "1", 1292: "1", 1293: "1", 1294: "1", 1295: "1", 1296: "1", 1297: "1", 1298: "1", 1299: "1", 1300: "1", 1301: "1", 1302: "1", 1303: "1", 1304: "1", 1305: "1", 1306: "1", 1307: "1", 1308: "1", 1309: "1", 1310: "1", 1311: "1", 1312: "1", 1313: "1", 1314: "1", 1315: "1", 1316: "1", 1317: "1", 1318: "1", 1319: "1", 1320: "1", 1321: "1", 1322: "3", 1323: "1", 1324: "1", 1325: "1", 1326: "1", 1327: "1", 1328: "1", 1329: "1", 1330: "1", 1331: "1", 1332: "1", 1333: "1", 1334: "1", 1335: "1", 1336: "1", 1337: "1", 1338: "1", 1339: "1", 1340: "1", 1341: "1", 1342: "1", };var opt_list = [162,166,167,169,171,172,173,174,175,184,185,186]; var more_txt = [], less_txt = [], optTmp = [], isStock = 0; var sid = '218'; var url = 'https://gwp.brweb.pl/i/218/'; var selcolor = '#F70000'; var imgLimit = '3'; var moreLabel = 'Rozwiń '; var lessLabel = 'Ukryj '; 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();