﻿// function to show progress when an administrative option is clicked for posts
function showProgress() {
    var div = document.getElementById('progress');
    div.style.display = "inline";
}

// function to enable/disable the tag field in the admin modal popup
function addTag(txtTagId, ddlTagsId) {
    var txtTag = document.getElementById(txtTagId);
    var ddlTags = document.getElementById(ddlTagsId);

    if (txtTag && ddlTags && ddlTags[ddlTags.selectedIndex].value == "Add New Tag...") {
        txtTag.disabled = false;
        txtTag.focus();
    }
    else {
        txtTag.value = "";
        txtTag.disabled = true;
    }
}

// function to validate the tag dropdown/textbox in the admin modal popup
function ValidateTag(source, args) {
    var txtTag = document.getElementById('<%= txtTagName.ClientID %>');
    var ddlTag = document.getElementById('<%= ddlTags.ClientID %>');
    if ((!txtTag.disabled && txtTag.value != "") || (txtTag.disabled && ddlTag.selectedIndex > 0) ) {
        args.IsValid = true;
        return;
    }
    args.IsValid = false;
}
