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(4, 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; } .gwp-opt:hover { border:0px solid #EEEEEE; padding:1px; } .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; } .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; }'; document.head.appendChild(gwpstyle); } gwpNo = {2006: "2", 2007: "2", 2009: "2", 2691: "3", 2785: "2", 2786: "1", 3241: "2", 3246: "2", 3371: "1", 3372: "1", 2012: "1", 2013: "1", 2015: "2", 2016: "1", 2690: "1", 3240: "1", 3247: "2", 2787: "1", 2651: "1", 3374: "2", 3375: "3", 3376: "1", 2650: "2", 2654: "2", 2652: "1", 2243: "1", 2244: "1", 2246: "1", 2247: "1", 2739: "1", 2789: "1", 3379: "1", 3380: "1", 3381: "1", 3377: "1", 3378: "1", 1305: "1", 1307: "2", 1308: "1", 1312: "1", 1313: "1", 1318: "2", 1320: "1", 1335: "1", 1336: "1", 1337: "1", 1338: "1", 1339: "1", 1340: "1", 1341: "1", 1344: "1", 1355: "1", 1356: "1", 1357: "1", 1358: "1", 1359: "1", 1361: "1", 2601: "1", 1851: "", 2605: "1", 2607: "1", 2611: "1", 3203: "1", 3204: "1", 3205: "1", 1306: "1", 1309: "1", 1310: "2", 1311: "1", 1314: "1", 1315: "1", 1316: "1", 1317: "1", 1319: "1", 1321: "1", 1322: "2", 1323: "1", 1324: "1", 1325: "1", 1326: "1", 1327: "1", 1328: "2", 1329: "1", 1330: "1", 1331: "1", 1332: "1", 1333: "1", 1334: "1", 1342: "1", 1343: "1", 1346: "1", 1347: "1", 1348: "1", 1349: "1", 1350: "1", 1351: "1", 1352: "1", 2600: "1", 2602: "1", 2603: "1", 2604: "1", 2606: "1", 2608: "1", 2609: "2", 1360: "1", 2610: "1", 2612: "1", 1353: "1", 3215: "1", 3217: "1", 3218: "1", 3219: "", 3220: "1", 3221: "1", 3222: "1", 3224: "1", 3225: "1", 3226: "1", 3227: "1", 3228: "1", 3229: "1", 3230: "1", 3231: "1", 3232: "1", 3233: "1", 3234: "1", 3235: "1", 3236: "1", 2790: "1", 2636: "1", 2613: "1", 2631: "1", 2630: "1", 2627: "1", 2626: "1", 2624: "1", 2623: "1", 2614: "1", 2615: "1", 2616: "1", 2628: "1", 2629: "1", 2632: "1", 2633: "1", 2617: "1", 2619: "1", 2620: "1", 2621: "1", 2622: "1", 2625: "1", 2618: "1", 3384: "1", 3385: "2", 3387: "1", 3388: "1", 3390: "1", 3391: "1", 3392: "1", 3394: "1", 3397: "1", 3403: "1", 3404: "1", 855: "1", 857: "1", 860: "1", 862: "1", 863: "1", 1941: "1", 856: "1", 3188: "1", 3189: "1", 3190: "1", 3191: "1", 3192: "1", 3193: "1", 3194: "1", 3195: "1", 3196: "1", 3197: "1", 3198: "1", 3199: "1", 3200: "1", 3201: "1", 2085: "1", 2087: "1", 2088: "1", 2091: "1", 2092: "1", 2093: "1", 2094: "1", 2095: "1", 2086: "1", 2098: "1", 2099: "1", 2100: "1", 2101: "1", 2102: "1", 2103: "1", 2104: "1", 2105: "1", 2106: "1", 2108: "1", 2109: "1", 2110: "1", 2111: "1", 2112: "1", 2113: "1", 2114: "1", 2115: "1", 2572: "1", 2573: "1", 2574: "1", 2590: "1", 2583: "1", 2575: "1", 2096: "1", 2577: "1", 2579: "1", 2580: "1", 2581: "1", 2582: "1", 2584: "1", 2585: "1", 2586: "1", 2589: "1", 2591: "1", 2592: "1", 2593: "1", 2594: "1", 2595: "1", 2596: "1", 2107: "1", 3407: "1", 3408: "1", 3409: "1", 3410: "1", 3411: "1", 3412: "1", 3413: "1", 3414: "1", 2090: "1", 3415: "1", 3416: "1", 3417: "1", 3418: "1", 3419: "1", 3420: "1", 3421: "1", 3422: "1", 3424: "1", 3423: "2", 3425: "1", 3426: "1", 3427: "1", 3428: "1", 3429: "1", 3430: "1", 3431: "1", 3432: "1", 3433: "1", 3434: "1", 3435: "1", 3436: "1", 3437: "1", 3438: "1", 3439: "1", 3440: "1", 3441: "1", 3442: "1", 3443: "1", 3444: "2", 3445: "1", 3446: "1", 3447: "2", 3448: "1", 3449: "1", 3450: "1", 3451: "1", 3452: "1", 3453: "1", 3454: "1", 3455: "1", 3456: "1", 3457: "1", 3458: "1", 3459: "1", 3460: "1", 3461: "1", 3462: "1", 3463: "2", 3464: "1", 3465: "1", 3466: "1", 3468: "1", 3469: "1", 3470: "1", 3471: "1", 3472: "1", 3473: "1", 3474: "1", 3475: "1", 3476: "1", 3476: "1", 3477: "1", 3478: "1", 3479: "1", 3480: "1", 3481: "1", 3482: "1", 3483: "1", 3484: "1", 3485: "1", 3486: "1", 3487: "1", 3488: "1", 3489: "1", 3492: "1", 3490: "1", 3491: "1", 3493: "1", 3494: "1", 3495: "1", 3497: "1", 3498: "1", 3499: "1", 3500: "1", 3501: "1", 3502: "1", 3503: "1", 3504: "1", 3505: "1", 3506: "1", 3507: "1", 3508: "1", 3509: "1", 3510: "1", 3511: "1", 3512: "1", 3513: "1", 3514: "1", 3515: "1", 3516: "1", 3517: "1", 3518: "1", 3519: "1", 3520: "1", 3521: "1", 3522: "1", 3523: "1", 3524: "1", 3525: "1", 3526: "1", 3527: "1", 3528: "1", 3529: "1", 3530: "2", 3531: "1", 3532: "1", 3533: "1", 3534: "1", 3535: "1", 3536: "1", 3537: "1", 3538: "1", 3539: "1", 3540: "1", 3543: "1", 3541: "1", 3542: "1", 3544: "1", 3545: "1", 3561: "1", 3562: "1", 3563: "1", 3564: "1", 3565: "1", 3566: "1", 3567: "1", 2527: "1", 3382: "1", 2528: "1", 3383: "1", 2530: "1", 2531: "1", 2788: "1", 3242: "1", 3243: "1", 3245: "1", 3244: "1", 3570: "4", 3692: "1", 3693: "2", 3696: "2", 3697: "2", 3698: "1", 3699: "1", 3700: "1", 3701: "1", 3694: "1", 3695: "1", };var opt_list = [90,116,118,135,41,120,129]; var more_txt = [], less_txt = [], optTmp = [], optTmpVal = [], isStock = 0; var changeStock = 0; var sid = '413'; var url = 'https://gwp.brweb.pl/i/413/'; var imgLimit = '8'; 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 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 += '
'; } } if (optCnt > imgLimit) { sOptions += '
' + more_txt[opt_id] + '
'; } sPreview = '
'; sTitle = smTitle != '' ? smTitle : ''; 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; } else { var div4title = s.parentElement; } div4title.prepend(div_title); if (optType == 'S') { s.parentElement.parentElement.parentElement.appendChild(div_prev); s.parentElement.parentElement.parentElement.appendChild(div_list); } else { s.parentElement.parentElement.appendChild(div_prev); s.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);