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(10, 1fr); gap: 0px; width: 100%; } .gwp-opt { box-sizing: border-box; text-align: center; border:0px 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:0px; } .gwp-opt-sel:hover .gwp-opt-name { padding-top: 0px; } .gwp-opt-sel { border:0px 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:-105px; width:100px; 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 = {146: "1", 134: "2", 113: "1", 133: "1", 135: "1", 136: "1", 137: "1", 138: "1", 139: "2", 140: "1", 141: "1", 142: "1", 143: "2", 144: "1", 145: "1", 158: "1", 157: "1", 156: "1", 155: "1", 154: "1", 153: "1", 152: "1", 151: "1", 150: "1", 149: "1", 148: "1", 147: "1", 159: "1", 179: "1", 180: "1", 164: "3", 165: "2", 166: "3", 169: "1", 170: "1", 171: "1", 167: "3", 168: "2", 262: "1", 183: "2", 184: "1", 188: "2", 189: "1", 186: "4", 187: "1", 182: "1", 185: "1", 190: "1", 191: "2", 192: "1", 193: "1", 194: "1", 196: "2", 197: "1", 198: "1", 199: "1", 200: "1", 201: "1", 202: "2", 203: "1", 204: "1", 205: "2", 206: "1", 207: "1", 208: "1", 274: "3", 276: "1", 277: "2", 295: "1", 296: "2", 297: "1", 298: "1", 299: "2", 300: "1", 301: "1", 302: "1", 292: "1", 290: "1", 291: "1", 293: "1", 294: "1", 287: "1", 288: "1", 286: "1", 284: "1", 283: "1", 285: "1", 278: "1", 280: "1", 279: "1", 282: "1", 281: "1", 275: "1", 304: "1", 303: "1", 305: "1", 314: "1", 315: "1", 316: "1", 317: "1", 318: "1", 319: "1", 320: "1", 321: "1", 322: "1", 323: "1", 324: "1", 325: "1", 326: "1", 327: "1", 328: "1", 331: "1", 330: "1", 332: "1", 333: "1", 334: "1", 335: "1", 336: "2", 337: "1", 338: "1", 339: "2", 340: "1", 341: "1", 342: "1", 353: "1", 354: "1", 355: "1", 356: "1", 357: "1", 358: "1", 359: "1", 360: "1", 361: "1", 362: "1", 370: "1", 371: "1", 372: "1", 373: "1", 374: "1", 375: "1", 377: "1", 376: "1", 378: "1", 379: "1", 380: "1", 381: "1", 382: "1", 383: "1", 384: "1", 387: "1", 386: "1", 389: "1", 388: "1", 390: "1", 391: "1", 392: "2", 393: "1", 394: "1", 395: "2", 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", 415: "1", 416: "1", 417: "1", 418: "1", 419: "1", 420: "1", 421: "2", 413: "1", 422: "1", 423: "1", 424: "2", 425: "1", 426: "1", 427: "1", 428: "1", 429: "1", 430: "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", 455: "1", 454: "1", 457: "1", 456: "1", 458: "1", 459: "1", 460: "2", 461: "1", 462: "1", 463: "2", 464: "1", 465: "1", 466: "1", 467: "1", 468: "1", 469: "1", 470: "1", 471: "1", 472: "1", 473: "1", 474: "1", 475: "1", 476: "1", 477: "1", 478: "1", 479: "1", 480: "1", 481: "1", 483: "1", 484: "1", 485: "1", 486: "1", 487: "1", 488: "1", 489: "2", 490: "1", 491: "1", 492: "2", 493: "1", 494: "1", 495: "1", 498: "1", 497: "1", 496: "1", 570: "1", 572: "1", 571: "1", 576: "1", 575: "1", 573: "1", 577: "1", 574: "1", 579: "1", 578: "1", 588: "5", 589: "3", 590: "2", 591: "2", 604: "1", 605: "1", 613: "1", 612: "1", 592: "1", 593: "1", 594: "1", 595: "1", 608: "1", 609: "1", 614: "1", 615: "1", 596: "1", 597: "1", 598: "1", 599: "1", 620: "1", 621: "1", 616: "1", 617: "1", 622: "1", 623: "1", 618: "1", 619: "1", 624: "1", 625: "1", 626: "1", 627: "1", 628: "1", 629: "1", 630: "1", 647: "7", 631: "2", 635: "1", 651: "1", 655: "1", 639: "1", 648: "3", 649: "2", 650: "1", 632: "2", 633: "1", 634: "1", 636: "1", 637: "1", 638: "1", 652: "1", 653: "1", 654: "1", 656: "1", 657: "1", 658: "1", 640: "1", 641: "1", 642: "1", 659: "1", 660: "1", 661: "1", 662: "1", 665: "3", 666: "1", 677: "1", 683: "1", 674: "1", 682: "1", 678: "1", 681: "1", 680: "1", 684: "1", 673: "1", 675: "1", 676: "1", 672: "1", 679: "1", 669: "2", 697: "1", 698: "2", 688: "1", 689: "1", 690: "1", 691: "1", 692: "1", 693: "1", 694: "1", 695: "1", 696: "1", 686: "1", 687: "1", 670: "1", 767: "1", 768: "1", 769: "1", 732: "1", 733: "1", 734: "1", 735: "1", 736: "1", 737: "1", 738: "1", 739: "1", 741: "1", 740: "1", 742: "1", 743: "1", 744: "1", 758: "1", 748: "1", 749: "1", 750: "2", 751: "1", 752: "1", 753: "1", 754: "1", 755: "1", 756: "1", 757: "1", 747: "1", 746: "1", 643: "1", 644: "1", 645: "1", 646: "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: "2", 770: "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", 771: "1", 761: "1", 760: "1", 762: "1", 730: "1", 729: "1", 728: "1", 759: "1", 727: "1", 773: "1", 772: "1", 774: "1", 777: "1", 778: "1", 781: "1", 782: "1", 779: "2", 780: "2", 785: "1", 786: "1", 783: "1", 784: "1", 775: "1", 776: "1", 787: "1", 788: "1", 789: "1", 790: "1", 853: "1", 854: "1", 855: "1", 856: "", 857: "1", 858: "1", 859: "1", 860: "1", 861: "1", 862: "1", 863: "1", 864: "1", 865: "1", 866: "1", 867: "", 868: "1", 912: "1", 913: "1", 915: "1", 916: "1", 869: "1", 870: "1", 871: "1", 872: "1", 873: "1", 874: "2", 875: "1", 876: "1", 877: "1", 878: "1", 879: "1", 880: "1", 882: "1", 883: "", 884: "1", 881: "1", 1117: "1", 1118: "1", 1119: "1", 1120: "1", 1121: "1", 1122: "1", 1123: "1", 1124: "1", 1125: "1", 1126: "1", 1127: "1", 1128: "1", 1129: "1", 1130: "1", 1150: "1", 1151: "1", 1152: "1", 1153: "1", 1154: "1", 1148: "1", 1147: "1", 1146: "1", 1145: "1", 1149: "1", 1143: "1", 1142: "1", 1141: "1", 1140: "1", 1144: "1", 1477: "1", 1478: "1", 1479: "1", 1480: "1", 1481: "1", 1482: "1", 1483: "1", 1484: "1", 1485: "1", 1486: "1", 1487: "2", 1488: "1", 1489: "1", 1490: "1", 1491: "1", 1492: "1", 1493: "1", 1494: "1", 1495: "1", 1496: "1", 1517: "1", 1518: "1", 1519: "1", 1520: "1", 1521: "1", 1522: "1", 1523: "1", 1524: "1", 1525: "1", 1526: "1", 1527: "1", 1528: "2", 1529: "1", 1530: "1", 1531: "1", 1532: "1", 1533: "1", 1534: "1", 1535: "1", 1536: "1", 1497: "1", 1498: "1", 1499: "1", 1500: "1", 1501: "1", 1502: "1", 1503: "1", 1504: "1", 1505: "1", 1506: "1", 1507: "1", 1508: "1", 1509: "1", 1510: "1", 1511: "1", 1512: "1", 1513: "1", 1514: "1", 1515: "1", 1516: "1", 1558: "2", 1559: "3", 1560: "2", 1561: "1", 1562: "4", 1545: "1", 1544: "2", 1547: "2", 1548: "1", 1551: "3", 1552: "1", 1553: "2", 1556: "2", 1554: "2", 1555: "1", 1565: "1", 1564: "1", 1567: "1", 1568: "1", 1546: "1", 1549: "1", 1557: "3", 1563: "1", 1566: "1", 1569: "1", };var opt_list = [25,34,36,37,44,45,49,52,53,55,56,57,60,61,62,86,87,89,94,95,113,120,121,114,150]; var more_txt = [], less_txt = [], optTmp = [], optTmpVal = [], isStock = 0; var changeStock = 0; var sid = '484'; var gwpurl = 'https://gwp.brweb.pl/i/index.php?path=/i/484/'; var imgLimit = '20'; 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 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); if (prev_div) { 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 showPrevMobile(e) { var id = e.id; var aId = id.split('__'); var aSO = aId[0].split('_'); var soptid = aSO[1]; var prev_id = 'gwp_div_preview_'+soptid; 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 = '
'; console.log(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 aSO = aId[0].split('_'); var soptid = aSO[1]; var prev_id = 'gwp_div_preview_'+soptid; var prev_div = document.getElementById(prev_id); prev_div.style.display = 'none'; prev_div.innerHTML = ''; } function hideDiv() { document.getElementById(prevMopen).style.display = 'none'; } 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; if (window.innerWidth < 700) showPrevMobile(e); } } 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; if (window.innerWidth < 700) showPrevMobile(e); 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 += '