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(3, 1fr); gap: 0px; width: 100%; } .gwp-opt { box-sizing: border-box; text-align: center; border:2px solid transparent; padding:1px; margin:0px; border-radius:0px; 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 #80bd01 !important; padding:1px; } .gwp-opt-sel:hover { padding:1px; } .gwp-opt-name { text-align: center; width: 100%; } .gwp-opt-unavailable img { filter: grayscale(100%); } .gwp-opt-title { min-height: 1em; padding: 11px 0px; } .gwp-opt-prev { position:relative; width: 100%; } .gwp-opt-prev div { position:absolute; left:-405px; width:400px; 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:0px; } .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; }'; document.head.appendChild(gwpstyle); } gwpNo = {6401: "1", 6409: "1", 6410: "1", 6411: "1", 6412: "1", 6413: "1", 6414: "1", 6415: "1", 6416: "1", 6417: "3", 6418: "2", 6419: "3", 6420: "3", 6421: "2", 6422: "2", 6423: "1", 6424: "1", 6425: "2", 6426: "1", 6427: "1", 6428: "1", 6429: "1", 6430: "1", 6431: "1", 6432: "1", 6433: "1", 6435: "1", 6436: "1", 6437: "1", 6439: "1", 6441: "2", 6442: "1", 6443: "1", 6444: "1", 6445: "1", 6446: "1", 6447: "1", 6448: "1", 6449: "1", 6450: "1", 6452: "1", 6453: "1", 6454: "1", 6455: "1", 6456: "1", 6457: "1", 6458: "1", 6459: "1", 6460: "1", 6461: "1", 6462: "1", 6463: "1", 6464: "1", 6465: "1", 6466: "1", 6467: "1", 6468: "1", 6469: "1", 6470: "1", 6471: "1", 6472: "1", 6473: "1", 6474: "1", 6475: "1", 6476: "1", 6477: "1", 6478: "1", 6479: "1", 6480: "1", 6481: "1", 6482: "1", 6483: "1", 6484: "1", 6485: "1", 6486: "1", 6487: "2", 6488: "1", 6489: "1", 6490: "1", 6491: "1", 6492: "1", 6493: "3", 6495: "1", 6494: "1", 6496: "1", 6497: "1", 6498: "1", 6338: "2", 6339: "2", 6340: "2", 6341: "2", 6342: "2", 6343: "2", 6344: "2", 6345: "3", 6346: "1", 6347: "1", 6348: "1", 6349: "1", 6350: "1", 6351: "2", 6352: "2", 6353: "1", 6354: "1", 6355: "1", 6356: "3", 6357: "1", 6358: "1", 6359: "2", 6360: "2", 6361: "1", 6362: "1", 6363: "1", 6364: "1", 6365: "1", 6366: "1", 6367: "1", 6368: "1", 6369: "1", 6370: "1", 6371: "1", 6372: "1", 6373: "1", 6374: "2", 6375: "1", 6377: "3", 6378: "2", 6379: "1", 6380: "2", 6381: "2", 6382: "2", 6383: "2", 6384: "2", 6385: "2", 6386: "2", 6387: "2", 6388: "1", 6389: "1", 6391: "2", 6392: "2", 6393: "2", 6394: "2", 6395: "2", 6396: "2", 6397: "2", 6398: "2", 6399: "2", 6400: "2", 6376: "1", 6390: "1", 6516: "1", 6515: "1", 6514: "1", 6513: "1", 6512: "1", 6511: "1", 6510: "1", 6509: "1", 6508: "1", 6507: "1", 6506: "1", 6505: "1", 6504: "1", 6503: "1", 6502: "1", 6501: "1", 6500: "1", 6499: "1", 6523: "1", 6524: "1", 6525: "1", 6526: "1", 6527: "1", 6528: "1", 6531: "1", 6534: "1", 6536: "1", 6537: "1", 6545: "1", 6529: "1", 6530: "1", 6541: "1", 6543: "1", 6544: "1", 6560: "1", 6559: "1", 6556: "1", 6540: "1", 6552: "1", 6562: "1", 6561: "1", 6533: "1", 6538: "1", 6535: "1", 6542: "1", 6546: "1", 6547: "1", 6548: "1", 6550: "1", 6549: "1", 6551: "1", 6554: "1", 6557: "1", 6555: "1", 6553: "1", 6532: "1", 6539: "1", 6558: "2", 6566: "1", 6567: "1", 6568: "1", 6569: "1", 6570: "1", 6571: "1", 6572: "1", 6579: "2", 6574: "1", 6627: "1", 6626: "1", 6625: "1", 6624: "1", 6623: "1", 6622: "1", 6621: "1", 6620: "1", 6619: "1", 6618: "1", 6617: "1", 6616: "1", 6615: "1", 6614: "1", 6613: "1", 6612: "1", 6611: "1", 6610: "1", 6609: "1", 6608: "1", 6596: "1", 6598: "1", 6573: "1", 6575: "1", 6576: "1", 6577: "1", 6580: "1", 6588: "1", 6595: "1", 6600: "1", 6604: "1", 6605: "1", 6603: "1", 6602: "1", 6606: "1", 6590: "1", 6585: "1", 6578: "1", 6581: "1", 6583: "1", 6584: "1", 6586: "1", 6587: "1", 6589: "1", 6591: "1", 6593: "1", 6594: "1", 6597: "1", 6599: "1", 6601: "1", 6607: "1", 6592: "1", 6582: "1", 6565: "", 6563: "", 6564: "", 6639: "1", 6640: "1", 6641: "1", 6642: "1", 6643: "1", 6644: "1", 6645: "1", 6646: "1", 6647: "1", 6648: "1", 6649: "1", 6650: "1", 6651: "1", 6652: "1", 6653: "1", 6654: "1", 6655: "1", 6656: "1", };var opt_list = [251,253,255,256,257,250,258,261,263,267]; var more_txt = [], less_txt = [], optTmp = [], optTmpVal = [], isStock = 0; var changeStock = 0; var sid = '578'; var gwpurl = 'https://gwp.brweb.pl/i/578/'; var imgLimit = '9'; 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 = '
'+e.title+'
'; 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 = ''+e.title+'
'; 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 selectClick(e) { var id = e.id; var aId = id.split('__'); var optId = aId[0].replace('option_',''); 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_'+optId)) document.getElementById('gwp_div_title_'+optId).innerHTML = e.title; } else { if (window.innerWidth < 700) hidePrevMobile(e); document.getElementById(aId[0]).selectedIndex = '0'; if (document.getElementById('gwp_div_title_'+optId)) document.getElementById('gwp_div_title_'+optId).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].value; } } } var svalues = Array.from(s.querySelectorAll('input[type="radio"], select option')).map(el => el.value).join('|'); isDiff = (!optTmp[opt_id] || optTmp[opt_id] != svalues || optTmpVal[opt_id] != optValue) ? 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) { 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'; if (sid == 5902) { s.parentElement.querySelector('div').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].innerText.trim() : rDict[c[j].id].trim(); oId = (optType == 'S') ? s.id : c[j].name; if (smItenSelect == ' gwp-opt-sel') { smTitle = oName; } sOptions += '