/// <reference path="../../Scripts/jquery-1.6.2.min.js" />
/// <reference path="../../Scripts/jquery-ui-1.8.16.custom.min.js" />

$(document).ready(function () {
    ShowFieldOptions();

    $("#FieldTypeId").change(function () {
        ShowFieldOptions();
    });
});

function ShowFieldOptions() {
    var fieldtype = $("#FieldTypeId option:selected").text();

    switch (fieldtype) {
        case "number": case "date": case "date and time": case "url": case "latitude": case "longitude": case "yes/no checkbox":
            $("#FieldLengthOption").hide();
            $("#FieldPrecisionOption").hide();
            $("#OptionsOption").hide();
            $("#ComputedColumnFormulaOption").hide();
            $("#UseForTitleOption").hide();
            $("#FullTextSearchOption").hide();
            break;
        case "text":
            $("#FieldLengthOption").show();
            $("#FieldPrecisionOption").hide();
            $("#OptionsOption").hide();
            $("#ComputedColumnFormulaOption").hide();
            $("#UseForTitleOption").show();
            $("#FullTextSearchOption").show();
            break;
        case "number with decimal":
            $("#FieldLengthOption").show();
            $("#FieldPrecisionOption").show();
            $("#OptionsOption").hide();
            $("#ComputedColumnFormulaOption").hide();
            $("#UseForTitleOption").hide();
            $("#FullTextSearchOption").hide();
            break;
        case "computed":
            $("#FieldLengthOption").hide();
            $("#FieldPrecisionOption").hide();
            $("#OptionsOption").hide();
            $("#ComputedColumnFormulaOption").show();
            $("#UseForTitleOption").hide();
            $("#FullTextSearchOption").hide();
            break;
        case "drop down list": case "check all that apply":
            $("#FieldLengthOption").hide();
            $("#FieldPrecisionOption").hide();
            $("#OptionsOption").show();
            $("#ComputedColumnFormulaOption").hide();
            $("#UseForTitleOption").show();
            $("#FullTextSearchOption").show();
            break;
        default:
            $("#FieldLengthOption").hide();
            $("#FieldPrecisionOption").hide();
            $("#OptionsOption").hide();
            $("#ComputedColumnFormulaOption").hide();
            $("#UseForTitleOption").hide();
            $("#FullTextSearchOption").hide();
            break;
    }
}