﻿function RequiredIfVisible(source, arguments) {
    var otherSection = document.getElementById($(source).attr("OtherSection"));

    arguments.IsValid = true;

    if ($(otherSection).css("display") != 'none') {
        var controlToValidate = document.getElementById($(source).attr("ControlToValidateId"));

        if ($(controlToValidate).val() == "") {
            arguments.IsValid = false;
        }
    }
}

function ShowHideByDropDownSelection(dropDown, toShowHideId, toShowHideValidationId, toHideWhenThisValue) {
    if ($(dropDown).val() == toHideWhenThisValue) {
        $("#" + toShowHideId).show();
    }
    else {
        $("#" + toShowHideId).hide();
        $("#" + toShowHideValidationId).hide();
    };

}
