//<![CDATA[

//To use this, you must include toggleValidators.js file before this file.
$(document).ready(function() {
    //here we take care of the help show/hide
    var prevHtml;

    try {
        if (showHelp)
            $(".pageHelpTriggerClosed > a").click();

    } catch (e) { }

    //here we do the show hide for the user forms
    $("input[type=radio][checked]").each(function() {
        rbVal = $(this).val();
        toggleFormDisplay(rbVal);
        toggleValidators($(this).val());
    });

    $(":radio").click(function() {
        rbVal = $(this).val();
        toggleFormDisplay(rbVal);
        if (this.checked)
            toggleValidators($(this).val());
    });

    function toggleFormDisplay(id) {

        var rbVal = id;

        $("." + $(":radio:not(:checked)").val() + " > ul").hide();
        $("." + rbVal + " > ul").slideDown('fast');


        $("." + $(":radio:not(:checked)").val() + " > ul").hide();
        $("." + rbVal + " > ul").slideDown('fast');

        if (rbVal == "newCustomer") {
            $("#promotions").removeClass("hidden").show();
            $("span:contains('This email is not associated with an account.')").parent().hide();
        }
        else {
            $("#promotions").hide();
            $("span:contains('This email is not associated with an account.')").parent().show();
        }

    }

    $("input[id*='btn']").click(function() {
        return true;
    });
    
});
//]]>