jQuery(function($) {
    $(document).ready(function(){
       
        $("#nav a>img").each(function () {
            rollsrc = $(this).attr("src");
            rollON = rollsrc.replace(/.png$/gi, "_on.png");
            $("<img>").attr("src", rollON);
        });

        $("#nav a").mouseover(function () {
            imgsrc = $(this).children("img").attr("src");
            matches = imgsrc.match(/_over/);
            if (!matches) {
                imgsrcON = imgsrc.replace(/.png$/gi, "_on.png");
                $(this).children("img").attr("src", imgsrcON);
            }
        });

        $("#nav a").mouseout(function () {
            $(this).children("img").attr("src", imgsrc);
        });

       
    });
});