gwpNo = {88: "2", 77: "2", 78: "2", 79: "3", 80: "2", 81: "2", 82: "2", 84: "2", 85: "2", 86: "2", 87: "2", 446: "2", 89: "2", 90: "2", 91: "2", 92: "2", 93: "2", 94: "2", 95: "2", 96: "1", 97: "1", 98: "2", 99: "1", 101: "3", 102: "2", 103: "2", 104: "2", 105: "2", 106: "2", 107: "2", 108: "2", 109: "2", 110: "2", 111: "2", 112: "2", 113: "2", 114: "1", 115: "2", 116: "2", 117: "1", 118: "2", 119: "2", 120: "1", 121: "1", 447: "1", 448: "1", 449: "1", 450: "1", 122: "2", 123: "2", 124: "2", 126: "2", 127: "2", 128: "2", 129: "1", 130: "2", 441: "1", 443: "2", 131: "2", 132: "2", 133: "2", 134: "2", 135: "2", 136: "2", 137: "3", 138: "2", 139: "2", 140: "2", 440: "1", 301: "2", 302: "2", 303: "2", 305: "2", 306: "2", 307: "2", 308: "1", 309: "2", 455: "1", 456: "3", 310: "2", 311: "2", 312: "2", 313: "2", 323: "2", 324: "2", 325: "2", 471: "1", 470: "1", 314: "2", 315: "2", 316: "2", 317: "2", 318: "1", 319: "1", 320: "2", 321: "1", 328: "2", 333: "2", 334: "2", 340: "2", 341: "2", 468: "1", 343: "1", 469: "1", 330: "2", 335: "2", 336: "1", 342: "1", 339: "1", 338: "2", 337: "2", 326: "2", 327: "2", 331: "2", 329: "2", 332: "2", 457: "2", 458: "2", 459: "2", 460: "2", 461: "2", 462: "2", 463: "1", 464: "2", 465: "2", 466: "2", 467: "2", 291: "1", 292: "1", 294: "1", 295: "1", 297: "1", 298: "1", 299: "1", 300: "1", 162: "2", 163: "2", 164: "2", 167: "2", 168: "2", 169: "1", 159: "3", 472: "2", 473: "2", 474: "2", 475: "2", 476: "2", 483: "1", 484: "1", 485: "1", 486: "1", 492: "2", 493: "2", 495: "2", 496: "2", 497: "2", 498: "2", 499: "2", 500: "2", 501: "2", 502: "2", 503: "2", 504: "2", 494: "2", 505: "2", 506: "2", 507: "2", 508: "2", 509: "2", 510: "2", 511: "2", 512: "2", 513: "2", 514: "2", 515: "2", 516: "2", 517: "2", 518: "2", 519: "2", 522: "2", 100: "1", 524: "1", 525: "1", 526: "1", 528: "1", 529: "1", 477: "1", };var opt_list = [24,23,25,26,39,40,59,38,30,60,62]; var more_txt = [], less_txt = [], optTmp = [], isStock = 0; var sid = '249'; var url = 'https://gwp.brweb.pl/i/249/'; var selcolor = '#777777'; var imgLimit = '10'; 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();