Hi there,

Please bare with me as I try to explain my problem...I'm not always that great at putting it into words!

I am using HTML/Javascipt/CSS to maintain a page whereby the content of the page is switched when a user selects a link. An example of the code used is below for your better understanding:

The container in which all of the content is loaded:

Code HTML4Strict:
<div id="container">
	<div id="sub1"></div>
	<div id="sub2" class="hide"></div>
	<div id="sub3" class="hide"></div>
   	<div id="sub4" class="hide"></div>
	<div id="sub5" class="hide"></div>
	<div id="sub6" class="hide"></div>
</div>


The Links that control which "sub" to display in the container:

Code HTML4Strict:
<a href="#" class="mininav" onclick="switchContent('sub3'); self.scrollTo(0,0); return false;">Yesterday</a> | 
		<a href="#" class="mininav" onclick="switchContent('sub1'); self.scrollTo(0,0); return false;">Today</a> | 
		<a href="#" class="mininav" onclick="switchContent('sub2'); self.scrollTo(0,0); return false;">Tomorrow</a><br />
        <a href="#" class="mininav" onclick="switchContent('sub4'); self.scrollTo(0,0); return false;">Monthly</a> | 
        <a href="#" class="mininav" onclick="switchContent('sub5'); self.scrollTo(0,0); return false;">Yearly</a> | 
        <a href="#" class="mininav" onclick="switchContent('sub6'); self.scrollTo(0,0); return false;">Financial</a>


The javascript from the header:


Code JavaScript:
<script type="text/javascript">
 
function switchContent(obj) {
 
		obj = (!obj) ? 'sub1' : obj;
 
		var contentDivs = document.getElementById('container').getElementsByTagName('div');
		for (i=0; i<contentDivs.length; i++) {
			if (contentDivs[i].id && contentDivs[i].id.indexOf('sub') != -1) {
				contentDivs[i].className = 'hide';
			}
		}
		document.getElementById(obj).className = '';
 
	}
 
</script>

And finally, the CSS attribute assigned to the class "hide":


Code CSS:
.hide {
	display: none;
}


Now all of this works perfectly for me! The user selects whether or not they want to view today's, tomorrow's, yesterday's content etc.. and whichever one they select it loads it into the container DIV and hides the rest... just like an iframe but better!

So - I want to add 1 thing to this page and this is what I need help with.

I need the page to detect which "sub" is being displayed and change the style of that particular link so the user can see which is the active link.

For instance - When the page loads, by default, all subs are hidden except sub1 which is today's content - So when the page loads, I want the "Today" link to be styled differently to the rest... However, if they then go on to click "Tomorrow" - as well as changing the content like it already does, I need it to also switch the style of the link from the "Today" link to the "Tomorrow" link.

I hope I'm making sense - it sounds ok in my head LOL.

Can anyone help?