since jquery is tagged i am using jquery to reduce you code..
function show(number) {
$('[id^="d"]').hide();
if(number >=3){
$('#d0').show();
}
$('#d' + number).show();
}
however this is cosidering all you other div such as d3,d4,d5,d6..
comes under d0
..
what i am doing here is using a attribute selector $('[id^="d"]')
which select all element ids starting with d
and hiding it... so this hide all the elements.. and then checkin if the number parameter is > 3 ..if its greater than 3 then , show #d0
element.., then show just the element whose id is = number