if (!gwpstyle) { var gwpstyle = document.createElement('style'); gwpstyle.textContent = ' .gwp-div { clear: both; position:relative; } .sm-gwp-img-list { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0px; width: 100%; } .gwp-opt { box-sizing: border-box; text-align: center; border:3px solid transparent; border-bottom: 0px; padding:1px 1px 5px 1px; margin:0px; border-radius:7px; overflow-x:hidden; position: relative; padding-bottom: 20px; } .gwp-opt:hover { border:0px solid #EEEEEE; padding:1px; padding-bottom: 17px; } .gwp-opt-sel { border:2px solid #777777 !important; padding:1px; padding-bottom: 17px; } .gwp-opt-sel:hover { padding:1px; padding-bottom: 17px; } .gwp-opt-name { text-align: center; width: 100%; } .gwp-opt-title { min-height: 1em; padding: 11px 0px; } .gwp-opt-prev { position:relative; } .gwp-opt-prev div { position:absolute; left:-305px; width:300px; display:none; z-index:1000; border:1px solid #bcbcbc; background-color:#FFFFFF; box-shadow:3px 3px 6px #AAAAAA; } .gwp-opt img { cursor:pointer; border-radius:7px; } .gwp-opt-more { position:relative; cursor:pointer; border-radius:7px; border:1px solid #888888; color:#888888; padding-top:100%; } .gwp-opt-more div { font-size:14px; text-align:center; line-height:12px; position:absolute; top:50%; left:0px; width:100%; margin-top:-0.5em; } .gwp-opt-title { font-weight:bold; padding: 0px 20px; display: inline-block; }'; document.head.appendChild(gwpstyle); } gwpNo = {264: "1", 265: "1", 266: "1", 267: "1", 263: "1", 270: "7", 272: "2", 275: "1", 269: "4", 273: "1", 274: "1", 268: "2", 271: "1", 276: "1", 277: "1", 278: "1", 280: "1", 281: "1", 282: "1", 285: "1", 284: "1", 286: "1", 288: "1", 289: "1", 290: "1", 292: "1", 293: "1", 291: "1", 287: "1", 283: "1", 279: "1", 294: "6", 295: "4", 296: "1", 297: "1", 300: "1", 301: "1", 304: "1", 305: "1", 298: "1", 299: "1", 302: "1", 303: "1", 306: "1", 307: "1", 308: "1", 315: "1", 312: "1", 316: "1", 319: "1", 320: "1", 323: "1", 324: "1", 326: "1", 325: "1", 321: "1", 322: "1", 317: "1", 318: "1", 313: "1", 311: "1", 309: "1", 310: "1", 314: "1", 327: "1", 341: "1", 342: "1", 339: "1", 340: "1", 343: "1", 335: "1", 334: "2", 384: "2", 391: "2", 392: "2", 359: "1", 377: "1", 367: "1", 388: "2", 386: "3", 393: "2", 387: "2", 389: "2", 395: "2", 390: "2", 394: "2", 385: "2", 383: "1", 381: "1", 378: "1", 372: "1", 373: "1", 374: "1", 375: "1", 382: "1", 379: "2", 376: "1", 380: "1", 366: "1", 371: "1", 368: "1", 370: "1", 356: "1", 361: "1", 365: "1", 369: "1", 364: "1", 360: "1", 362: "1", 363: "1", 357: "1", 358: "1", 345: "1", 346: "1", 347: "1", 348: "1", 349: "1", 350: "1", 351: "1", 352: "1", 353: "1", 354: "1", 355: "1", 344: "1", 396: "1", 397: "1", 398: "1", 399: "1", 400: "1", 401: "1", 402: "1", 403: "1", 404: "1", 405: "1", 406: "1", 407: "1", 408: "1", 409: "1", 410: "1", 411: "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", 427: "1", 426: "1", 425: "1", 424: "1", 428: "1", 432: "1", 436: "1", 429: "1", 433: "1", 437: "1", 430: "1", 434: "1", 438: "1", 439: "1", 435: "1", 431: "1", 440: "1", 444: "1", 448: "1", 452: "1", 441: "1", 445: "1", 449: "1", 453: "1", 442: "1", 446: "1", 450: "1", 454: "1", 455: "1", 451: "1", 447: "1", 443: "1", 456: "1", 457: "1", 468: "1", 469: "1", 465: "1", 460: "1", 464: "1", 461: "1", 458: "1", 459: "1", 462: "1", 463: "1", 466: "1", 467: "1", 470: "1", 471: "1", 474: "1", 473: "1", 472: "1", 477: "1", 481: "1", 485: "1", 478: "1", 482: "1", 486: "1", 479: "1", 483: "1", 487: "1", 480: "1", 484: "1", 488: "1", 489: "1", 494: "1", 495: "1", 499: "1", 503: "1", 504: "1", 497: "1", 493: "1", 501: "1", 490: "1", 498: "1", 502: "1", 491: "1", 492: "1", 496: "1", 500: "1", 505: "1", 509: "1", 513: "1", 506: "1", 510: "1", 514: "1", 507: "1", 511: "1", 515: "1", 508: "1", 512: "1", 516: "2", 517: "1", 518: "1", 519: "1", 520: "1", 198: "1", 199: "1", 197: "1", 521: "1", 525: "1", 529: "1", 533: "1", 522: "1", 526: "1", 530: "1", 523: "1", 531: "1", 527: "1", 532: "1", 528: "1", 524: "1", 534: "1", 535: "1", 536: "1", 537: "1", 538: "1", 539: "1", 540: "1", 541: "1", 542: "1", 543: "1", 544: "1", 545: "1", 546: "1", 547: "1", 548: "1", 549: "1", 554: "2", 555: "2", 557: "1", 556: "1", 559: "1", 558: "1", 560: "1", 561: "1", 565: "1", 566: "2", 562: "1", 563: "1", 564: "1", 550: "1", 551: "1", 552: "1", 553: "1", 567: "1", 568: "1", 569: "1", 570: "3", 571: "1", 572: "1", 573: "1", 574: "1", 575: "1", 576: "1", 577: "1", 578: "1", 579: "1", 580: "1", 581: "1", 582: "1", 583: "1", 584: "1", 585: "1", 586: "1", 587: "1", 588: "1", 589: "1", 590: "1", 591: "1", 592: "1", 593: "1", 594: "1", 595: "1", 596: "1", 597: "1", 598: "1", 599: "1", 600: "1", 601: "1", 602: "1", 603: "1", 604: "1", 605: "1", 606: "1", 607: "1", 608: "1", 609: "1", 610: "1", 611: "1", 612: "1", 613: "2", 614: "2", 615: "1", 616: "1", 617: "1", 618: "1", 619: "1", 620: "1", 621: "1", 622: "1", 623: "1", 624: "1", 625: "1", 626: "1", 627: "1", 628: "1", 629: "1", 630: "1", 631: "1", 632: "1", 633: "1", 634: "1", 635: "1", 636: "1", 637: "1", 638: "1", 639: "1", 640: "1", 641: "1", 642: "1", 643: "1", 646: "1", 647: "1", 644: "1", 648: "1", 645: "1", 649: "1", 652: "1", 656: "1", 660: "1", 664: "1", 668: "1", 653: "1", 657: "1", 661: "1", 665: "1", 669: "1", 670: "1", 666: "1", 662: "1", 667: "1", 663: "1", 650: "1", 654: "1", 658: "1", 651: "1", 655: "1", 659: "1", 672: "1", 673: "1", 674: "1", 675: "1", 676: "1", 677: "1", 678: "1", 679: "1", 680: "1", 681: "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: "2", 712: "1", 713: "1", 714: "1", 715: "1", 716: "1", 717: "1", 718: "1", 719: "1", 720: "1", 721: "1", 722: "1", 671: "1", 723: "1", 726: "1", 724: "1", 725: "1", 728: "1", 729: "1", 735: "1", 734: "1", 738: "1", 739: "1", 736: "1", 733: "1", 732: "1", 737: "1", 744: "1", 740: "1", 741: "1", 745: "1", 746: "1", 742: "1", 743: "1", 731: "1", 727: "1", 730: "1", 747: "1", 748: "2", 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", 764: "1", 765: "1", 768: "1", 769: "1", 762: "1", 763: "1", 766: "1", 767: "1", 770: "1", 771: "1", 772: "1", 773: "1", 784: "1", 780: "1", 776: "1", 777: "1", 781: "1", 774: "1", 775: "1", 778: "1", 779: "1", 782: "1", 783: "1", 786: "1", 787: "1", 785: "1", 788: "1", 789: "1", 790: "1", 793: "1", 794: "1", 797: "1", 798: "1", 791: "1", 795: "1", 792: "1", 796: "1", 800: "1", 799: "1", 801: "1", 802: "1", 810: "1", 809: "1", 805: "1", 806: "1", 813: "1", 814: "1", 803: "1", 807: "1", 808: "1", 804: "1", 811: "1", 812: "1", 815: "1", 816: "1", 817: "2", 818: "1", 819: "1", 820: "1", 821: "1", 825: "1", 829: "1", 830: "1", 826: "1", 822: "1", 823: "1", 827: "1", 831: "1", 824: "1", 828: "1", 832: "1", 833: "1", 837: "1", 834: "1", 838: "1", 835: "1", 836: "1", 839: "1", 840: "1", 841: "1", 842: "1", 843: "1", 844: "1", 845: "1", 846: "1", 847: "1", 848: "1", 849: "1", 850: "1", 851: "1", 852: "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", 884: "1", 885: "1", 886: "1", 887: "1", 888: "1", 889: "1", 890: "1", 891: "1", 892: "1", 893: "1", 894: "1", 895: "1", 896: "1", 897: "1", 898: "1", 899: "1", 900: "1", 901: "1", 903: "1", 904: "1", 905: "1", 902: "1", 906: "1", 907: "1", 908: "1", 909: "1", 910: "1", 911: "1", 912: "1", 913: "1", 914: "1", 328: "1", 329: "1", 919: "1", 923: "1", 918: "1", 922: "1", 926: "1", 925: "1", 921: "1", 917: "1", 916: "1", 920: "1", 924: "1", 927: "1", 928: "1", 931: "1", 932: "1", 935: "1", 936: "1", 939: "1", 940: "1", 930: "1", 934: "1", 937: "1", 933: "1", 929: "1", 938: "1", 915: "1", 942: "1", 945: "1", 946: "1", 949: "1", 950: "1", 953: "1", 954: "1", 943: "1", 944: "1", 947: "1", 948: "1", 951: "1", 952: "1", 955: "1", 956: "1", 957: "1", 961: "1", 965: "1", 970: "1", 969: "1", 958: "1", 962: "1", 966: "1", 959: "1", 960: "1", 963: "1", 964: "1", 967: "1", 968: "1", 971: "1", 972: "1", 973: "1", 977: "1", 981: "1", 985: "1", 974: "1", 978: "1", 982: "1", 986: "1", 975: "1", 979: "1", 983: "1", 987: "1", 976: "1", 980: "1", 984: "1", 988: "1", 989: "1", 990: "1", 941: "1", 171: "1", 172: "1", 992: "1", 991: "1", 1000: "1", 1001: "1", 1002: "1", 1003: "1", 1004: "1", 1005: "1", 1006: "1", 1007: "1", 1008: "1", 1009: "1", 1010: "1", 1011: "1", 1012: "1", 1013: "1", 1014: "1", 1015: "1", 1018: "1", 1019: "1", 1022: "1", 1023: "1", 1021: "1", 1017: "1", 1016: "1", 1020: "1", 1024: "1", 1025: "1", 1027: "1", 1028: "1", 1029: "1", 1030: "1", 1031: "1", 1032: "1", 1033: "1", 1034: "1", 1035: "1", 1036: "1", 1037: "1", 1038: "1", 1039: "1", 1040: "1", 1041: "1", 1042: "1", 1043: "1", 1044: "1", 1045: "1", 1046: "1", 1047: "1", 1048: "1", 1049: "1", 1050: "1", 1051: "1", 1052: "1", 1053: "1", 1054: "1", 1026: "1", 1055: "1", 1056: "1", 1057: "1", 1058: "1", 1059: "1", 1060: "1", 1061: "1", 1062: "1", 1063: "1", 1064: "1", 1065: "1", 1066: "1", 1067: "1", 1068: "1", 1069: "1", 1070: "1", 1071: "1", 1072: "1", 1073: "1", 1074: "1", 1075: "1", 1076: "1", };var opt_list = [78,79,80,81,82,86,87,88,90,91,60,92,93,94,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,83,113,114,45,115,118,119,120,121,122,123,124,125,126,127,128,129,130,131]; var more_txt = [], less_txt = [], optTmp = [], optTmpVal = [], isStock = 0; var changeStock = 0; var sid = '468'; var url = 'https://gwp.brweb.pl/i/468/'; var imgLimit = '25'; var moreLabel = '+'; var lessLabel = '-'; var showMLcnt = 1; var prevMopen = ''; var selectLangVal = ['','wybierz','choose','wählen','Vybrat','vali','izvēlēties','pasirinkti','választ','vyberte si','вибрати']; function showPrev(e) { if (window.innerWidth < 700) return null; var id = e.id; var aId = id.split('__'); var aSO = aId[0].split('_'); var soptid = aSO[1]; var pid = soptid; var prev_div = document.getElementById('gwp_div_preview_'+pid); prev_div.style.display = 'block'; prev_div.innerHTML = ''; setTimeout(movePrev,10,pid); } function hidePrev(e) { if (window.innerWidth < 700) return null; var id = e.id; var aId = id.split('__'); var aSO = aId[0].split('_'); var soptid = aSO[1]; var pid = soptid; var prev_div = document.getElementById('gwp_div_preview_'+pid); prev_div.style.display = 'none'; prev_div.innerHTML = ''; prev_div.style.top = '0px'; } function movePrev(pid) { var prev_div = document.getElementById('gwp_div_preview_'+pid); var imgH = prev_div.getElementsByTagName('IMG')[0]; if (!imgH) { setTimeout(movePrev,10,pid); return false; } const recti = imgH.getBoundingClientRect(); if (recti.height == 0) { setTimeout(movePrev,10,pid); return false; } var hcorr = (recti.top + recti.height - window.innerHeight + 20) * -1; hcorr = (hcorr < 0 ? hcorr : 0); if (recti.top < 20) { hcorr = (recti.top + hcorr - 20) * -1; } if (recti.top > 20 && recti.height + 40 > window.innerHeight) { hcorr = (recti.top - 20) * -1; } prev_div.style.top = hcorr + 'px'; } function oClick(e,type) { if (type == 'S') { selectClick(e); } else { radioClick(e); } setTimeout(showGWP,500); } function setValToInput(optInput,optValue) { if (optInput) { optInput.value = optValue; } else { setTimeout(function() { setValToInput(optInput,optValue); }, 500); } } function selectClick(e) { var id = e.id; var aId = id.split('__'); var srl = document.getElementsByName(aId[0]); var sr = null; var optInput = null; var optValue = null; for( var k = 0; k < srl.length; k++){ if (srl[k].tagName == 'H-DROPDOWN-CONTENT') { sr = srl[k]; } if (srl[k].tagName == 'INPUT') { optInput = srl[k]; } } if (sr == null) { srl[1].click(); setTimeout(function() { selectClick(e); }, 500); return false; } sr = document.getElementsByTagName('H-OPTION'); for( var k = 0; k < sr.length; k++){ if (sr[k].value == aId[1]) { sr[k].click(); optValue = aId[1]; setValToInput(optInput,optValue); var aSO = aId[0].split('_'); var soptid = aSO[1]; if (document.getElementById('gwp_div_title_'+soptid)) document.getElementById('gwp_div_title_'+soptid).innerHTML = e.title; } } var c = document.getElementsByClassName('c_' + aId[0]); for( var i = 0; i < c.length; i++){ c[i].parentElement.className = c[i].parentElement.className.replace(' gwp-opt-sel'); if ( c[i].id == id ) { c[i].parentElement.className = c[i].parentElement.className + ' gwp-opt-sel'; } } } function radioClick(e) { var id = e.id; var aId = id.split('__'); document.getElementById(aId[0].replaceAll('_','-')+'-'+aId[1]).click(); var aSO = aId[0].split('_'); var soptid = aSO[1]; if (document.getElementById('gwp_div_title_'+soptid)) document.getElementById('gwp_div_title_'+soptid).innerHTML = e.title; var c = document.getElementsByClassName('c_' + aId[0]); for( var i = 0; i < c.length; i++){ c[i].parentElement.className = c[i].parentElement.className.replace(' gwp-opt-sel',''); if ( c[i].id == id ) c[i].parentElement.className = c[i].parentElement.className + ' gwp-opt-sel'; } } 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 = (h[i].className == 'gwp-opt gwpHidden'+oid+' gwp-opt-sel') ? 'block' : type; } document.getElementById('gwp_more'+oid).innerHTML = type == 'block' ? less_txt[oid] : more_txt[oid] ; } function showGWP() { var isLoading = 0; var isDiff = 0; opt_list.forEach(function(opt_id) { var pv = document.getElementsByTagName('product-variants')[0]; var radiov = ''; var srl = document.getElementsByName('option_'+opt_id); if (pv && srl.length == 0) { radiov = '_'+pv.getAttribute("product-instance-key"); srl = document.getElementsByName('option_'+opt_id+radiov); } if (srl.length == 0) { return; } var optValue = ''; var sr = null; if (srl[0].tagName == 'H-DROPDOWN') { srl[0].style.display = 'none'; var smain = srl[0].parentElement.parentElement.parentElement.parentElement; for( var k = 0; k < srl.length; k++){ if (srl[k].tagName == 'H-DROPDOWN-CONTENT') { sr = srl[k]; } if (srl[k].tagName == 'INPUT') { optValue = srl[k].value; } } if (sr == null) { srl[1].click(); setTimeout(function() { var srl = document.getElementsByName('option_'+opt_id); for( var k = 0; k < srl.length; k++){ if (srl[k].tagName == 'H-DROPDOWN-CONTENT') { sr = srl[k]; } if (srl[k].tagName == 'INPUT') { optValue = srl[k].value; } } }, 500); } var optType = 'S'; var s = sr; var c = sr.getElementsByTagName('h-option'); } else { var optType = 'R'; var s = srl[0].parentElement.parentElement.parentElement.parentElement; var smain = srl[0].parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement; if (sid == 388) { s = srl[0].parentElement.parentElement.parentElement.parentElement.parentElement; smain = srl[0].parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement; } s.parentElement.style.display = 'none'; var c = srl; for( var j = 0; j < c.length; j++){ if (c[j].checked == true) { optValue = c[j].dataset.userValue; } } } isDiff = (!optTmp[opt_id] || optTmp[opt_id] != s.innerHTML || optTmpVal[opt_id] != s.value) ? 1 : 0; if (smain.getAttribute("stock-order") > 0 && smain.className.indexOf('loading') != -1) { isLoading++; } if (isDiff == 1 || changeStock == 1) { var sOptions = '', sPreview = '', sTitle = ''; var imgNo = 0; var optCnt = (optType == 'S') ? c.length : c.length; if (optType == 'R') { for( var j = 0; j < c.length; j++){ if (c[j].parentElement.getAttribute("hidden") != null) { optCnt--; } } } more_txt[opt_id] = moreLabel + (showMLcnt == 1 ? (optCnt - imgLimit + 1) : ''); less_txt[opt_id] = lessLabel + (showMLcnt == 1 ? (optCnt - imgLimit + 1) : ''); var smTitle = ''; for( var j = 0; j< c.length; j++){ if (!selectLangVal.includes(c[j].value) && c[j].parentElement.className != 'radio-wrap none') { imgNo++; var smIsSelect = ((optType == 'S' && (optValue == c[j].value)) || (optType == 'R' && c[j].checked == true)) ? 1 : 0; smItenSelect = smIsSelect == 1 ? ' gwp-opt-sel' : ''; smItenDisplay = (imgNo < imgLimit || (imgNo == imgLimit && imgNo == optCnt)) ? 'block' : 'none'; var lastOpt = (imgNo == imgLimit - 1) ? '!important' : ''; var lastOptClass = (imgNo == imgLimit - 1) ? ' toHidden ' : ''; var lastOptId = (imgNo == imgLimit - 1) ? ' id="gwp_loi_'+oId+'" ' : ''; if (smIsSelect == 1) { smItenDisplay = 'block'; if (imgNo > imgLimit || (imgNo == imgLimit && imgNo < optCnt)) { sOptions = sOptions.replace('block!important','none'); sOptions = sOptions.replace('toHidden','gwpHidden'+opt_id); } } smItenHidden = (imgNo > imgLimit || (imgNo == imgLimit && imgNo != optCnt)) ? ' gwpHidden'+opt_id+' ' : ''; oName = (optType == 'S') ? c[j].innerText.trim() : c[j].dataset.userValue; oId = (optType == 'S') ? s.name : c[j].name; if (smItenSelect == ' gwp-opt-sel') { smTitle = oName; } sOptions += '
' + oName + '
'; } } if (optCnt > imgLimit) { sOptions += '
' + more_txt[opt_id] + '
'; } sPreview = '
'; if (document.getElementById('gwp_div_list_'+opt_id)) { document.getElementById('gwp_div_title_'+opt_id).innerHTML = sTitle; document.getElementById('gwp_div_list_'+opt_id).innerHTML = sOptions; } else { const div_title = document.createElement('div'); div_title.id = 'gwp_div_title_'+opt_id; div_title.className = 'gwp-opt-title'; div_title.innerHTML = sTitle; const div_prev = document.createElement('div'); div_prev.id = 'gwp_div_prev_'+opt_id; div_prev.className = 'gwp-opt-prev'; div_prev.innerHTML = sPreview; const div_list = document.createElement('div'); div_list.id = 'gwp_div_list_'+opt_id; div_list.className = 'sm-gwp-img-list'; div_list.innerHTML = sOptions; if (optType == 'S') { var div4title = s.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.getElementsByTagName('LABEL')[0]; } else { var div4title = s.parentElement.parentElement.parentElement.getElementsByTagName('LABEL')[0]; } div4title.appendChild(div_title); s.parentElement.parentElement.parentElement.appendChild(div_prev); s.parentElement.parentElement.parentElement.appendChild(div_list); } optTmp[opt_id] = s.innerHTML; optTmpVal[opt_id] = s.value; } }); changeStock = 0; if (isLoading > 0 || isDiff == 1) { setTimeout(showGWP,100); } } window.onload = function(){ showGWP(); }; showGWP(); setTimeout(showGWP,1000);