// JavaScript for the register form

if (Common.jquery_supported) {
    $(function() {
        // Set up the form show/hide stuff
        $("#f_reg_type").removeClass("f_hidden");

        $("form.f_reg").hide();
        $($("#f_reg_select option:selected").val()).show();

        $("#f_reg_select").change(function(event) {
            $("form.f_reg").hide();
            var show = event.target.options[event.target.selectedIndex].value;
            $(show).show();
            if (show == "#f_reg_full") {
                $("#reg_full_os0").val($("#reg_student_os0").val())
            }
            else {
                $("#reg_student_os0").val($("#reg_full_os0").val())
            }
        });

        // Add validation to the registration forms; note that this doesn't
        // work properly if you call it on a selector that matches more than one
        // element
        $("#f_reg_full").validate();
        $("#f_reg_student").validate();
    });
}
