I have a small script which adds a class to the current menu item selected.

function activate(single){
var links=document.getElementsByTagName('a');

Currently on the page load (this menu is within one page) the first menu item which is loaded does not have this .mywork_active class. Its not until you click it or another item that the class is added.

What would I need to do make the script add this class to the first item on load.

The menu looks like so:

<div class="mywork_nav">
<li><a class="xtrig" href="#1" onclick="activate(this);" rel="slider-1">1</a></li>
<li><a class="xtrig" href="#2" onclick="activate(this);" rel="slider-1">2</a></li>
<li><a class="xtrig" href="#3" onclick="activate(this);" rel="slider-1">3</a></li>
<li><a class="xtrig" href="#4" onclick="activate(this);" rel="slider-1">4</a></li>
<li><a class="xtrig" href="#5" onclick="activate(this);" rel="slider-1">5</a></li>

Thank you!!