gwpNo = {860: "2", 861: "2", 94: "3", 95: "2", 96: "2", 1062: "3", 1063: "2", 1064: "2", 1065: "2", 1066: "2", 97: "2", 98: "2", 99: "2", 100: "2", 101: "2", 102: "3", 103: "2", 104: "2", 105: "2", 106: "2", 107: "2", 108: "2", 109: "2", 110: "2", 111: "2", 112: "2", 113: "3", 114: "4", 130: "3", 115: "2", 116: "2", 117: "3", 128: "2", 129: "2", 118: "2", 119: "2", 120: "2", 121: "2", 122: "2", 123: "3", 440: "3", 131: "2", 124: "2", 125: "2", 126: "2", 127: "2", 857: "2", 858: "2", 859: "2", 1002: "2", 1003: "2", 1004: "2", 1188: "2", 1189: "2", 1190: "2", 1191: "2", 1192: "2", 1193: "2", 1194: "2", 1195: "2", 1196: "2", 1197: "2", 1198: "2", 1220: "3", 1219: "2", 1221: "2", 1222: "2", 1223: "2", 1224: "2", 1225: "2", 1226: "2", 1227: "2", 1228: "2", 1229: "2", 1230: "2", 1231: "1", 1232: "1", 1233: "1", 1234: "1", 1235: "1", 1236: "1", 1237: "1", 1238: "1", 669: "2", 670: "2", 671: "2", 672: "3", 673: "2", 674: "2", 675: "2", 676: "2", 677: "2", 678: "2", 679: "2", 680: "2", 681: "2", 682: "2", 683: "3", 684: "2", 685: "2", 686: "2", 687: "2", 688: "2", 689: "2", 690: "2", 691: "2", 692: "2", 693: "2", 694: "2", 695: "2", 696: "2", 697: "2", 698: "2", 699: "2", 700: "2", 701: "2", 702: "2", 703: "2", 704: "2", 705: "2", 706: "2", 707: "2", 708: "2", 709: "2", 710: "2", 711: "2", 712: "2", 713: "2", 714: "2", 715: "2", 716: "2", 717: "2", 718: "2", 719: "2", 720: "3", 721: "2", 722: "2", 723: "2", 724: "3", 725: "2", 726: "2", 727: "2", 728: "2", 755: "2", 756: "2", 757: "2", 758: "2", 759: "2", 760: "2", 749: "2", 750: "2", 751: "2", 752: "2", 753: "2", 754: "2", 729: "2", 730: "2", 731: "2", 732: "2", 733: "2", 734: "2", 735: "2", 736: "2", 737: "2", 738: "2", 739: "2", 740: "2", 741: "2", 742: "2", 743: "2", 744: "2", 745: "2", 746: "2", 747: "2", 748: "2", 761: "2", 762: "2", 763: "2", 764: "2", 765: "2", 1239: "3", 1240: "2", 1241: "2", 1242: "2", 1243: "2", 1244: "2", 1245: "2", 1246: "2", 1247: "2", 1248: "2", 1249: "2", 1250: "2", };var opt_list = [20,194,152,153,154,157,156,155,158,256]; var more_txt = [], less_txt = [], optTmp = [], isStock = 0; var sid = '314'; var url = 'https://gwp.brweb.pl/i/314/'; var selcolor = '#777777'; var imgLimit = '8'; var moreLabel = '+'; var lessLabel = '-'; var showMLcnt = 1; var prevMopen = ''; 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 += '
'; 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 += '
'; 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();