gwpNo = {49: "1", 50: "1", 51: "1", 52: "1", 53: "2", 54: "1", 55: "1", 56: "1", 57: "1", 58: "1", 59: "1", 60: "1", 61: "1", 62: "1", 63: "1", 64: "1", 65: "1", 66: "1", 67: "1", 68: "1", 69: "1", 70: "2", 71: "3", 72: "2", 73: "1", 74: "1", 75: "1", 76: "1", 77: "1", 78: "1", 79: "1", 80: "1", 81: "1", 82: "1", 83: "1", 84: "1", 85: "1", 86: "1", 87: "1", 88: "1", 89: "1", 90: "1", 91: "1", 92: "1", 93: "1", 94: "1", 95: "1", 96: "1", 97: "1", 98: "1", 99: "1", 100: "1", 101: "1", 102: "1", 103: "1", 104: "1", 105: "1", 106: "1", 107: "1", 108: "1", 109: "1", 110: "1", 111: "1", 112: "1", 113: "1", 114: "1", 115: "2", 116: "2", 117: "1", 118: "1", 119: "1", 120: "1", 121: "1", 122: "1", 123: "1", 124: "1", 125: "1", 129: "1", 126: "1", 127: "4", 128: "1", 130: "1", 131: "1", 132: "1", 133: "1", 134: "1", 135: "1", 136: "1", 137: "1", 138: "1", 139: "1", 140: "1", 141: "1", 142: "1", 143: "2", 144: "1", 145: "1", 146: "1", 147: "2", 148: "1", 149: "1", 150: "1", 151: "2", 152: "1", 153: "1", 154: "1", 155: "2", 156: "1", 157: "1", 158: "1", 159: "2", 160: "1", 161: "1", 162: "1", 163: "1", 164: "1", 165: "1", 166: "1", 167: "1", 168: "2", 169: "1", 170: "1", 171: "1", 172: "2", 173: "1", 174: "1", 175: "1", 176: "2", 177: "1", 178: "1", 179: "1", 180: "2", 181: "1", 182: "1", 183: "1", 184: "1", 185: "1", 186: "1", 187: "1", 188: "1", 189: "1", 190: "1", 191: "1", 192: "1", 193: "1", 194: "1", 195: "1", 196: "1", 197: "1", 198: "1", 199: "1", 200: "1", 201: "1", 202: "1", 203: "1", 204: "1", 205: "1", 206: "1", 207: "1", 208: "1", 209: "1", 210: "1", 211: "1", 212: "1", 213: "1", 214: "1", 215: "1", 216: "1", 217: "1", 218: "1", 219: "1", 220: "1", 221: "1", 222: "1", 223: "2", 224: "1", 225: "1", 226: "1", 227: "2", 229: "1", 230: "1", 231: "1", 232: "1", 233: "1", 234: "1", 235: "1", 236: "1", 237: "1", 257: "1", 258: "1", 259: "1", 260: "1", 261: "1", 262: "1", 238: "2", 239: "1", 240: "1", 241: "1", 242: "1", 243: "1", 244: "1", 245: "1", 246: "2", 247: "1", 248: "1", 249: "1", 250: "1", 251: "1", 252: "1", 253: "1", 254: "1", 255: "1", 256: "1", 263: "1", 264: "1", 265: "1", 266: "1", 267: "1", 268: "1", 269: "1", 270: "1", 271: "1", 272: "1", 273: "1", 274: "1", 275: "1", 276: "1", 277: "1", 278: "1", 279: "1", 280: "1", 281: "1", 282: "1", 283: "1", 284: "1", 285: "1", 286: "1", 287: "1", 288: "1", 289: "1", 290: "1", 291: "1", 292: "1", 293: "1", 294: "1", 295: "1", 296: "1", 297: "1", 298: "1", 299: "1", 300: "1", 301: "1", 302: "1", 303: "1", 304: "1", 306: "1", 307: "1", 305: "1", 308: "1", 309: "1", 310: "1", 311: "1", 312: "1", 313: "1", 314: "1", 315: "1", 316: "1", 317: "1", 318: "1", 319: "1", 321: "1", 320: "1", 322: "1", 323: "1", 324: "1", 325: "1", 326: "1", 327: "1", 328: "1", 329: "1", 330: "1", 331: "1", 332: "1", 333: "1", 334: "1", 335: "1", 336: "1", 337: "1", 338: "1", 339: "1", 340: "1", 341: "1", 342: "1", 343: "1", 344: "1", 345: "1", 346: "1", 347: "1", 348: "1", 349: "1", 350: "1", 351: "1", 352: "1", 353: "1", 354: "1", 355: "1", 356: "1", 357: "1", 358: "1", 359: "1", 360: "1", 362: "1", 363: "1", 361: "1", 364: "1", 365: "1", 366: "1", 367: "1", 368: "1", 369: "1", 370: "1", 371: "1", 372: "1", 373: "1", 375: "1", 374: "1", 378: "1", 377: "1", 379: "1", 376: "1", 380: "1", 381: "1", 382: "1", 383: "1", };var opt_list = [9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77]; var more_txt = [], less_txt = [], optTmp = [], isStock = 0; var sid = '294'; var url = 'https://gwp.brweb.pl/i/294/'; 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 += '
'; 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 += '
'; 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();