<html>
<head>
<title>page</title>
<script type="text/javascript">
var arrCheck=[0,0,0,0];
function union_chbox_orientations(a) {
var i= +a.id.replace(/^\D*/,'');
arrCheck[i]=+1*(a.checked==true);
if(!arrCheck[i])return false;
var testKey ="" + arrCheck.join(''); //alert(testKey)
if(i==0)arrCheck=[1,0,0,0];
if(i!=0)arrCheck[0]=0;
if(testKey=='0111'||testKey=='1111')arrCheck=[1,0,0,0];
for (i = 0; i < arrCheck.length; i++) {
document.getElementById('box_orientation'+i).checked=(arrCheck[i]==1);
}
return true;
}
</script>
</head>
<body>
<div class="conteiner_orientations">
<p>Orientation:</p>
<input type='checkbox' name='name' value='all orientations' id='box_orientation0' onclick='union_chbox_orientations(this)'><img src='/'/>
<label for='box_orientation0'>all orientations</label><br>
<input type='checkbox' name='name' value='vertical' id='box_orientation1' onclick='union_chbox_orientations(this)'><img src='/'/>
<label for='box_orientation1'>vertical</label><br>
<input type='checkbox' name='name' value='horizontal' id='box_orientation2' onclick='union_chbox_orientations(this)'><img src='/'/>
<label for='box_orientation2'>horizontal</label><br>
<input type='checkbox' name='name' value='square' id='box_orientation3' onclick='union_chbox_orientations(this)'><img src='/'/>
<label for='box_orientation3'>square</label><br>
</div>
</body>
</html>
Пытаюсь упрозрачнить кодирование