Hi,

I am on a tight deadline with none of my Javascript books around to reference... Can anyone help me with this script:

HTML:

Code:
<dl class="navList">
	<dt>Quick Links</dt>
		<dd class="navFirst currentItem"><a href="javascript:switchid('topJobs');" title="Top Jobs">Jobs</a></dd>
		<dd><a href="javascript:switchid('topHomes');" title="Top Homes"><strong>Homes</strong></a></dd>
		<dd><a href="javascript:switchid('topCars');" title="Top Cars">Cars</a></dd>
</dl>

<div id="topJobs" style="display:block;">
	<a class="more" href="">See All ⇒</a>
</div>
	
<div id="topHomes" style="display:none;">
	<a class="more" href="">See All ⇒</a>
</div>
	
<div id="topCars" style="display:none;">
	<a class="more" href="">See All ⇒</a>
</div>
JS:

PHP Code:
/*
**
**              Ref: http://support.internetconnection.net/CODE_LIBRARY/Javascript_Show_Hide.shtml
**
**      Description:
**                   Specify divs you want to show/hide in below array.
**                   Use this JS throughout site for showing/hiding of layers.
**    Example usage:
**                   <a href="javascript:switchid('a2');">show a2</a>
**
*/


/*
** Here you place the IDs of every element you want: */
var ids = new Array('topCars','topJobs','topHomes');

function 
switchid(id) { hideallids(); showdiv(id); }

/*
** Loop through the array and hide each element by id: */
function hideallids(){ for(var i=0i<ids.lengthi++) { hidediv(ids[i]); } }

/*
** Safe function to hide an element with a specified id: */
function hidediv(id) {
    if(
document.getElementById) { document.getElementById(id).style.display 'none'; } // DOM3 = IE5, NS6.
    
else {
        if(
document.layers) { document.id.display 'none'; } // Netscape 4.
        
else { document.all.id.style.display 'none'; } // IE 4.
    
}
}

/*
** Safe function to show an element with a specified id: */
function showdiv(id) {
    if(
document.getElementById) { document.getElementById(id).style.display 'block'; } // DOM3 = IE5, NS6.
    
else {
        if (
document.layers) { document.id.display 'block'; } // Netscape 4.
        
else { document.all.id.style.display 'block'; } // IE 4.
    
}

Basically I want to add/append the class "currentItem" to one of the three links in above HTML (dl.navList) if/when clicked... I have tried a few diff things, but I have yet to get this to work. Any thoughts? One prob I have is appending the class to the link that already has the class "navFirst"... this is a static/required class.

Any help would be great. My goal is to make this JS as simple as possible... Hehe.

Many TIA's,
Cheers,
M