Hi I have a very simple js rollover nav bar which is giving me probs.. It used to work fine but as I have changed the site I am wondering if I have messed up part of the js code ?

Can anyone take a look through it please.. many thanks..

BTW this code is NOT in the head... does it have to be ?

<script language=JavaScript>
if(document.images) {

var img1on = new Image();
img1on.src = 'images/nav/homeon.gif';
var img2on = new Image();
img2on.src = 'images/nav/sitemapon.gif';
var img3on = new Image();
img3on.src = 'images/nav/abouton.gif';
var img4on = new Image();
img4on.src = 'images/nav/advertiseon.gif';
var img5on = new Image();
img5on.src = 'images/nav/contacton.gif';

var img1off = new Image();
img1off.src = 'images/nav/homeoff.gif';
var img2off = new Image();
img2off.src = 'images/nav/sitemapoff.gif';
var img3off = new Image();
img3off.src = 'images/nav/aboutoff.gif';
var img4off = new Image();
img4off.src = 'images/nav/advertiseoff.gif';
var img5off = new Image();
img5off.src = 'images/nav/contactoff.gif';

function imgOn(imgName) {
if (document.images) {
document[imgName].src = eval(imgName + 'on.src;');

function imgOff(imgName) {
if (document.images) {
document[imgName].src = eval(imgName + 'off.src;');


<!-- java nav bar -->
<a href="index.php" onMouseOver="imgOn('img1')" onMouseOut="imgOff('img1')"><IMG SRC="images/nav/homeoff.gif" WIDTH=47 HEIGHT=32 border=0 name=img1></a></TD>
<IMG SRC="images/nav/spacer1.gif" WIDTH=8 HEIGHT=32 border=0></a></TD>
<a href="sitemap.php" onMouseOver="imgOn('img2')" onMouseOut="imgOff('img2')"><IMG SRC="images/nav/sitemapoff.gif" WIDTH=73 HEIGHT=32 border=0 name=img2></a></TD>
<IMG SRC="images/nav/spacer2.gif" WIDTH=7 HEIGHT=32 border=0></a></TD>
<a href="about.php" onMouseOver="imgOn('img3')" onMouseOut="imgOff('img3')"><IMG SRC="images/nav/aboutoff.gif" WIDTH=59 HEIGHT=32 border=0 name=img3></a></TD>
<IMG SRC="images/nav/spacer3.gif" WIDTH=6 HEIGHT=32 border=0></a></TD>
<a href="advertise.php" onMouseOver="imgOn('img4')" onMouseOut="imgOff('img4')"><IMG SRC="images/nav/advertiseoff.gif" WIDTH=94 HEIGHT=32 border=0 name=img4></a></TD>
<IMG SRC="images/nav/spacer4.gif" WIDTH=10 HEIGHT=32 border=0></a></TD>
<a href="contact.php" onMouseOver="imgOn('img5')" onMouseOut="imgOff('img5')"><IMG SRC="images/nav/contactoff.gif" WIDTH=75 HEIGHT=32 border=0 name=img5></a></TD>


<!-- end of java nav bar-->

thanks so much...