﻿$(document).ready(function() {
    // Add onselect event handler for product finder dropdown
    $("#productFinder").change(function() {
        if ($(this).val() != "") {
            location.href = $(this).val();
        }
    });
});

$(window).load(function() {
    resizeCentralNav();
});

function resizeCentralNav() {
    // Resize the central nav cells so that each row's cell is the height of the tallest cell in that row
    var cells = $(".centralMenuCell");
    for (var i = 0; i < cells.length; i += 3) {
        var maxHeight = $(cells[i]).height();
        if (i + 1 < cells.length)
            maxHeight = Math.max(maxHeight, $(cells[i + 1]).height());
        if (i + 2 < cells.length)
            maxHeight = Math.max(maxHeight, $(cells[i + 2]).height());
        $(cells[i]).height(maxHeight + 1);
        if (i + 1 < cells.length)
            $(cells[i + 1]).height(maxHeight + 1);
        if (i + 2 < cells.length)
            $(cells[i + 2]).height(maxHeight + 1);
    }
}