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(8, 1fr); gap: 0px; width: 100%; } .gwp-opt { box-sizing: border-box; text-align: center; border:2px solid transparent; padding:1px; margin:0px; border-radius:7px; overflow-x:hidden; position: relative; } .gwp-opt:hover { border-top:0px solid #EEEEEE; padding:1px; } .gwp-opt:hover .gwp-opt-name { padding-top:2px; } .gwp-opt-sel:hover .gwp-opt-name { padding-top: 0px; } .gwp-opt-sel { border:2px solid #777777 !important; padding:1px; } .gwp-opt-sel:hover { padding:1px; } .gwp-opt-name { text-align: center; width: 100%; } .gwp-opt-title { min-height: 1em; padding: 11px 0px; } .gwp-opt-prev { position:relative; width: 100%; } .gwp-opt-prev div { position:absolute; left:-505px; width:500px; 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-prev-title { display: block; text-align: center; } .gwp-opt-title { font-weight:bold; padding: 0px 20px; display: inline-block; } .gwp-opt-prev .icon { width:auto; height:auto; speak: none; font-style: normal; font-weight: normal; font-variant: normal; text-transform: none; line-height: 1; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } .gwp-opt-prev .icon-close:before { content: "✕"; font-weight: bold; } '; document.head.appendChild(gwpstyle); } gwpNo = {295: "2", 296: "1", 274: "1", 275: "1", 532: "1", 533: "1", 534: "1", 535: "1", 307: "1", 308: "1", 536: "1", 537: "1", 317: "1", 318: "1", 539: "1", 540: "1", 541: "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: "1", 556: "2", 557: "1", 558: "1", 559: "1", 560: "1", 561: "1", 562: "1", 563: "1", 564: "1", 565: "1", 566: "1", 567: "1", 568: "1", 569: "1", 570: "1", 571: "1", 572: "1", 573: "1", 574: "1", 575: "1", 576: "1", 577: "1", 578: "2", 579: "1", 580: "1", 581: "1", 582: "1", 583: "1", 584: "1", 588: "1", 589: "1", 590: "1", 591: "1", 592: "1", 593: "1", 594: "1", 595: "1", 596: "1", 597: "1", 598: "2", 599: "1", 600: "1", 601: "1", 602: "1", 603: "2", 604: "1", 605: "1", 606: "1", 607: "1", 608: "1", 609: "1", 610: "1", 611: "1", 612: "1", 613: "1", 614: "1", 615: "1", 616: "1", 617: "1", 618: "1", 619: "1", 620: "2", 621: "1", 622: "1", 623: "1", 624: "1", 625: "2", 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", 644: "1", 645: "1", 646: "1", 647: "2", 648: "1", 649: "1", 650: "1", 651: "1", 652: "1", 653: "1", 654: "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: "2", 670: "1", 671: "1", 672: "1", 673: "1", 674: "1", 675: "1", 655: "1", 676: "1", 677: "1", 678: "1", 679: "1", 680: "1", 681: "1", 682: "1", 683: "1", 686: "1", 687: "1", 688: "1", 689: "2", 690: "1", 691: "1", 692: "1", 693: "1", 694: "2", 695: "3", 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", 728: "1", 729: "1", 730: "1", 731: "1", 732: "1", 733: "1", 734: "1", 735: "1", 736: "1", 737: "1", 738: "2", 739: "2", 740: "1", 741: "1", 742: "1", 228: "1", 229: "1", 230: "2", 231: "1", 232: "1", 234: "1", 227: "1", 233: "1", 235: "1", 236: "1", 237: "1", 238: "1", 239: "1", 240: "1", 241: "1", 242: "1", 243: "1", 210: "1", 211: "1", 212: "1", 213: "1", 214: "1", 215: "1", 216: "1", 217: "1", 218: "1", 219: "1", 220: "1", 221: "1", 222: "1", 223: "1", 224: "1", 225: "1", 226: "1", 432: "1", 433: "1", 434: "1", 435: "1", 436: "1", 437: "1", 438: "1", 439: "1", 440: "2", 441: "1", 442: "1", 443: "1", 444: "1", 445: "1", 446: "1", 447: "1", 448: "1", 244: "1", 245: "1", 246: "1", 247: "1", 248: "1", 249: "1", 250: "1", 251: "1", 252: "1", 253: "1", 254: "1", 255: "1", 256: "1", 257: "1", 258: "1", 259: "1", 260: "1", 802: "1", 803: "1", 804: "1", 805: "1", 806: "1", 807: "1", 808: "1", 809: "1", 810: "1", 811: "1", 812: "1", 813: "1", 814: "1", 815: "1", 816: "1", 817: "1", 818: "1", 819: "1", 820: "1", 821: "1", 822: "1", 826: "1", 823: "1", 824: "1", 825: "1", 846: "1", 847: "1", 848: "1", 849: "1", 866: "1", 867: "1", 868: "1", 869: "1", 870: "1", 871: "1", 872: "1", 873: "1", 874: "1", 875: "1", 876: "1", 878: "1", 879: "1", 880: "1", 881: "1", 882: "1", 883: "1", 884: "1", 885: "1", 877: "1", 886: "1", 887: "1", 890: "1", 889: "1", 891: "1", 888: "1", 892: "1", 893: "1", 894: "1", 895: "1", 896: "1", 897: "1", 922: "1", 923: "1", 924: "1", 925: "1", 926: "1", 927: "1", 928: "1", 929: "1", 930: "1", 931: "1", 932: "1", 933: "1", 934: "1", 935: "1", 936: "1", 937: "1", 938: "1", 939: "1", 940: "1", 941: "1", 956: "1", 957: "1", 958: "1", 954: "1", 955: "1", 959: "1", 953: "1", };var opt_list = [90,76,94,98,178,179,181,182,183,184,186,192,200,62,61,151,66,227,253,254,257]; var more_txt = [], less_txt = [], optTmp = [], optTmpVal = [], isStock = 0; var changeStock = 0; var sid = '409'; var gwpurl = 'https://gwp.brweb.pl/i/index.php?path=/i/409/'; var imgLimit = '30'; 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','вибрати','-1']; 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 optId = aId[0].replace('option_',''); 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]; /* if (e.parentNode.classList.contains('gwp-opt-sel')) { optValue = ''; } */ 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 == 497 || sid == 562 || sid == 588 || sid == 602) { 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.innerText.replace(/\s+/g, '') || (sid != 367 && optTmpVal[opt_id] != optValue)) ? 1 : 0; if (sid == 562) { isDiff = (!optTmp[opt_id] || optTmp[opt_id] != s.innerHTML.replace(/\s+/g, '') || (optTmpVal[opt_id] != optValue)) ? 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' && !c[j].hidden) { 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 = c[j].dataset.userValue ; var smItemUnavailable = (c[j].hasAttribute('data-option-value-unavailable')) ? ' gwp-opt-unavailable' : ''; if (c[j].dataset.priceModifier && c[j].dataset.priceModifier != '') { oName += ' (' + c[j].dataset.priceModifier + ')'; } oId = (optType == 'S') ? s.name : c[j].name; if (smItenSelect == ' gwp-opt-sel') { smTitle = oName; } sOptions += '