// rollovers

$(window).bind('load', function() {
    var preload = new Array();
    $(".hover").each(function() {
        s = $(this).attr("src").replace(/\.(.+)$/i, "_o.$1");
        preload.push(s)
    });
    var img = document.createElement('img');
    $(img).bind('load', function() {
        if(preload[0]) {
            this.src = preload.shift();
        }
    }).trigger('load');
});

$(document).ready(function() {
	
	// handles fade in of right images
	$("#main-image img").fadeTo("slow", 1.0);
    
	$(".hover").each(function() {
        if ($(this).attr("src").match(/_o\.(.+)$/i)) {
            $(this).removeClass("hover");
        }
    });
    $(".hover").hover(function() {
        s = $(this).attr("src").replace(/\.(.+)$/i, "_o.$1");
        $(this).attr("src", s);
    }, function() {
        s = $(this).attr("src").replace(/_o\.(.+)$/i, ".$1");
        $(this).attr("src", s);
    });
});