You do this with Javascript (and jQuery if you want). Not PHP.
With jQuery, it's as simple as...
$('#div1').css('display','none...
or
$('#div1').css('display','block...