function hidestories2() {
var divs=document.getElementById('stories2').getElementsByTagName('div');
for (j=0; j<divs.length; j++) {
var rE = new RegExp("(^|\\s)" + 'story' + "(\\s|$)");
if (rE.test(divs[j].className)) {
divs[j].style.display="none";
}
var thebuttons=document.getElementById('thebuttons').getElementsByTagName('a');
for (k=0; k<thebuttons.length; k++) { // loop throught the buttons and remove the 'current' class
var li=thebuttons[k].parentNode;
li.className=li.className.replace(new RegExp("current"+"\\b"), "");
}
}
}

function stories2(first) {
var thebuttons=document.getElementById('thebuttons').getElementsByTagName('a');
for (i=0; i<thebuttons.length; i++) {
thebuttons[i].onclick=function() {
hidestories2();
var thestory=(this.href).split("#",2)[1];
document.getElementById(thestory).style.display="block";
this.parentNode.className+=" current"; // set the 'current' class to the clicked button
return false;
}
}
if (first) {
var firstone=document.getElementById('stories2').firstChild;
if (firstone.nodeType != 1) {firstone = firstone.nextSibling;}
firstone.style.display="block";
var firstbutton=document.getElementById('thebuttons').firstChild;
if (firstbutton.nodeType != 1) {firstbutton = firstbutton.nextSibling;}
firstbutton.className+=" current"; // set the 'current' class to the first button
}
}
window.onload=function() {
hidestories2(); 
stories2(1);
}