var theRules = {
    '.nav img' : function(el) {
        el.onmouseover = function() {
            /* Changes an image src from "_off" to "_on". */
            var imgSrc = this.getAttribute('src');
            var imgClass = this.className;
            if (imgClass.indexOf('current') == -1) {
                var newImgSrc = imgSrc.replace(/_off\./, "_on.");
                this.setAttribute("src", newImgSrc);
            }
        }
        el.onmouseout = function() {
            /* Changes an image src from "_on" to "_off". */
            var imgSrc = this.getAttribute('src');
            var imgClass = this.className;
            if (imgClass.indexOf('current') == -1) {
                var newImgSrc = imgSrc.replace(/_on\./, '_off.');
                this.setAttribute('src', newImgSrc);
            }
        }
    }
};

Behaviour.register(theRules);
