gwpNo = {51: "0", 52: "0", 53: "0", 54: "0", 55: "0", 56: "0", 57: "0", 58: "0", 59: "0", 60: "0", 61: "0", 62: "0", 63: "0", 64: "0", 65: "0", 66: "0", 69: "0", 70: "0", 71: "0", 72: "0", 85: "0", 86: "0", 87: "0", 78: "0", 79: "0", 80: "0", 81: "0", 88: "0", 89: "0", 90: "0", 91: "0", 92: "0", 93: "0", 94: "0", 95: "0", 96: "0", 97: "0", 98: "0", 99: "0", 100: "0", 101: "0", 102: "0", 103: "0", 104: "0", 105: "0", 106: "0", 107: "0", 108: "0", 109: "0", 110: "0", 111: "0", 112: "0", 113: "0", 114: "0", 115: "0", 116: "0", 117: "0", 118: "0", 119: "0", 120: "0", 121: "0", 122: "0", 123: "0", 124: "0", 125: "0", 126: "0", 127: "0", 128: "0", 129: "0", 130: "0", 131: "0", 132: "0", 136: "0", 137: "0", 138: "0", 139: "0", 140: "0", 141: "0", 142: "0", 143: "0", 144: "0", 145: "0", 147: "0", 133: "0", 134: "0", 135: "0", 158: "0", 175: "3", 176: "1", 178: "2", 179: "2", 185: "1", 186: "1", 187: "1", 188: "1", 189: "1", 190: "1", 191: "1", 193: "1", 194: "1", 195: "1", 196: "1", 197: "1", 198: "1", 199: "1", 200: "1", 211: "1", 223: "2", 228: "1", 231: "1", 232: "1", 229: "1", 227: "1", 230: "1", 225: "1", 226: "1", 224: "1", 233: "4", 234: "5", 235: "2", 236: "2", 237: "1", 238: "1", 239: "1", 240: "1", 241: "1", 242: "1", 243: "1", 244: "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", };var opt_list = [9,11,13,14,15,23,27,31,32,33]; var more_txt = [], less_txt = [], optTmp = [], isStock = 0; var sid = '99'; var url = 'https://gwp.brweb.pl/i/99/'; var selcolor = '#080505'; 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 += '
'; 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 += '
'; 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();