I want to toggle two elements making one display none and the other display block. And by clicking again switch the displays:

Code:
		<script type="text/javascript" language="javascript1.3">
			function toggle(id){
				regid = "regid_" + id;
				img = "img_" + id;
				forumid = "forumid_" + id;
				divElement = document.getElementById(regid);
				imgElement = document.getElementById(img);
				forumElement = document.getElementById(forumid);
				if (divElement){
						if (divElement.className == 'closed'){
								divElement.className = "open";
								forumElement.classname = "closed";
								imgElement.src = "includefiles/images/opened.gif";
								}else{
								divElement.className = "closed";
								forumElement.classname = "open";
								imgElement.src = "includefiles/images/closed.gif";
								}
						}
				}
				/*function toggle(id) {
					var el = document.getElementById("regid_" + id);
					if ( div.style.display = 'block' ) {
						div.style.display = 'none';
					}
					else {
						div.style.display = 'block';
					}
				}*/				
		</script>
		<style type="text/css">		
			.open {
				display: block;
			}
			.closed {
				display: none;
			}
		</style>		
			<table class="" id="" border="1" style="border: 1px;">
<tr>
<td id="tdid_0">
<div id="regid_0" class="closed" style="display: block;"><a onclick="toggle('item0');"><img src="includefiles/images/closed.gif" id="img_item0" alt="Click to Expand" border="0" /></a>blablah</div><br />

<div id="forumid_0" class="open" style="display: none;">gagah googoooh</div><br /></td>

</tr>