gwpNo = {2436: "1", 2437: "1", 2438: "1", 2439: "1", 2440: "1", 2441: "1", 2442: "1", 2443: "1", 2444: "1", 2445: "1", 2446: "1", 2447: "1", 2448: "1", 2449: "1", 2450: "1", 2451: "1", 2452: "1", 2453: "1", 2454: "1", 2455: "1", 2456: "1", 2457: "1", 2458: "1", 2459: "1", 2460: "1", 2461: "1", 2462: "1", 2463: "1", 2464: "1", 2465: "1", 2466: "1", 2467: "1", 2468: "1", 2469: "1", 2470: "1", 2471: "1", 2472: "1", 2473: "1", 2474: "1", 2475: "1", 2476: "1", 2477: "1", 2478: "1", 2479: "1", 2480: "1", 2481: "1", 2482: "1", 2483: "1", 2484: "1", 2485: "1", 2486: "1", 2487: "1", 2488: "1", 2489: "1", 2490: "1", 2491: "1", 2492: "1", 2493: "1", 2494: "1", 2495: "1", 2496: "1", 2497: "1", 2498: "1", 2499: "1", 2500: "1", 2501: "1", 2502: "1", 2503: "1", 2504: "1", 2505: "1", 2506: "1", 2507: "1", 2508: "1", 2509: "1", 2510: "1", 2511: "1", 2512: "1", 2513: "1", 2514: "1", 2515: "1", 2516: "1", 2517: "1", 2518: "1", 2519: "1", 2520: "1", 2521: "1", 2522: "1", 2523: "1", 2524: "1", 2525: "1", 2526: "1", 2527: "1", 2528: "1", 2529: "1", 2530: "1", 2531: "1", 2532: "1", 2533: "1", 2534: "1", 2535: "1", 2536: "1", 2537: "1", 2538: "1", 2539: "1", 2540: "1", 2541: "1", 2542: "1", 2543: "1", 2544: "1", 2545: "1", 2546: "1", 2547: "1", 2548: "1", 2549: "1", 2550: "1", 2551: "1", 2552: "1", 2553: "1", 2554: "1", 2555: "1", 2556: "1", 2557: "1", 2558: "1", 2559: "1", 2560: "1", 2561: "1", 2562: "1", 2563: "1", 2564: "1", 2565: "1", 2566: "1", 2567: "1", 2568: "1", 2569: "1", 2571: "1", 2572: "1", 2573: "1", 2574: "1", 2575: "1", 2576: "2", 2577: "1", 2578: "1", 2579: "1", 2580: "1", 2581: "1", 2582: "1", 2583: "1", 2584: "1", 2585: "1", 2586: "1", 2587: "1", 2588: "1", 2589: "1", 2590: "1", 2591: "1", 2592: "1", 2593: "1", 2594: "1", 2595: "1", 2596: "1", 2597: "1", 2598: "1", 2599: "1", 2600: "1", 2601: "1", 2602: "1", 2603: "1", 2604: "1", 2605: "1", 2606: "1", 2607: "1", 2608: "1", 2609: "1", 2610: "1", 2611: "1", 2612: "1", 2613: "1", 2614: "1", 2615: "1", 2616: "1", 2617: "1", 2618: "1", 2619: "1", 2620: "1", 2621: "1", 2622: "1", 2623: "1", 2624: "1", 2625: "1", 2626: "1", 2627: "1", 2628: "1", 2629: "1", 2630: "1", 2631: "1", 2632: "1", 2633: "1", 2634: "1", 2635: "1", 2636: "1", 2637: "1", 2638: "1", 2639: "1", 2640: "1", 2641: "1", 2642: "1", 2643: "1", 2644: "1", 2645: "1", 2646: "1", 2647: "1", };var opt_list = [493,494]; var more_txt = [], less_txt = [], optTmp = [], isStock = 0; var sid = '363'; var url = 'https://gwp.brweb.pl/i/363/'; var selcolor = '#777777'; var imgLimit = '6'; var moreLabel = '+'; var lessLabel = '-'; var showMLcnt = 1; var prevMopen = ''; function showPrev(e) { if (window.innerWidth < 700) return null; var id = e.id; var aId = id.split('__'); var prev_div = document.getElementById('gwp_div_preview_'+aId[0].replace('option_','')); prev_div.style.display = 'block'; prev_div.innerHTML = ''; } function hidePrev(e) { if (window.innerWidth < 700) return null; var id = e.id; var aId = id.split('__'); var prev_div = document.getElementById('gwp_div_preview_'+aId[0].replace('option_','')); prev_div.style.display = 'none'; prev_div.innerHTML = ''; } function showPrevMobile(e) { var id = e.id; var aId = id.split('__'); var prev_id = 'gwp_div_preview_'+aId[0].replace('option_',''); 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 prev_id = 'gwp_div_preview_'+aId[0].replace('option_',''); var prev_div = document.getElementById(prev_id); prev_div.style.display = 'none'; prev_div.innerHTML = ''; } function hideDiv() { document.getElementById(prevMopen).style.display = 'none'; } 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 = ''; } 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.style.border = '1px solid transparent'; if ( c[i].id == id ) c[i].parentElement.style.border = '1px solid ' + selcolor; } } 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.style.border = '1px solid transparent'; if ( c[i].id == id ) c[i].parentElement.style.border = '1px solid ' + selcolor; } } 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 = type; } document.getElementById('gwp_more'+oid).innerHTML = type == 'block' ? less_txt[oid] : more_txt[oid] ; } function showGWP() { opt_list.forEach(function(opt_id) { var s = document.getElementById('option_'+opt_id); if (s && (!optTmp[opt_id] || optTmp[opt_id] != s.innerHTML)) { s.style.display = 'none'; optTmp[opt_id] = s.innerHTML; var sColors = ''; if (s.parentElement.className.indexOf('option_truestock ') != -1 && isStock == 0) { isStock = 1; const intervalGWP = setInterval(function() { showGWP(); if (s.value == 'wybierz') { var c30 = document.getElementsByClassName('c_option_' + opt_id); for( var i30 = 0; i30 < c30.length; i30++){ if (c30[i30].parentElement.style.border != '1px solid transparent') { selectClick(document.getElementById(c30[i30].id)); } } } }, 500); } sColors += '
'; sColors += '
'; var c = s.getElementsByTagName('option'); var imgNo = 0; var optCnt = c.length - 1; more_txt[opt_id] = moreLabel + (showMLcnt == 1 ? (optCnt - imgLimit + 1) : ''); less_txt[opt_id] = lessLabel + (showMLcnt == 1 ? (optCnt - imgLimit + 1) : ''); for( var j = 0; j< c.length; j++){ if (c[j].value != '' && c[j].value != 'wybierz' && c[j].value != 'choose' && c[j].value != 'wählen' && c[j].value != 'Vybrat' && c[j].value != 'vali' && c[j].value != 'izvēlēties' && c[j].value != 'pasirinkti' && c[j].value != 'választ' && c[j].value != 'vyberte si' && c[j].value != 'вибрати') { imgNo++; sColors += '
imgLimit || (imgNo == imgLimit && imgNo != optCnt)) ? ' class="gwpHidden'+opt_id+' gwp-opt" ' : 'class="gwp-opt"') + '>
'; } } if (optCnt > imgLimit) { sColors += '
' + more_txt[opt_id] + '
'; } sColors += '
'; if (document.getElementById('gwp_div_'+opt_id)) { div = document.getElementById('gwp_div_'+opt_id); div.innerHTML = sColors; s.parentElement.appendChild(div); } else { const div = document.createElement('div'); div.innerHTML = sColors; div.id = 'gwp_div_'+opt_id; div.className = 'gwp-div'; div.style = 'position:relative;'; s.parentElement.appendChild(div); } } var sr = document.getElementsByName('option_'+opt_id); if (sr && sr.length > 0 && (!optTmp[opt_id] || optTmp[opt_id] != s.innerHTML)) { optTmp[opt_id] = sr[0].parentElement.parentElement.innerHTML; var sColors = ''; var imgNo = 0; var optCnt = sr.length; for( var ri = 0; ri < sr.length; ri++){ if (sr[ri].parentElement.className == 'radio-wrap none') { optCnt--; } } more_txt[opt_id] = moreLabel + (showMLcnt == 1 ? (optCnt - imgLimit + 1) : ''); less_txt[opt_id] = lessLabel + (showMLcnt == 1 ? (optCnt - imgLimit + 1) : ''); var rlabels = sr[0].parentElement.parentElement.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; } sColors += '
'; sColors += '
'; for( var ri = 0; ri < sr.length; ri++){ if (sr[ri].parentElement.className != 'radio-wrap none') { imgNo++; sColors += '
imgLimit || (imgNo == imgLimit && imgNo != optCnt)) ? ' class="gwpHidden'+opt_id+' gwp-opt" ' : 'class="gwp-opt"') + '>
'; } } if (optCnt > imgLimit) { sColors += '
' + more_txt[opt_id] + '
'; } sColors += '
'; if (document.getElementById('gwp_div_'+opt_id)) { div = document.getElementById('gwp_div_'+opt_id); div.innerHTML = sColors; s.parentElement.appendChild(div); } else { const div = document.createElement('div'); div.innerHTML = sColors; div.id = 'gwp_div_'+opt_id; div.style = 'position:relative;'; div.className = 'gwp-div'; sr[0].parentElement.parentElement.parentElement.appendChild(div); sr[0].parentElement.parentElement.style.height = '0px'; sr[0].parentElement.parentElement.style.visibility = 'hidden'; } } }); } showGWP();