gwpNo = {141: "0", 142: "0", 143: "0", 144: "0", 176: "0", 177: "0", 178: "0", 179: "0", 180: "0", 181: "0", 182: "0", 183: "0", 184: "0", 185: "0", 186: "0", 187: "0", 188: "0", 189: "0", 190: "0", 191: "0", 192: "0", 193: "0", 194: "0", 195: "0", 196: "0", 197: "0", 198: "0", 199: "0", 200: "0", 201: "0", 202: "0", 203: "0", 204: "0", 205: "0", 206: "0", 207: "0", 208: "0", 209: "0", 210: "0", 211: "0", 212: "0", 213: "0", 214: "0", 215: "0", 216: "0", 217: "0", 262: "0", 263: "0", 264: "0", 265: "0", 266: "0", 267: "0", 268: "0", 269: "0", 270: "0", 271: "0", 272: "0", 273: "0", 274: "0", 275: "0", 276: "0", 277: "0", 278: "0", 279: "0", 280: "0", 281: "0", 282: "0", 283: "0", 284: "0", 285: "0", 286: "0", 287: "0", 288: "0", 289: "0", 290: "0", 291: "0", 292: "0", 293: "0", 294: "0", 295: "0", 296: "0", 297: "0", 298: "0", 299: "0", 300: "0", 301: "0", 302: "0", 303: "0", 306: "0", 307: "0", 308: "0", 309: "0", 310: "0", 311: "0", 312: "0", 313: "0", 314: "0", 315: "0", 316: "0", 317: "0", 318: "0", 319: "0", 320: "0", 321: "0", 322: "0", 323: "0", 324: "0", 325: "0", 326: "0", 330: "0", 331: "0", 332: "0", 333: "0", 334: "0", 335: "0", 336: "0", 337: "0", 338: "0", 339: "0", 340: "0", 341: "0", 342: "0", 343: "0", 344: "0", 345: "0", 346: "0", 347: "0", 348: "0", 349: "0", 350: "0", 351: "0", 352: "0", 353: "0", 354: "0", 355: "0", 356: "0", 357: "0", 358: "0", 359: "0", 360: "0", 361: "0", 362: "0", 363: "0", 364: "0", 365: "0", 366: "0", 367: "0", 368: "0", 369: "0", 370: "0", 371: "0", 406: "0", 407: "0", 408: "0", 410: "0", 411: "0", 409: "0", 395: "0", 398: "0", 399: "0", 400: "0", 396: "0", 397: "0", 433: "1", 434: "1", 435: "1", 436: "1", 437: "1", 438: "1", 439: "1", 440: "1", 441: "1", 442: "1", 443: "1", 444: "1", 445: "1", 446: "1", 447: "1", 448: "1", 449: "1", 450: "1", 451: "1", 452: "1", 453: "1", 475: "1", 476: "1", 477: "1", 478: "1", 479: "1", 480: "1", 481: "1", 482: "1", 483: "1", 484: "1", 485: "1", 486: "2", 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: "1", 503: "1", 504: "1", 505: "1", 506: "1", 507: "1", 508: "1", 509: "1", 510: "1", 511: "1", 512: "1", 513: "1", 514: "1", 515: "1", 516: "1", 517: "1", 518: "1", 519: "1", 520: "1", 521: "1", 522: "1", 523: "1", 524: "1", 525: "1", 526: "1", 527: "1", 528: "1", 529: "1", 530: "1", 531: "1", 532: "1", 533: "1", 534: "1", 535: "1", 536: "1", 537: "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", 384: "1", 385: "1", 386: "1", 387: "1", 388: "1", 389: "1", 390: "1", 391: "1", 392: "1", 412: "1", 413: "1", 414: "1", 415: "1", 416: "1", 417: "1", 418: "1", 419: "1", 420: "1", 421: "1", 422: "1", 423: "1", 424: "1", 425: "1", 426: "1", 427: "1", 428: "1", 429: "1", 430: "1", 431: "1", 432: "1", 538: "1", 539: "1", 541: "1", 540: "1", 542: "1", 543: "1", 544: "1", 545: "1", 546: "1", 547: "1", 548: "1", 549: "1", 550: "1", 551: "1", 552: "1", 553: "1", 554: "1", 555: "2", 556: "1", 700: "1", 701: "1", 702: "1", 703: "1", 704: "2", 705: "1", 706: "1", 707: "1", 708: "1", 709: "1", 710: "1", 711: "1", 712: "1", 713: "1", 714: "1", 715: "1", 716: "1", 717: "1", 718: "1", 719: "1", 720: "1", 721: "1", 722: "1", 723: "1", 724: "1", 725: "1", 726: "1", 727: "1", 728: "1", 729: "1", 730: "1", 731: "1", 732: "1", 733: "1", 734: "1", 735: "1", 736: "1", 737: "1", 738: "1", 739: "1", 740: "1", 741: "1", 742: "1", 743: "1", 744: "1", 745: "1", 746: "1", 747: "1", 748: "1", 749: "1", 750: "1", 751: "1", 752: "1", 753: "1", 754: "1", 755: "1", 756: "1", 757: "1", 758: "1", 759: "1", 760: "1", 761: "1", 762: "1", 763: "1", 764: "1", 765: "1", 766: "1", 767: "1", 768: "1", 769: "1", 770: "1", 771: "1", 772: "1", 773: "1", 774: "1", 775: "1", 776: "1", 777: "1", 778: "1", 779: "1", 780: "1", 781: "1", 782: "1", 783: "1", 787: "1", 786: "1", 788: "1", 789: "1", 790: "1", 791: "1", 792: "1", 793: "1", 794: "1", 795: "1", 796: "1", 797: "1", 798: "1", 799: "1", 800: "1", 801: "1", 869: "1", 841: "1", 842: "1", 843: "1", 845: "1", 846: "1", 847: "1", 848: "1", 849: "1", 850: "1", 852: "1", 853: "1", 854: "1", 855: "1", 856: "1", 857: "1", 858: "1", 859: "1", };var opt_list = [77,78,82,83,87,90,91,97,100,102,103,104,98,92,105,106,134,135,136,137,139,152]; var more_txt = [], less_txt = [], optTmp = [], isStock = 0; var sid = '105'; var url = 'https://gwp.brweb.pl/i/105/'; var selcolor = '#236ADB'; 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] = 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();