gwpNo = {41740: "0", 41741: "0", 41742: "0", 41743: "0", 41744: "0", 41745: "0", 41746: "0", 41747: "0", 41748: "0", 41749: "0", 41750: "0", 41751: "0", 41752: "0", 41753: "0", 41754: "0", 41755: "0", 41756: "0", 41757: "0", 41758: "0", 41759: "0", 41760: "0", 41761: "0", 41762: "0", 41763: "0", 41764: "0", 41765: "0", 41766: "0", 41767: "0", 41768: "0", 41783: "0", 41784: "0", 41736: "0", 41737: "0", 24070: "0", 24069: "0", 41787: "0", 41788: "2", 41789: "2", 41790: "2", 41732: "0", 41733: "0", 41734: "0", 41735: "0", 41738: "0", 41739: "0", 41779: "0", 41780: "0", 41781: "0", 41782: "0", 41785: "0", 41786: "0", 41795: "3", 41841: "3", 41842: "3", 41844: "3", 41840: "3", 41843: "3", 41851: "1", 41852: "1", 41853: "1", 41854: "1", 41855: "1", 41856: "1", 41857: "1", 41858: "1", 41859: "1", 41860: "1", 41861: "1", 41862: "1", 41877: "3", 41878: "2", 41896: "3", 41914: "3", 41933: "1", 41958: "1", 41959: "1", 41960: "1", 41961: "1", 41962: "1", 41963: "1", 41964: "1", 41965: "1", 41966: "1", 41967: "1", 41968: "1", 41969: "1", 41970: "1", 41971: "1", 41972: "1", 41973: "1", 41974: "1", 41975: "1", 41976: "1", 41977: "1", 41978: "1", 41979: "1", 41980: "1", 41981: "1", 41982: "1", 41983: "1", 41984: "1", 41985: "1", 41986: "1", 41988: "1", 41989: "1", 41990: "1", 41991: "1", 41992: "1", 41993: "1", 41994: "1", 41995: "1", 41996: "1", 41997: "1", 41998: "1", 41999: "2", 42000: "2", 42001: "1", 42002: "1", 42003: "1", 42004: "1", 42005: "1", 42006: "1", 42007: "1", 42008: "1", 42009: "1", 42011: "1", 42012: "1", 42013: "1", 42014: "1", 42015: "1", 42016: "1", 42017: "1", 42018: "1", 42019: "1", 42020: "1", 42021: "1", 42022: "1", 42023: "1", 42024: "1", 42025: "1", 42026: "1", 42027: "1", 42028: "2", 42029: "1", 42030: "1", 42031: "1", 42032: "1", 42033: "1", 42034: "1", 42035: "1", 42036: "1", 42037: "1", 42038: "1", 42039: "1", 42040: "1", 42041: "1", 42042: "1", 42043: "1", 42044: "1", 42045: "1", 42046: "1", 42047: "1", 42048: "1", 42049: "1", 42050: "1", 42051: "1", 42052: "1", 42053: "1", 42054: "1", 42055: "1", 42056: "1", 42057: "1", 42058: "1", 42059: "1", 42060: "1", 42061: "1", 42062: "1", 42063: "1", 42064: "1", 42065: "1", 42066: "1", 42067: "1", 42068: "1", 42069: "1", 42070: "1", 42071: "1", 42072: "1", 42073: "1", 42074: "1", 42075: "1", 42076: "1", 42077: "1", 42078: "1", 42079: "1", 42080: "1", 42081: "1", 42082: "1", 42083: "1", 42084: "1", 42085: "1", 42086: "1", 42087: "1", 42088: "1", 42089: "1", 42090: "1", 42094: "1", 42095: "1", 42096: "1", 42097: "1", 42098: "1", 42099: "1", 42100: "1", 42101: "1", 42102: "1", 42103: "1", 42104: "1", 42105: "1", 42106: "1", 42107: "1", 42108: "1", 42109: "1", 42110: "1", 42111: "1", 42112: "1", 42114: "1", 42115: "1", 42116: "1", 42117: "1", 42118: "1", 42119: "1", 42120: "1", 42121: "1", 42122: "1", 42123: "1", 42124: "1", 42125: "1", 42126: "1", 42127: "1", 42128: "1", 42129: "1", 42135: "1", 42136: "1", 42137: "1", 42138: "1", 42139: "1", 42140: "1", 42141: "1", 42142: "1", 42143: "1", 42144: "1", 42145: "1", 42146: "1", 42147: "1", 42148: "1", 42149: "1", 42150: "1", 42151: "1", 42152: "1", 42153: "1", 42154: "1", 42155: "1", 42156: "1", 42157: "1", 42158: "1", 42159: "1", 42160: "1", 42161: "1", 42162: "1", 42163: "1", 42164: "1", 42165: "1", 42166: "1", 42167: "1", 42168: "1", 42169: "1", 42170: "1", 42171: "1", 42172: "1", 42173: "1", 42174: "1", 42175: "1", 42176: "1", 42177: "1", 42178: "1", 42179: "1", 42180: "1", 42181: "1", 42182: "1", 42185: "1", 42186: "1", 42187: "1", 42183: "1", 42184: "1", 42188: "1", 42189: "1", 42190: "1", 42191: "1", 42192: "1", 42193: "1", 42194: "1", 42195: "1", 42196: "1", 42197: "1", 42198: "1", 42199: "1", 42200: "1", 42201: "1", 42202: "1", 42203: "1", 42204: "1", 42205: "1", 42206: "1", 42210: "2", 42207: "1", 42208: "1", 42209: "1", 42211: "1", 42212: "1", 42213: "1", 42214: "1", 42215: "1", 42216: "1", 42217: "1", 42218: "1", 42219: "1", 42220: "1", 42221: "1", 42229: "1", 42230: "1", 42231: "1", 42232: "1", 42233: "1", 42234: "1", 42235: "1", 42236: "1", 42237: "1", 42238: "1", 42239: "1", 42240: "1", 42241: "1", 42242: "1", 42243: "1", 42244: "1", 42245: "1", 42246: "1", 42247: "1", 42248: "1", 42249: "1", 42250: "1", 42251: "1", 42252: "1", 42253: "1", 42254: "1", 42255: "1", };var opt_list = [581,584,580,585,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,609,608,610,611,612,613,614]; var more_txt = [], less_txt = [], optTmp = [], isStock = 0; var sid = '157'; var url = 'https://gwp.brweb.pl/i/157/'; var selcolor = '#777777'; var imgLimit = '30'; 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 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 += '
'; 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();