﻿$(document).ready(function() {

    // Search Input text replace
    $(".searchInput").val('search...');

    $(".searchInput").focus(function() {
        $(this).val('');
    });
    $(".searchInput").blur(function() {
        if ($(this).val() === '') {
            $(this).val('search...');
        }
    });

    //Vertically align text for the home page
    $('.splashCont h1').vAlign();

    //Sitemap
    $(".child dd").toggle();
    $(".expandBtn").click(function() {
        $("#sitemap dd.plus dd").toggle();
    });
    $(".plus").click(function() {
        $(this).find(".child dd").toggle();
    });
});

(function($) {
    // VERTICALLY ALIGN FUNCTION
    $.fn.vAlign = function() {
        return this.each(function(i) {
            var ah = $(this).height();
            var ph = $(this).parent().height();
            var mh = (ph - ah) / 2;
            $(this).css('margin-top', mh);
        });
    };
})(jQuery);