Meattale,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<script>
window.addEventListener("DOMContentLoaded", function() {
[].forEach.call( document.querySelectorAll('.sel'), function(el) {
var inputs = el.querySelectorAll("input.wicartoptional"),
selects = el.querySelectorAll("select.wicartoptional"),
ops = selects[1].querySelectorAll("option"),
obj = {
0: {
0: [0],
1: [0],
2: [1, 2],
3: [1, 2]
},
1: {
0: [0],
1: [2],
2: [2],
3: [2]
}
},
op = obj[0];
function change() {
var i = selects[0].selectedIndex || 0;
i = op[i];
selects[1].options.length = 0;
i.forEach(function(o) {
selects[1].appendChild(ops[o])
})
}
selects[0].addEventListener("change", change);
[].forEach.call(inputs,
function(input, i) {
if(input.checked) {op = obj[i];
el.querySelector(".im").src = ["http://javascript.ru/forum/images/smilies/dance3.gif","http://javascript.ru/forum/images/smilies/victory.gif"][i]; change();
}
input.addEventListener("change", function() {
el.querySelector(".im").src = ["http://javascript.ru/forum/images/smilies/dance3.gif","http://javascript.ru/forum/images/smilies/victory.gif"][i];
input.checked && (op = obj[i]);
change()
})
})
});
});
</script>
</head>
<body> <div class="sel">
<img class="im" src="url" />
<div style="background: #F0F0F0; margin: 5px; border-radius: 5px; padding: 10px; width: 300px;">
<input class="wicartoptional" checked="" type="radio" value="1000" name="psbs" data-good-id="002" data-subid="psbswall" data-option-name="Стеновая ПСБС">Стеновая (+1000)<br>
<input class="wicartoptional" type="radio" value="2000" name="psbs" data-good-id="002" data-subid="psbsroof" data-option-name="Кровельная ПСБС">Кровельная (+2000)<br>
</div>
<div style="background: #F0F0F0; margin: 5px; border-radius: 5px; padding: 10px; width: 300px;">
Толщина: <select class="wicartoptional" data-good-id="002" name="tol">
<option value="100" data-subid="50" data-option-name="Толщина:50" selected>50 (+100)</option>
<option value="200" data-subid="75" data-option-name="Толщина:75" >75 (+200)</option>
<option value="300" data-subid="100" data-option-name="Толщина:100" >100 (+300)</option>
<option value="300" data-subid="150" data-option-name="Толщина:150" >150 (+300)</option>
</select></div>
<div style="background: #F0F0F0; margin: 5px; border-radius: 5px; padding: 10px; width: 300px;">
Длина: <select class="wicartoptional" data-good-id="002" name="dlin">
<option value="1000" data-subid="36" data-option-name="Длина:3:6" selected>Первый (+1000)</option>
<option value="2000" data-subid="34" data-option-name="Длина:3:4">Второй (+2000)</option>
<option value="3000" data-subid="612" data-option-name="Длина:6:12">Третий (+3000)</option>
</select></div>
</div>
<div class="sel">
<img class="im" src="url" />
<div style="background: #F0F0F0; margin: 5px; border-radius: 5px; padding: 10px; width: 300px;">
<input class="wicartoptional" checked="" type="radio" value="1000" name="psbs2" data-good-id="002" data-subid="psbswall" data-option-name="Стеновая ПСБС">Стеновая (+1000)<br>
<input class="wicartoptional" type="radio" value="2000" name="psbs2" data-good-id="002" data-subid="psbsroof" data-option-name="Кровельная ПСБС">Кровельная (+2000)<br>
</div>
<div style="background: #F0F0F0; margin: 5px; border-radius: 5px; padding: 10px; width: 300px;">
Толщина: <select class="wicartoptional" data-good-id="002" name="tol">
<option value="100" data-subid="50" data-option-name="Толщина:50" selected>50 (+100)</option>
<option value="200" data-subid="75" data-option-name="Толщина:75" >75 (+200)</option>
<option value="300" data-subid="100" data-option-name="Толщина:100" >100 (+300)</option>
<option value="300" data-subid="150" data-option-name="Толщина:150" >150 (+300)</option>
</select></div>
<div style="background: #F0F0F0; margin: 5px; border-radius: 5px; padding: 10px; width: 300px;">
Длина: <select class="wicartoptional" data-good-id="002" name="dlin">
<option value="1000" data-subid="36" data-option-name="Длина:3:6" selected>Первый (+1000)</option>
<option value="2000" data-subid="34" data-option-name="Длина:3:4">Второй (+2000)</option>
<option value="3000" data-subid="612" data-option-name="Длина:6:12">Третий (+3000)</option>
</select></div>
</div>
</body>
</html>