$(document).ready(function(){
    $("#auth").click(function(){
        if ($(this).is(':checked')){
            $("#withoutauth").hide();
            $("#withauth").show();
        } else {
            $("#withauth").hide();
            $("#withoutauth").show();
        }
    });
    
    jQuery("#customerservice").validate({
        rules: {
            reason: {
                required: true,
            },
            subject: {
                required: true
            },
            message: {
                required: true
            },
            username: {
                required: "#auth:checked"
            },
            password: {
                required: "#auth:checked"
            },
            clientname: {
                required: "#auth:unchecked"
            },
            email: {
                required: "#auth:unchecked"
            }
        }
    });
    
});
