﻿$(document).ready(function() {
    // Set height of wrappers
    $(window).load(function() {
        var height = $(document).height();
        $('#wrapper1').height(height);
        $('#wrapper2').height(height);
        $('#wrapper3').height(height);
    });
    
    // Set hover images
    $('img.hover').each(function() {
        var image = $(this);
        var imageUrl = image.attr('src');
        var index = imageUrl.lastIndexOf('.');
        var imageFileName = imageUrl.substring(0, index);
        var imageExt = imageUrl.substring(index);
        var hoverImageUrl = imageFileName + '_hover' + imageExt;

        // Preload hover image
        $('<img />').attr('src', hoverImageUrl);

        // Bind mouseover/mouseout events
        image.mouseover(function() {
            image.attr('src', hoverImageUrl);
        }).mouseout(function() {
            image.attr('src', imageUrl);
        });
    });
});