gwpNo = {818: "0", 819: "0", 820: "0", 838: "0", 823: "0", 822: "0", 821: "0", 544: "0", 545: "0", 588: "0", 590: "0", 596: "0", 597: "0", 598: "0", 601: "0", 599: "0", 600: "0", 593: "0", 594: "0", 595: "0", 589: "0", 587: "0", 592: "0", 586: "0", 591: "0", 839: "0", 840: "0", 841: "0", 842: "0", 843: "0", 844: "0", 845: "0", 846: "0", 847: "0", 848: "0", 849: "0", 850: "0", 851: "0", 852: "0", 853: "0", 854: "0", 855: "0", 856: "0", 857: "0", 858: "0", 859: "0", 860: "0", 861: "0", 862: "0", 863: "0", 864: "0", 865: "0", 866: "0", 867: "0", 868: "0", 869: "0", 870: "0", 871: "0", 824: "0", 825: "0", 879: "0", 880: "0", 881: "0", 882: "0", 883: "0", 884: "0", 885: "0", 886: "0", 887: "0", 888: "0", 889: "0", 890: "0", 502: "0", 503: "0", 504: "0", 505: "0", 506: "0", 507: "0", 634: "0", 635: "0", 636: "0", 637: "0", 638: "0", 639: "0", 640: "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", 936: "0", 937: "0", 938: "0", 935: "0", 933: "0", 934: "0", 939: "0", 940: "0", 932: "0", 941: "0", 942: "0", 943: "0", 944: "0", 945: "0", 946: "0", 947: "0", 891: "0", 892: "0", 893: "0", 894: "0", 895: "0", 896: "0", 897: "0", 948: "0", 949: "0", 950: "0", 951: "0", 952: "0", 974: "0", 975: "0", 976: "0", 977: "0", 978: "0", 979: "0", 980: "0", 493: "0", 494: "0", 495: "0", 496: "0", 981: "0", 983: "0", 984: "0", 989: "0", 991: "0", 990: "0", 992: "0", 999: "0", 1000: "0", 1001: "0", 1002: "0", 1003: "0", 1004: "0", 1005: "0", 724: "0", 723: "0", 725: "0", 726: "0", 727: "0", 728: "0", 729: "0", 730: "0", 731: "0", 1012: "0", 1013: "0", 1014: "0", 1015: "0", 1016: "0", 1017: "0", 1018: "0", 1019: "0", 1010: "2", 1011: "2", 1020: "0", 1021: "0", 1024: "1", 1025: "1", 1026: "1", 1027: "1", 1028: "1", 1029: "1", 1022: "1", 1023: "1", 1032: "1", 1033: "1", 1034: "1", 1038: "1", 1035: "1", 1036: "1", 1037: "1", 1039: "1", 1040: "1", 993: "1", 994: "1", 995: "1", 996: "1", 997: "1", 998: "1", 1067: "1", 1068: "1", 1069: "1", 1070: "1", 1071: "1", 1072: "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: "1", 1066: "1", 1073: "2", 1074: "3", 1075: "2", 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", 1096: "1", 1097: "1", 1098: "1", 1099: "1", 1100: "1", 1101: "1", 1102: "1", 1103: "1", 1104: "1", 1105: "1", 1106: "1", 1107: "1", 1108: "1", 1109: "1", 1110: "1", 1111: "1", 1112: "1", 1113: "1", 1114: "1", 1115: "1", 1116: "1", 1117: "1", 1118: "1", 1119: "1", 1120: "1", 1121: "1", 1122: "1", 1123: "1", 1124: "1", 1125: "1", 1126: "1", 1127: "1", 1128: "1", 1129: "1", 1130: "1", 1131: "1", 1132: "1", 1133: "1", 1134: "1", 1135: "1", 623: "1", 624: "1", 625: "1", 626: "1", 627: "1", 628: "1", 615: "1", 616: "1", 614: "1", 1144: "2", 1145: "2", 1146: "2", 1147: "1", 1148: "1", 1149: "2", 1155: "2", 1274: "1", 1275: "1", };var opt_list = [194,115,126,198,195,200,104,201,203,102,204,207,208,150,211,212,210,213,215,214,223,220,221,222,224,225,133,131,228]; var more_txt = [], less_txt = [], optTmp = [], isStock = 0; var sid = '141'; var url = 'https://gwp.brweb.pl/i/141/'; var selcolor = '#777777'; var imgLimit = '5'; 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' && 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();