gwpNo = {66: "3", 67: "3", 68: "3", 69: "3", 70: "3", 71: "3", 72: "2", 73: "2", 74: "2", 75: "1", 77: "1", 78: "1", 76: "1", 79: "1", 81: "1", 82: "1", 80: "1", 83: "1", 86: "1", 84: "1", 85: "1", 88: "1", 89: "1", 87: "1", 90: "1", 91: "1", 92: "1", 93: "1", 94: "1", 95: "1", 96: "1", 97: "1", 99: "1", 98: "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: "1", 116: "1", 117: "1", 118: "1", 119: "1", 120: "1", 121: "1", 122: "1", 123: "1", 124: "1", 125: "1", 126: "1", 127: "1", 128: "1", 129: "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: "1", 144: "1", 145: "1", 146: "1", 147: "1", 148: "1", 149: "1", 150: "1", 151: "1", 152: "1", 153: "1", 154: "1", 155: "1", 156: "1", 157: "1", 158: "1", 159: "1", 160: "1", 161: "1", 162: "1", 163: "1", 164: "1", 165: "1", 166: "1", 167: "1", 168: "1", 169: "1", 170: "1", 171: "1", 172: "1", 173: "1", 174: "1", 175: "1", 176: "1", 177: "1", 196: "1", 178: "1", 179: "1", 180: "1", 181: "1", 182: "1", 183: "1", 197: "1", 184: "1", 185: "1", 186: "1", 187: "1", 188: "1", 189: "1", 190: "1", 193: "1", 194: "1", 195: "1", 191: "1", 192: "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", 214: "1", 215: "1", 216: "1", 213: "1", 217: "1", 218: "1", 219: "1", 222: "1", 223: "1", 224: "1", 220: "2", 221: "1", 225: "1", 226: "1", 227: "1", 228: "1", 229: "1", 230: "1", 231: "1", 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", 249: "1", 256: "1", 257: "1", 251: "1", 252: "1", 253: "1", 254: "1", 255: "1", };var opt_list = [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]; var more_txt = [], less_txt = [], optTmp = [], isStock = 0; var sid = '264'; var url = 'https://gwp.brweb.pl/i/264/'; var selcolor = '#0AC420'; var imgLimit = '1000'; 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 += '
'; 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') { 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 += '
'; 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();