﻿/// <reference path="jquery-1.3.2-vsdoc2.js" />
function GlobalLoad() {

    SharedLoad();

    
    $(".Accordion .Item .Title a").click(function() { $(this).parent().parent().find(".Content").slideToggle(); });
    $(".Accordion .Open").find(".Content").show();

    $(".inputdrp")
            .parent()
            .addClass("inputdrpParent")
            .each(function() {
                $(this).html("<span class='inputdrpText'>" + $(this).find("option[selected=true]").text() + "</span>" + $(this).html());
            });
    $(".inputdrp").change(function() {
        $(this).parent().find(".inputdrpText").html($(this).find("option[selected=true]").text());
    });

    $(".Submit .inputbutton").hover(function() { $(this).css("background-position", "0 25px"); }, function() { $(this).css("background-position", "0 0"); })

    $(".inputtext").focus(function() { $(this).css("background-position", "left center"); }).blur(function() { $(this).css("background-position", ""); });
    $(".inputtextarea").focus(function() { $(this).css("background-position", "left center"); }).blur(function() { $(this).css("background-position", ""); });
    $(".inputdrp").focus(function() { $(this).parent().css("background-position", "left bottom"); }).blur(function() { $(this).parent().css("background-position", ""); });

    $(".Phone").mask("(999) 999-9999");
    $(".Date").mask("99/99/9999");

    $(".Form .Submit").each(function() {
        var thisFind = $(this).find("input[type=checkbox]");
        if (thisFind.size() > 0) { $(this).parent().find("input[type=submit]").attr("disabled", "disabled"); }
        thisFind.click(function() {
            if ($(this).attr("checked")) { $(this).par(2).find("input[type=submit]").attr("disabled", ""); } else { $(this).par(2).find("input[type=submit]").attr("disabled", "disabled"); }
        });
    });


    $(".submenu a[rel=show]").addClass("select").par(5).addClass("show");
    $(".submenu a[rel=show]").addClass("select").par(2).addClass("show");
    $(".selected").parent().find(".submenu").show();

    $(".container .main .mainleft .menuitem .item").click(function() {
        var submenu = $(this).parent().find(".submenu");
        var display = submenu.css("display");
        if (display == "none") {
            $(".container .main .mainleft .menuitem .submenu").slideUp();
            submenu.slideDown();
        }
        else {
            submenu.slideToggle();
        }
    });

}

