function Submit() {
var options = document.getElementsByName('option');
var driversdoor = 0;
var passengerdoor = 0;
for (var i = 0; i < options.length; ++i) {
if (options[i].checked) {
if (options[i].value == 1) {
driversdoor += Number(options[i].value);
} else if (options[i].value == 256) {
passengerdoor += Number(options[i].value);
} else {
driversdoor += Number(options[i].value);
passengerdoor += Number(options[i].value);
}
}
}
document.getElementById("Drivers").innerHTML = driversdoor;
document.getElementById("Passenger").innerHTML = passengerdoor;
}
function Decode() {
var options = document.getElementsByName('option');
var originalcoding = Number(document.getElementById('D-in').value) | Number(document.getElementById('P-in').value);
originalcoding = originalcoding.toString(2).split("");
var dOptions = {};
var j = 0
for (var i = originalcoding.length-1; i >= 0; i--) {
var keyname = Math.pow(2, i);
dOptions[keyname] = originalcoding[j];
j++;
}
for (var i = 0; i < options.length; ++i) {
//we don't want to wipe out the base coding as the option is disabled
if (options[i].value != 16384) {
if (dOptions[options[i].value] == 1) {
options[i].checked = true;
} else {
options[i].checked = false;
}
}
}
Submit();
}
<table border="1" width="100%">
<tr>
<th>Original Drivers Door Coding (Module 42)</th>
<th>Original Passenger Door Coding (Module 52)</th>
</tr>
<tr>
<td>Original Coding:
<input type="text" id="D-in">
</td>
<td>Original Coding:
<input type="text" id="P-in">
</td>
</tr>
</table>
<input type="button" value="Decode" onclick="Decode();">
<br>
<br>
<table border="1" width="100%">
<tr>
<th>Option</th>
<th>How to identify if the option is fitted</th>
</tr>
<tr>
<td>
<input type="checkbox" name="option" id="cbox1" value=1 onchange="Submit();">
<label for="cbox1">Rear Lid Remote Unlock Button</label>
</td>
<td>Boot Release switch by main speaker</td>
</tr>
<tr>
<td>
<input type="checkbox" name="option" id="cbox2" value=2 onchange="Submit();">
<label for="cbox2">Ambient Mirror Illumination Installed</label>
</td>
<td>Puddle Lights on the underside of the door Mirrors</td>
</tr>
<tr>
<td>
<input type="checkbox" name="option" id="cbox3" value=4 onchange="Submit();" checked>
<label for="cbox3">Mirror Turn Signals installed</label>
</td>
<td>All Sciroccos have this option</td>
</tr>
<tr>
<td>
<input type="checkbox" name="option" id="cbox4" value=8 onchange="Submit();">
<label for="cbox4">Interior Door Handle Illumination installed</label>
</td>
<td>This option is not available for the Scirocco</td>
</tr>
<tr>
<td>
<input type="checkbox" name="option" id="cbox5" value=16 onchange="Submit();">
<label for="cbox5">Automatic Run active</label>
</td>
<td>Enables the one touch up/down function for the windows</td>
</tr>
<tr>
<td>
<input type="checkbox" name="option" id="cbox6" value=32 onchange="Submit();" checked>
<label for="cbox6">Mirror Heater installed</label>
</td>
<td>All Sciroccos have this option</td>
</tr>
<tr>
<td>
<input type="checkbox" name="option" id="cbox7" value=64 onchange="Submit();">
<label for="cbox7">Door Exit/Warning Light installed</label>
</td>
<td>This is the light on the bottom outer edge of the door card. Most models have a reflector fitted in this location. If you have a bulb behind the reflector then enable this option</td>
</tr>
<tr>
<td>
<input type="checkbox" name="option" id="cbox8" value=128 onchange="Submit();">
<label for="cbox8">5-Door Chassis</label>
</td>
<td>This option is not available for the Scirocco</td>
</tr>
<tr>
<td>
<input type="checkbox" name="option" id="cbox9" value=256 onchange="Submit();">
<label for="cbox9">Seat Memory AND/OR Mirror with Memory Function installed</label>
</td>
<td>Enable this option if you have Ambient Mirror illumination or Folding Mirrors</td>
</tr>
<tr>
<td>
<input type="checkbox" name="option" id="cbox10" value=512 onchange="Submit();">
<label for="cbox10">Right Hand Steering</label>
</td>
<td>Enable this option if the steering wheel is on the right.</td>
</tr>
<tr>
<td>
<input type="checkbox" name="option" id="cbox11" value=1024 onchange="Submit();">
<label for="cbox11">Safe-Motor not installed</label>
</td>
<td>This option is not available for the Scirocco</td>
</tr>
<tr>
<td>
<input type="checkbox" name="option" id="cbox12" value=2048 onchange="Submit();">
<label for="cbox12">Pinch Protection inactive</label>
</td>
<td>Leave this option disabled. Pinch protection</td>
</tr>
<tr>
<td>
<input type="checkbox" name="option" id="cbox13" value=4096 onchange="Submit();">
<label for="cbox13">Folding Mirrors installed</label>
</td>
<td>Check the mirror switch, if it is a 5 position switch (L, 0, R, heating & folding) then enable this option</td>
</tr>
<tr>
<td>
<input type="checkbox" name="option" id="cbox14" value=16384 checked disabled>
<label for="cbox14">Base Coding</label>
</td>
<td></td>
</tr>
<tr>
<td>
<input type="checkbox" name="option" id="cbox15" value=131072 onchange="Submit();">
<label for="cbox15">Start/Stop Function installed</label>
</td>
<td>Enable if there is a button by the gearstick labelled with a capital A surrounded by an arrow</td>
</tr>
</table>
<br>
<table border="1" width="100%">
<tr>
<th>New Drivers Door Coding (Module 42)</th>
<th>New Passenger Door Coding (Module 52)</th>
</tr>
<tr>
<td id="Drivers"> </td>
<td id="Passenger"> </td>
</tr>
</table>