﻿//Show div for update animation extender

function onUpdating(theUpdatePanel) {
    // get the update progress div
    var updateProgressDiv = $get('updateProgressDiv');
    // make it visible
    updateProgressDiv.style.display = '';
    //var strUpdPanel = "'\<\%\= this." + theUpdatePanel + ".ClientID \%\>'";

    //  get the gridview element
    var gridView = $get(theUpdatePanel);

    // get the bounds of both the gridview and the progress div
    var gridViewBounds = Sys.UI.DomElement.getBounds(gridView);
    var updateProgressDivBounds = Sys.UI.DomElement.getBounds(updateProgressDiv);

    //    do the math to figure out where to position the element (the center of the gridview)
    //var x = gridViewBounds.x + Math.round(gridViewBounds.width / 2) - Math.round(updateProgressDivBounds.width / 2);
    //var y = gridViewBounds.y + Math.round(gridViewBounds.height / 2) - Math.round(updateProgressDivBounds.height / 2);

    //    do the math to figure out where to position the element (the center of the gridview)
    var x = Math.round(gridViewBounds.width / 2) - Math.round(updateProgressDivBounds.width / 2);
    var y = Math.round(gridViewBounds.height / 2) ;
    //alert(x + "," + Math.round(gridViewBounds.height / 2) + "," + y);
    //    set the progress element to this position
    Sys.UI.DomElement.setLocation(updateProgressDiv, x, y);
    
}

function onUpdated() {
    // get the update progress div
    var updateProgressDiv = $get('updateProgressDiv');
    // make it invisible
    updateProgressDiv.style.display = 'none';
}

//END Animation Extender
