$(function() {
    $(".rollover").hover(function() {
        this.src = this.src.replace(".off.", ".on.");
    }, function() {
        this.src = this.src.replace(".on.", ".off.");
    });

    // preload specified images
    $('img.preload').each(function() {
        // Get image instance.
        var image = new Image();
        image.src = $(this).attr('src');
    });

    // pop-ups (add this to all desired hyperlinks: rel="external")
    $('a[rel="external"]').click(function() {
        window.open($(this).attr('href'), 'gallery', 'width=1000,height=500,top=20,left=100');
        return false;
    });
});

// for preloading bkg images & such; call like: $.preloadImages("image1.gif", "/path/to/image2.jpg");
jQuery.preloadImages = function() {
    for (var i = 0; i < arguments.length; i++) {
        jQuery("<img>").attr("src", arguments[i]);
    }
}
