Use document.getElementById for get d1,d2,d3,d4.
You used 4 functions but all are quit same. It is also bad practice.
Try some thing like this
function show1(id)
{
if(document.getElementById(id).style.display!='block')
{
document.getElementById("d1").style.display='none';
document.getElementById("d2").style.display='none';
document.getElementById("d3").style.display='none';
document.getElementById("d4").style.display='none';
document.getElementById(id).style.display='block';
}
else
{
document.getElementById(id).style.display='none';
}
}