function initShowHide() {
	if (document.getElementById && document.getElementsByTagName && document.createTextNode) {
		hide();
		var toggle = document.getElementById('toggle');
		var as = toggle.getElementsByTagName('a');
		for (var i = 0; i < as.length; i++) {
			as[i].onclick = function() {
				show(this);
				return false;
			}
		}			
	}
show(as[0]);
}

function show(s) {
	var oldCurrent = document.getElementById('current-item');
	if (oldCurrent) oldCurrent.removeAttribute('id');
	s.parentNode.setAttribute('id', 'current-item');

	hide();
	var id = s.href.match(/#(\w.+)/)[1];
	document.getElementById(id).style.display = 'block';
}

function hide() {
	var toggleable = document.getElementById('toggleable').getElementsByTagName('div');
	
	if(window.console) {
		window.console.log(toggleable.length);
	} 

	for (var i = 0; i < toggleable.length; i++) {
		toggleable[i].style.display = 'none';
	}
}

window.onload = initShowHide;


function expandcollapse (postid) { 

   whichpost = document.getElementById(postid); 
   
   if (whichpost.className=="toggle-shown") { 
	  whichpost.className="toggle-hidden"; 
   } 
   else { 
	  whichpost.className="toggle-shown"; 
   } 
} 
