gwpNo = {6829: "5", 6830: "3", 6831: "3", 6827: "3", 6826: "3", 6825: "3", 6816: "3", 6817: "3", 6818: "5", 6819: "3", 6820: "3", 6821: "3", 6822: "3", 6823: "3", 6824: "3", 6828: "3", 160: "3", 161: "2", 162: "2", 243: "2", 244: "2", 245: "2", 246: "2", 247: "2", 248: "2", 249: "2", 250: "2", 251: "2", 252: "2", 253: "2", 254: "2", 255: "2", 3193: "1", 3194: "2", 3195: "2", 359: "2", 360: "2", 361: "3", 362: "2", 363: "2", 364: "2", 365: "2", 366: "2", 367: "2", 368: "2", 369: "3", 370: "2", 371: "2", 3196: "2", 3197: "2", 3198: "2", 410: "2", 411: "2", 412: "2", 413: "2", 414: "2", 415: "2", 416: "2", 417: "2", 418: "2", 419: "2", 420: "2", 421: "2", 3202: "2", 3203: "2", 3204: "2", 4499: "2", 494: "2", 495: "2", 496: "2", 497: "2", 498: "2", 499: "2", 500: "2", 501: "2", 502: "2", 503: "2", 504: "2", 505: "2", 506: "2", 3205: "2", 3207: "2", 3206: "2", 517: "2", 518: "2", 519: "2", 520: "2", 521: "2", 522: "2", 523: "2", 524: "2", 525: "2", 526: "2", 527: "2", 528: "2", 529: "2", 3208: "2", 3209: "2", 3210: "2", 587: "2", 588: "2", 589: "2", 590: "2", 594: "2", 593: "2", 592: "2", 591: "2", 596: "2", 595: "2", 597: "2", 598: "2", 599: "2", 3211: "2", 3212: "2", 3213: "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", 3220: "2", 3221: "2", 3222: "2", 740: "2", 741: "2", 742: "2", 743: "2", 747: "2", 751: "2", 3219: "2", 746: "2", 750: "2", 745: "2", 744: "2", 749: "2", 748: "2", 3218: "2", 3217: "2", 752: "2", 1023: "2", 1024: "2", 1025: "2", 1026: "2", 1027: "2", 1028: "2", 1029: "2", 1030: "2", 1031: "2", 1032: "2", 1033: "2", 1034: "2", 1035: "2", 3214: "2", 3215: "2", 3216: "2", 2135: "2", 2953: "2", 2954: "2", 2955: "2", 2956: "2", 2957: "2", 2958: "2", 2959: "2", 2960: "2", 2961: "2", 2962: "2", 2963: "2", 2964: "2", 3199: "2", 3200: "2", 3201: "2", 2151: "2", 2965: "2", 2966: "2", 2967: "2", 2968: "2", 2969: "2", 2970: "2", 2971: "2", 2972: "2", 2973: "2", 2974: "2", 2975: "2", 2976: "2", 3190: "2", 3191: "2", 3192: "2", 3956: "2", 3957: "2", 3958: "2", 3959: "2", 3960: "2", 3961: "2", 3962: "2", 3963: "2", 3964: "2", 3965: "2", 3966: "3", 3967: "2", 3968: "2", 3969: "2", 3970: "2", 3971: "2", 4989: "2", 4990: "4", 4991: "4", 4992: "2", 4993: "2", 4994: "2", 4995: "2", 4996: "2", 4997: "2", 4999: "2", 4998: "2", 5000: "2", 5001: "2", 5002: "2", 5003: "3", 5004: "2", 130: "2", 131: "2", 132: "4", 133: "2", 134: "2", 135: "2", 136: "2", 137: "2", 138: "2", 139: "2", 140: "2", 141: "2", 142: "2", 3187: "2", 3188: "2", 3189: "2", 163: "1", 164: "1", 165: "1", 166: "1", 168: "1", 169: "1", 170: "1", 171: "1", 172: "1", 167: "3", 176: "1", 178: "1", 175: "1", 177: "1", 181: "1", 173: "1", 174: "1", 179: "1", 180: "1", 182: "1", 183: "1", 184: "1", 185: "1", 186: "1", 187: "1", 188: "1", 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", 206: "1", 207: "1", 208: "1", 209: "1", 210: "1", 211: "1", 212: "1", 213: "1", 3552: "1", 3551: "1", 3548: "1", 3255: "1", 1007: "1", 1530: "1", 1531: "1", 1532: "1", 3046: "1", 3047: "1", 3048: "1", 3049: "1", 3094: "1", 3253: "1", 3254: "1", 3545: "1", 3543: "1", 3544: "1", 3553: "1", 3547: "1", 3550: "1", 3546: "1", 216: "1", 217: "1", 218: "1", 219: "1", 220: "1", 221: "1", 222: "1", 223: "1", 224: "1", 225: "1", 226: "1", 227: "1", 228: "1", 229: "1", 230: "1", 231: "1", 232: "1", 233: "1", 234: "1", 235: "1", 236: "1", 237: "1", 238: "1", 239: "1", 241: "1", 242: "1", 214: "1", 215: "1", 3549: "2", 7558: "1", 7525: "3", 7526: "3", 7527: "1", 7528: "1", 7529: "1", 7688: "2", 7690: "2", 7691: "1", };var opt_list = [249,37,46,48,54,58,75,86,97,102,129,138,166,180,31,355,357]; var more_txt = [], less_txt = [], optTmp = [], isStock = 0; var sid = '241'; var url = 'https://gwp.brweb.pl/i/241/'; var selcolor = '#07B88C'; 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();