gwpNo = {63: "3", 64: "3", 65: "2", 66: "1", 67: "1", 96: "1", 116: "1", 124: "1", 138: "1", 180: "2", 181: "1", 349: "4", 350: "2", 351: "2", 352: "2", 353: "1", 354: "1", 355: "1", 356: "1", 309: "1", 310: "1", 311: "1", 312: "1", 313: "1", 314: "1", 316: "1", 315: "1", 317: "1", 357: "1", 358: "1", 359: "2", 364: "6", 365: "1", 366: "1", 367: "1", 368: "1", 369: "1", 370: "1", 371: "1", 372: "1", 373: "1", 376: "3", 375: "1", 377: "2", 387: "1", 388: "1", 391: "2", 392: "6", 394: "3", 396: "2", 397: "1", 393: "1", 395: "2", 398: "1", 399: "1", 400: "2", 401: "2", 402: "1", 403: "1", 404: "1", 405: "1", 406: "1", 407: "1", 408: "1", 409: "1", 410: "1", 412: "1", 414: "1", 411: "1", 413: "1", 415: "1", 418: "2", 419: "2", 417: "1", 416: "5", 420: "1", 421: "1", 422: "1", 423: "1", 424: "1", 425: "1", 427: "1", 428: "1", 429: "1", 430: "1", 431: "1", 432: "1", 433: "1", 434: "1", 435: "1", 436: "1", 437: "1", 439: "1", 440: "1", 441: "1", 442: "1", 443: "1", 444: "1", 446: "1", 447: "2", 448: "1", 449: "1", 450: "1", 451: "2", 453: "1", 454: "1", 455: "1", 456: "1", 457: "1", 458: "1", 452: "1", 459: "1", 460: "1", 461: "1", 462: "1", 463: "1", 464: "1", 465: "1", 466: "2", 467: "1", 468: "1", 469: "1", 470: "2", 471: "2", 472: "2", 473: "2", 474: "2", 480: "1", 481: "1", 475: "1", 476: "1", 477: "1", 478: "1", 479: "1", 482: "2", 487: "1", 488: "1", 489: "1", 491: "2", 490: "1", 492: "1", 493: "1", 496: "1", 497: "1", 498: "1", 499: "1", 501: "1", 502: "1", 503: "1", 504: "1", 505: "1", 506: "1", 507: "1", 508: "2", 509: "1", 510: "1", 513: "1", 514: "1", 515: "1", 516: "1", 517: "1", 518: "1", 519: "1", 520: "1", 521: "1", 522: "1", 523: "1", 525: "1", 526: "1", 524: "1", 527: "1", 528: "1", 529: "1", 530: "1", 531: "1", 532: "1", 533: "1", 534: "1", 535: "1", 536: "1", 537: "1", 538: "1", 539: "1", 542: "1", 541: "1", 545: "1", 546: "1", 547: "1", 548: "1", 550: "1", 549: "1", 551: "1", 552: "1", 553: "1", 554: "1", 555: "1", 556: "1", 557: "1", 558: "1", 559: "1", 560: "1", 561: "1", 562: "1", 563: "1", 564: "1", 565: "1", 567: "1", 566: "1", 568: "1", 569: "1", 570: "1", 571: "1", 572: "1", 573: "1", 574: "1", 483: "1", 485: "1", 486: "1", 484: "1", 575: "1", 576: "1", 578: "2", 579: "1", 580: "1", 581: "1", 582: "1", 583: "1", 584: "1", 585: "1", 586: "2", 587: "1", 588: "1", 589: "1", 593: "1", 590: "1", 592: "1", 591: "1", 594: "2", 595: "2", 596: "1", 598: "1", 605: "1", 608: "1", 609: "1", 610: "1", 611: "1", 612: "1", 613: "1", 614: "1", 615: "1", 616: "1", 617: "1", 618: "1", 630: "1", 631: "1", 632: "1", 633: "1", 634: "1", 635: "1", 636: "1", 637: "1", 638: "1", 639: "2", 640: "1", 641: "1", 642: "1", 643: "1", 644: "1", 646: "1", 645: "1", 647: "1", 648: "1", 649: "1", 650: "1", 652: "1", 651: "1", 653: "1", 654: "1", 655: "1", 656: "1", 657: "1", 658: "1", 659: "1", 660: "1", 661: "1", 662: "1", 663: "1", 664: "1", 665: "1", 666: "1", 667: "1", 668: "1", 669: "1", 670: "1", 671: "1", 672: "1", 673: "1", 674: "1", 675: "1", 678: "1", 679: "1", 682: "1", 683: "1", 684: "1", 685: "1", 686: "1", 687: "1", 688: "1", 689: "1", 690: "1", 691: "1", 692: "1", 693: "1", 694: "1", 695: "1", 696: "1", 697: "1", 698: "1", 699: "1", 700: "1", 701: "1", 702: "1", 703: "1", 704: "1", 705: "1", 706: "1", 707: "1", 708: "1", 709: "1", 710: "1", 711: "1", 712: "1", 713: "1", 761: "1", 762: "1", 763: "1", 764: "1", 765: "1", 766: "1", 767: "1", 768: "1", 769: "1", 770: "1", 852: "1", 771: "1", 772: "1", 778: "1", 782: "2", 783: "1", 784: "1", 785: "1", 786: "1", 853: "1", 854: "1", 855: "1", 856: "1", 857: "1", 858: "1", 859: "1", 860: "1", 861: "1", 862: "1", 863: "1", 864: "1", 865: "1", 866: "1", 867: "1", 868: "1", 869: "1", 870: "1", 871: "1", 872: "1", 873: "1", 874: "1", 875: "1", 876: "1", 877: "1", 878: "1", 879: "1", 880: "1", 881: "1", 882: "1", 883: "1", 886: "1", 887: "1", 888: "1", 889: "1", 890: "1", 891: "1", 892: "1", 893: "1", 894: "1", 895: "1", 896: "1", 902: "1", 903: "1", 904: "1", 905: "1", 906: "1", 907: "1", 908: "1", 909: "1", 910: "1", 911: "1", 912: "1", 947: "1", 948: "1", 952: "1", 953: "1", 954: "1", 955: "1", 956: "1", 957: "1", 958: "1", 961: "1", 962: "1", 963: "2", 964: "1", 965: "1", 966: "1", };var opt_list = [46,92,93,95,98,102]; var more_txt = [], less_txt = [], optTmp = [], isStock = 0; var sid = '222'; var url = 'https://gwp.brweb.pl/i/222/'; var selcolor = '#edab4a'; var imgLimit = '4'; 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 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 += '
'; 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') { 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();