Calling function from another function not working

Hello folks,

I am calling a function from another function. In the called function, I am disabling two controls. For somereason the called function doesn’t seem to be working. If I put the code in one big function everything works okay. This is how I am calling…

<%@ Page Title="" Language="C#" MasterPageFile="~/QRMDMS.Master" trace="false" AutoEventWireup="true" CodeBehind="WebForm7.aspx.cs" Inherits="FHLBSF.QRMDMS.WebUI.WebForm7" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">

<script  type="text/javascript">


    function AddClientSide() {

        alert("started the client side script");

        InitialDisplay();

        var varButtonAdd = document.getElementById("<%=ButtonAdd.ClientID%>");

        var varproperty = varButtonAdd.getAttribute("value");

        if (varproperty == "Save") {
            alert("button now is in save mode");

            SaveMode();

            return false;
        }
        else {
            alert("button now is in add mode");

            AddMode();

            return true;
        }
    }
    function InitialDisplay() {
        alert("Initial Display");
        var varLabelBSISTypes = document.getElementById("<%=LabelBSISType.ClientID%>");
        varLabelBSISTypes.style.display = "block";
        varLabelBSISTypes.style.visibility = "visible";

        var varTextBoxBSISType = document.getElementById("<%=TextBoxBSISType.ClientID%>");
        varTextBoxBSISType.style.display = "block";
        varTextBoxBSISType.style.visibility = "visible";

    }
    function SaveMode() {
        alert("in Save Mode function");
        varButtonAdd.setAttribute("value", "Add");
        document.getElementById("<%=ButtonEdit.ClientID%>").disabled = false;
        document.getElementById("<%=ButtonRemove.ClientID%>").disabled = false;
        document.getElementById("<%=TextBoxBSISType.ClientID%>").disabled = true;

    }
    function AddMode() {
        alert("in Add mode function");

        varButtonAdd.setAttribute("value", "Save");
        document.getElementById("<%=ButtonEdit.ClientID%>").disabled = true;
        document.getElementById("<%=ButtonRemove.ClientID%>").disabled = true;
        document.getElementById("<%=TextBoxBSISType.ClientID%>").disabled = false;
    }

</script>

The varButtonAdd variable looks to be the cause of the issue.