How to use Sys.Application for Button Click events?
<p>We are using Master page in our application. In the Master page we have javascript function which executes for every postback events in the child pages. I want that event to fire only on button Click events. Can anyone help me to solve this?</p>

<p>
        Sys.Application.add_load(GlobalApplicationLoadHandler);</p>

<pre><code>    function GlobalApplicationLoadHandler(sender, args) {
        var prm = Sys.WebForms.PageRequestManager.getInstance();
        if (!prm.get_isInAsyncPostBack()) {
            prm.add_initializeRequest(initRequest);
            prm.add_endRequest(endRequest);
        }
    }
    function initRequest(sender, args) {

        if (document.documentElement) {
            theTop = document.documentElement.scrollTop;
        }
        else if (document.body) {
            theTop = document.body.scrollTop;
        }
        theTop += 200;
        var theHeight = document.body.scrollHeight;
        if (args._postBackElement.value == "Pass Depreciation") {
            document.getElementById("overlay").style.height = (theHeight) + 'px';
            document.getElementById("depdialogue").style.top = (theTop) + 'px';
            document.getElementById("depdialogue").style.left = "450px";
            document.getElementById("depdialogue").style.display = "";
            document.getElementById("overlay").style.display = "";
        }
        else {
            document.getElementById("overlay").style.height = (theHeight) + 'px';
            document.getElementById("dialogue").style.top = (theTop) + 'px';
            document.getElementById("dialogue").style.left = "450px";
            document.getElementById("dialogue").style.display = "";
            document.getElementById("overlay").style.display = "";
        }

    }

    function endRequest(sender, args) {
        document.getElementById("dialogue").style.display = "none";
        document.getElementById("depdialogue").style.display = "none";
        document.getElementById("overlay").style.display = "none";
    }

    function moveUpdatepanel() {
        if (document.documentElement) {
            theTop = document.documentElement.scrollTop;
        }
        else if (document.body) {
            theTop = document.body.scrollTop;
        }
        theTop += 200;
        document.getElementById("dialogue").style.top = (theTop) + 'px';
        document.getElementById("dialogue").style.left = "450px";
        document.getElementById("depdialogue").style.top = (theTop) + 'px';
        document.getElementById("depdialogue").style.left = "450px";

    }
    window.onscroll = moveUpdatepanel;


&lt;/script&gt;
&lt;div id="main"&gt;
    &lt;div id="overlay" class="progressBackgroundFilter" style="display:none;"&gt;
    &lt;/div&gt;
    &lt;div id="dialogue" style="display:none;" class="processMessage" &gt; 
        &lt;table&gt;
        &lt;tr&gt;
        &lt;td align="center" colspan="2"&gt;

            &lt;img alt="Updating the Page" src="images/updateprogress.gif" /&gt;

        &lt;/td&gt;
        &lt;/tr&gt;
        &lt;/table&gt;
    &lt;/div&gt;
    &lt;div id="depdialogue" style="display:none;" class="processMessage" &gt; 
        &lt;table&gt;
        &lt;tr&gt;
        &lt;td align="center" colspan="2"&gt;
            &lt;img alt="Updating the Page" src="images/processbarNew.gif"  /&gt; 
        &lt;/td&gt;

        &lt;/tr&gt;
        &lt;/table&gt;
    &lt;/div&gt;
</code></pre>
