gwpNo = {223: "6", 224: "7", 225: "5", 228: "4", 229: "4", 230: "4", 231: "4", 232: "1", 233: "1", 234: "1", 235: "1", 236: "1", 237: "1", 238: "1", 239: "1", 240: "1", 241: "1", 242: "1", 243: "1", 244: "1", 245: "1", 246: "1", 247: "1", 250: "1", 248: "1", 252: "1", 253: "1", 251: "1", 249: "1", 254: "1", 255: "1", 256: "1", 257: "1", 259: "1", 258: "1", 260: "2", 261: "1", 262: "1", 263: "3", 264: "2", 265: "2", 266: "2", 267: "2", 268: "2", 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: "2", 302: "1", 303: "1", 304: "1", 305: "1", 306: "1", 307: "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", 320: "1", 321: "1", 322: "1", 326: "3", 327: "1", 328: "1", 329: "1", 331: "1", 330: "1", 334: "2", 335: "2", 336: "2", 337: "2", 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", 361: "1", 362: "1", 363: "1", 364: "1", 365: "1", 366: "1", 367: "1", 368: "1", 369: "1", 370: "1", 371: "1", 372: "1", 373: "1", 374: "1", 375: "1", 376: "1", 377: "1", 378: "1", 379: "1", 380: "1", 381: "1", 382: "1", 383: "1", 384: "1", 385: "1", 386: "1", 387: "1", 388: "1", 389: "1", 390: "1", 391: "1", 392: "1", 393: "1", 394: "1", 395: "1", 396: "1", 397: "1", 398: "1", 399: "1", 400: "1", 401: "1", 402: "1", 403: "1", 404: "1", 405: "1", 406: "1", 407: "1", 408: "1", 409: "1", 410: "1", 411: "1", 412: "1", 413: "1", 414: "1", 415: "1", 416: "1", 417: "1", 420: "1", 421: "1", 422: "1", 423: "1", 424: "1", 425: "1", 426: "1", 427: "1", 430: "1", 431: "1", 432: "1", 433: "1", 434: "1", 435: "1", 436: "1", 437: "1", 438: "1", 439: "1", 440: "1", 441: "1", 454: "1", 453: "1", 452: "2", 449: "1", 450: "1", 448: "1", 446: "1", 451: "1", 447: "1", 457: "1", 458: "1", 461: "1", 462: "1", 463: "1", 464: "1", 467: "1", 470: "1", 471: "1", 472: "1", 474: "1", 475: "1", 476: "1", 473: "1", 477: "3", 478: "1", 479: "1", 480: "1", 482: "2", 483: "2", 485: "1", 492: "1", 493: "1", 494: "1", 495: "1", 496: "1", 497: "1", 498: "1", 499: "2", 500: "1", 501: "1", 502: "1", 505: "1", 506: "1", };var opt_list = [77,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,105,106,107,108,110]; var more_txt = [], less_txt = [], optTmp = [], isStock = 0; var sid = '246'; var url = 'https://gwp.brweb.pl/i/246/'; var selcolor = '#FAF7F7'; var imgLimit = '6'; var moreLabel = '+'; var lessLabel = '-'; var showMLcnt = 1; var prevMopen = ''; 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) { 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 { 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; 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();