gwpNo = {13: "1", 14: "1", 15: "1", 16: "1", 49: "2", 50: "1", 51: "1", 52: "2", 53: "1", 54: "1", 55: "1", 56: "1", 57: "1", 58: "1", 59: "1", 60: "3", 61: "2", 63: "5", 62: "2", 64: "8", 65: "1", 66: "1", 71: "1", 67: "1", 69: "1", 70: "1", 73: "1", 74: "3", 75: "2", 79: "1", 78: "1", 77: "1", 76: "1", 80: "1", 81: "1", 82: "2", 83: "9", 85: "1", 86: "1", 87: "1", 88: "1", 89: "1", 84: "6", 90: "1", 92: "2", 93: "1", 94: "1", 95: "1", 96: "1", 97: "1", 98: "1", 100: "2", 101: "1", 102: "1", 103: "1", 104: "1", 105: "1", 106: "2", 107: "2", 108: "2", 109: "1", 110: "1", 111: "2", 112: "1", 113: "1", 114: "1", 115: "1", 116: "6", 117: "1", 118: "1", 119: "1", 120: "1", 121: "1", 122: "1", 123: "1", 124: "1", 125: "1", 126: "1", 127: "1", 128: "1", 129: "1", 130: "1", 131: "1", 132: "1", 133: "1", 136: "1", 134: "1", 135: "1", 137: "1", 138: "1", 139: "1", 140: "1", 141: "1", 142: "1", 143: "1", 144: "1", 145: "1", 146: "1", 147: "2", 148: "2", 149: "2", 150: "2", 151: "2", 152: "1", 153: "1", 154: "2", 155: "1", 156: "1", 157: "1", 159: "4", 158: "4", 160: "1", 161: "1", 162: "1", 163: "5", 164: "1", 165: "5", 166: "3", 173: "2", 174: "2", 175: "3", 184: "1", 185: "1", 186: "1", 187: "1", 188: "1", 189: "1", 193: "1", 191: "1", 194: "1", 192: "1", 196: "2", 195: "1", 198: "1", 197: "1", 199: "1", 202: "1", 200: "1", 201: "1", 203: "1", 204: "1", 205: "1", 206: "1", 211: "1", 212: "1", 213: "1", 218: "1", 217: "1", 223: "1", 222: "1", 244: "4", 250: "1", 251: "1", 252: "1", 253: "1", 254: "1", 255: "1", 256: "1", 257: "1", 258: "2", 259: "1", 242: "1", 243: "1", 245: "1", 260: "1", 261: "1", 262: "1", 263: "1", 264: "1", 265: "1", 266: "1", 267: "1", 268: "1", 269: "1", 270: "1", 272: "1", 273: "1", 274: "1", 275: "1", 284: "1", 285: "1", 286: "1", 287: "1", 288: "1", 293: "1", 294: "1", 295: "1", 296: "1", 297: "1", 298: "1", 299: "1", 300: "1", 301: "1", 302: "1", 303: "1", 304: "1", 305: "1", 311: "1", 312: "1", 309: "1", 310: "1", 313: "1", 314: "1", 315: "1", 316: "1", 317: "1", 318: "1", 319: "1", 320: "1", 321: "2", 322: "1", 323: "1", 324: "1", 325: "1", 326: "1", 327: "1", 328: "1", 329: "1", 330: "1", 331: "1", 332: "1", 333: "1", 334: "1", 335: "1", 336: "1", 337: "1", 338: "1", 339: "1", 340: "1", 341: "1", 342: "1", 343: "1", 344: "1", 345: "1", 346: "1", 347: "1", 348: "1", 349: "1", 350: "1", 351: "1", 365: "2", 366: "1", 367: "1", 368: "1", 369: "1", 370: "1", 371: "1", 372: "1", 373: "1", 374: "1", 375: "1", 376: "1", 377: "1", 378: "1", 379: "1", 380: "1", 381: "1", 382: "1", 383: "1", 399: "1", 400: "1", 401: "1", 402: "1", 397: "1", 398: "1", 403: "1", 404: "1", 411: "1", 412: "1", 413: "3", 405: "2", 406: "1", 407: "1", 408: "4", 409: "1", 410: "1", 414: "2", 415: "1", 416: "1", 417: "1", 418: "1", 419: "1", 420: "1", 424: "1", 425: "1", 426: "1", 427: "2", 428: "1", 364: "1", 440: "1", 441: "2", 442: "1", 443: "1", 444: "1", 445: "2", 446: "1", 447: "1", 448: "1", 449: "1", 450: "1", 451: "1", 452: "1", 453: "1", 455: "1", 454: "1", 456: "1", 457: "1", 458: "1", 459: "1", 460: "1", 461: "1", 462: "1", 463: "1", 464: "1", 475: "1", 476: "1", 477: "1", 478: "1", 483: "1", 484: "1", 485: "1", 486: "1", 487: "1", 488: "1", 489: "1", 490: "1", 491: "1", 492: "1", 493: "1", 494: "1", 495: "1", 496: "1", 497: "1", 498: "1", 499: "1", 500: "1", 501: "1", 502: "2", 506: "1", 505: "1", 503: "1", 504: "1", 517: "1", 518: "1", 519: "1", 514: "1", 515: "1", 516: "1", 520: "1", 521: "1", 522: "1", 523: "1", 524: "1", 525: "1", 526: "1", 533: "1", 534: "1", 535: "1", 536: "1", 537: "1", 538: "1", 540: "1", 541: "1", 539: "1", 542: "1", 543: "1", 544: "1", 545: "1", 479: "1", 480: "1", 481: "1", 482: "1", 546: "1", 547: "1", 548: "1", 549: "1", };var opt_list = [2,12,13,14,15,16,17,18,19,20,21,22,23,24,25,27,28,29,30,31,32,33,34,35,36,37,38,39,40,43,44,45,46,50,54,55,56,57,58,59,60,63,65,67,70,71,72,73,74,75,76,77,78,79,80,82,83,84,85,86,89,88,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,114,115,116,117,118,119,120,121,123,124,127,128,129,130,131,132,135,137,138,139,140,141,142,143,144,147,148,149,150,153,152,154,155,156,134,136,157]; var more_txt = [], less_txt = [], optTmp = [], isStock = 0; var sid = '243'; var url = 'https://gwp.brweb.pl/i/243/'; var selcolor = '#0CCF40'; var imgLimit = '6'; 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 += '
'; 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 += '
'; 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();