$(document).ready(function() {

    // Preload all rollovers
    $("a.rollover").each(function() {
        // Set the original src
        rollsrc = $(this).children("img").attr("src");
        rollON = rollsrc.replace(/.gif$/ig, "_o.gif");
        $("<img>").attr("src", rollON);
    });

    // Navigation rollovers
    $("a.rollover").mouseover(function() {
        imgsrc = $(this).children("img").attr("src");
        
        matches = imgsrc.match(/_o/);

        // don't do the rollover if state is already ON
        if (!matches) {
            imgsrcON = imgsrc.replace(/.gif$/ig, "_o.gif"); // strip off extension
            $(this).children("img").attr("src", imgsrcON);
        }

    });
    $("a.rollover").mouseout(function() {
        $(this).children("img").attr("src", imgsrc);
    });


});