Hi as title states, i'm trying to make a navigation where the images change on mouseover.
PHP Code:
<script>
function 
findNav() {
    var 
nav document.getElementById('nav-topbar').getElementsByTagName('img');
    for( 
i in nav ) {
        if (
nav[i].id != 'nav-on' && nav[i].id) {
            
            
nav[i].onmouseover = function() { mouseHover(this.id1); };
            
nav[i].onfocus = function() { mouseHover(this.id1); };
            
            
nav[i].onmouseout = function() { mouseHover(this.id0); };
            
nav[i].onblur = function() { mouseHover(this.id0); };
        }
    }
}

function 
mouseHover(idstate) {
    if (
state) {
        
document.getElementById(id).src 'images/nav/' id '-on.gif';
    } else {
        
document.getElementById(id).src 'images/nav/' id '.gif';
    }
}

window.onload = function() {
    
findNav();
}
</script> 
It's in an external js, not inline but anyway..
I get a few javascript warnings on the firefox error console, which is what i'm trying to fix.

Although this script works, some of the images don't have an id, because the navigation has vertical-line images that serve to split up the navigation items aesthetically.

And thus the line: if (nav[i].id != 'nav-on' && nav[i].id)
seems to throw a warning, which is no big deal but i would like to know if theres an alternate way to check if an image has an id or not, some sort of a function like PHP has with isset()?