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(6, 1fr); gap: 0px; width: 100%; overflow-y: auto; max-height:100px; } .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:2px; 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 #ed008f !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:-205px; width:200px; 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:2px; } .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; }'; document.head.appendChild(gwpstyle); } gwpNo = {1669: "2", 1670: "2", 1671: "2", 1672: "2", 1673: "2", 1674: "2", 1675: "2", 1676: "2", 1677: "2", 1678: "3", 1679: "2", 1680: "2", 1681: "2", 1682: "2", 1683: "2", 1684: "2", 1685: "2", 1686: "2", 1687: "2", 1688: "2", 1689: "2", 1690: "2", 1691: "2", 1692: "2", 1694: "2", 1695: "2", 1696: "2", 1697: "2", 1698: "2", 1699: "2", 1700: "2", 1701: "2", 1702: "2", 1703: "2", 1704: "2", 1705: "2", 1706: "2", 1707: "2", 1708: "2", 1709: "2", 1710: "2", 1711: "2", 1712: "2", 1713: "2", 1714: "2", 1715: "2", 1716: "2", 1717: "2", 1718: "2", 1719: "2", 1720: "2", 1721: "2", 1722: "2", 1723: "2", 1724: "2", 1725: "2", 1726: "2", 1727: "2", 1693: "2", 1728: "1", 1729: "1", 1730: "1", 1731: "1", 1732: "1", 1733: "1", 1734: "1", 1735: "1", 1736: "1", 1737: "1", 1738: "1", 1739: "1", 1740: "1", 1741: "1", 1742: "1", 1743: "1", 1744: "1", 1745: "1", 1746: "1", 1747: "1", 1748: "1", 1749: "1", 1750: "1", 1751: "1", 1752: "1", 1753: "1", 1754: "1", 1755: "1", 1756: "1", 1757: "1", 1758: "1", 1759: "1", 1760: "1", 1761: "1", 1762: "1", 1763: "1", 1764: "1", 1765: "1", 1766: "1", 1767: "1", 1768: "1", 1769: "1", 1770: "1", 1771: "1", 1772: "1", 1773: "1", 1774: "1", 1775: "1", 1776: "1", 1777: "1", 1778: "1", 1779: "1", 1780: "1", 1781: "1", 1782: "1", 1783: "1", 1784: "1", 1785: "1", 1786: "1", 1787: "1", 1788: "1", 1789: "1", 1790: "1", 1791: "1", 1792: "1", 1793: "1", 1794: "1", 1795: "1", 1796: "1", 1797: "1", 1798: "1", 1799: "1", 1800: "1", 1801: "1", 1802: "1", 1803: "1", 1804: "1", 1805: "1", 1806: "1", 1807: "1", 1808: "1", 1809: "1", 1810: "1", 1811: "1", 1812: "1", 1813: "1", 1814: "1", 1815: "1", 1816: "1", 1817: "1", 1818: "1", 1819: "1", 1820: "1", 1821: "1", 1822: "1", 1823: "1", 1824: "1", 1825: "1", 1826: "1", 1827: "1", 1828: "1", 1829: "1", 1830: "1", 1831: "1", 1832: "1", 1833: "1", 1834: "1", 1835: "1", 1836: "1", 1837: "1", 1838: "1", 1839: "1", 1840: "1", 1841: "1", 1842: "1", 1843: "1", 1844: "1", 1855: "1", 1856: "1", 1857: "1", 1858: "1", 1859: "1", 1860: "1", 1861: "1", 1862: "1", 1863: "1", 1864: "1", 1865: "1", 1866: "1", 1867: "1", 1868: "1", 1869: "1", 1870: "1", 1871: "1", 1872: "1", 1873: "1", 1874: "1", 1875: "1", 1876: "1", 1877: "1", 1878: "1", 1879: "1", 1880: "1", 1881: "1", 1882: "1", 1883: "1", 1884: "1", 1885: "1", 1886: "1", 1887: "1", 1888: "1", 1889: "1", 1890: "1", 1891: "1", 1892: "1", 1893: "1", 1894: "1", 1895: "1", 1896: "1", 1897: "1", 1898: "1", 1899: "1", 1900: "1", 1901: "1", 1902: "1", 1903: "1", 1904: "1", 1905: "1", 1906: "1", 1907: "1", 1908: "1", 1909: "1", 1910: "1", 1911: "1", 386: "1", 387: "1", 388: "1", 389: "1", 390: "1", 1304: "1", 1494: "1", 1654: "1", 1655: "1", 1850: "1", 1656: "1", 1657: "1", 1658: "1", 1659: "1", 731: "1", 732: "1", 733: "1", 734: "1", 1644: "1", 1645: "1", 1646: "1", 1647: "1", 1648: "1", 1649: "1", 1641: "1", 1642: "1", 1969: "1", 1970: "1", 1971: "1", 1972: "1", 1973: "1", 1974: "1", 1975: "1", 1976: "1", 1977: "1", 1978: "1", 1979: "1", 1980: "1", 1981: "1", 1982: "1", 1983: "1", 1984: "1", 1985: "1", 1986: "1", 1987: "1", 1988: "1", 1989: "1", 1948: "1", 1949: "1", 1950: "1", 1951: "1", 1952: "1", 1953: "1", 1954: "1", 1955: "1", 1956: "1", 1957: "1", 1958: "1", 1959: "1", 1960: "1", 1961: "1", 1962: "1", 1963: "1", 1964: "1", 1965: "1", 1966: "1", 1967: "1", 1968: "1", 1927: "1", 1928: "1", 1929: "1", 1930: "1", 1931: "1", 1932: "1", 1933: "1", 1934: "1", 1935: "1", 1936: "1", 1937: "1", 1938: "1", 1939: "1", 1940: "1", 1941: "1", 1942: "1", 1943: "1", 1944: "1", 1945: "1", 1946: "1", 1947: "1", 474: "1", 473: "1", 507: "1", 508: "1", 509: "1", 708: "1", 677: "1", 678: "1", 679: "1", 680: "1", 681: "1", 682: "1", 718: "1", 719: "1", 720: "1", 1470: "1", 1471: "1", 1472: "1", 1473: "1", 1474: "1", 1475: "1", 1990: "1", 1991: "1", 1992: "1", 1993: "1", 1994: "1", 1995: "1", 1996: "1", 1997: "1", 1998: "1", 1999: "1", 2000: "1", 2001: "1", 2002: "1", 2003: "1", 2004: "1", 2005: "1", 2006: "1", 2007: "1", 2008: "1", 2009: "1", 2010: "1", 2011: "1", 2012: "1", 2013: "1", };var opt_list = [196,197,75,80,53,193,57,191,109,74,202,85,98,107,178,203]; var more_txt = [], less_txt = [], optTmp = [], optTmpVal = [], isStock = 0; var changeStock = 0; var sid = '473'; var url = 'https://gwp.brweb.pl/i/473/'; var imgLimit = '1000'; var moreLabel = '+'; var lessLabel = '-'; var showMLcnt = 0; 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 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 = ''; 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 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 = aId[0] + '__' + document.getElementById(aId[0]).value; } 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.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'; } } optTmpVal[aId[0].replace('option_','')] = document.getElementById(aId[0]).value; } 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.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 sr = document.getElementsByName('option_'+opt_id); if (sr.length == 0) { return; } var optValue = ''; if (sr[0].id == sr[0].name ) { var optType = 'S'; var s = sr[0]; var c = s.getElementsByTagName('option'); var optValue = s.value; } else { var optType = 'R'; var s = sr[0].parentElement.parentElement; var c = sr; for( var j = 0; j < c.length; j++){ if (c[j].checked == true) { optValue = c[j].innerHTML; } } } isDiff = (!optTmp[opt_id] || optTmp[opt_id] != s.innerHTML || optTmpVal[opt_id] != s.value) ? 1 : 0; var eStock = (optType == 'S') ? s.parentElement.className : sr[0].parentElement.className; if (eStock.indexOf('option_truestock ') != -1 && eStock.indexOf('loading') != -1) { isLoading++; } if (isDiff == 1 || changeStock == 1) { console.log('gwp'); if (optType == 'R') { s.style.visibility = 'hidden'; s.style.width = '0px'; s.style.height = '0px'; s.style.position = 'absolute'; s.style.bottom = '0px'; } else { s.style.display = 'none'; } var sOptions = '', sPreview = '', sTitle = ''; var imgNo = 0; var optCnt = (optType == 'S') ? c.length - 1 : c.length; if (optType == 'R') { for( var j = 0; j < c.length; j++){ if (c[j].parentElement.className == 'radio-wrap none') { optCnt--; } } var rlabels = s.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; } } 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' && (s.options[s.selectedIndex].value == c[j].value || s.value == 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].innerHTML : rDict[c[j].id]; oId = (optType == 'S') ? s.id : c[j].name; if (smItenSelect == ' gwp-opt-sel') { smTitle = oName; } sOptions += '