window.onload=function() {

image1 = new Image();
image1.src = "gfx/home_on.png";
image2 = new Image();
image2.src = "gfx/fixtures_on.png";
image3 = new Image();
image3.src = "gfx/goalstats_on.png";
image4 = new Image();
image4.src = "gfx/opponents_on.png";
image5 = new Image();
image5.src = "gfx/playerstats_on.png";
image5 = new Image();
image5.src = "gfx/archives_on.png";

aA=document.getElementById('nav').getElementsByTagName('img');
for(var i=0;i<aA.length; i++) {
    if (aA[i].addEventListener) { // W3C
        aA[i].addEventListener('mouseover', function() {toggle(this); }, false);
        aA[i].addEventListener('mouseout', function() {toggle(this); }, false);
        }
    else {
        aA[i].onmouseover=function() {toggle(this);};
        aA[i].onmouseout=function() {toggle(this);};
        }
    }

function toggle(obj) { // assumes suffix is '_on' for all link images
obj.src=(obj.src.indexOf('_on')==-1)? obj.src.replace(/.png/g,'_on.png') : obj.src.replace(/_on.png/g,'.png');
}

}
