﻿function GetControl(controlId, controlType) {
    re = new RegExp(controlId);
    for (i = 0; i < document.forms[0].elements.length; i++) {
        elm = document.forms[0].elements[i]
        if (elm.type == controlType) {
            if (re.test(elm.name)) {
                return elm;
            }
        }
    }
    return null;
}
function UpdatePanelAnimationExtender_OnUpdating() {
    var containerCtl = $get('divQuotingBody');
    var progressCtl = $get('divProgress');

    progressCtl.style.display = '';

    // get the bounds of both the update area and the progress div
    var containerCtlBounds = Sys.UI.DomElement.getBounds(containerCtl);
    var progressCtlBounds = Sys.UI.DomElement.getBounds(progressCtl);

    var verticalScroleLoc = document.body.scrollTop;
    if (document.documentElement.scrollTop > verticalScroleLoc)
        verticalScroleLoc = document.documentElement.scrollTop;

    // find the top center of the update area
    var x = containerCtlBounds.x ;
    var y = verticalScroleLoc + 400; 
    //var x = containerCtlBounds.x + Math.round(containerCtlBounds.width / 2) - Math.round(progressCtlBounds.width / 2);
    //var y = verticalScroleLoc + 380;  //containerCtlBounds.y + Math.round(containerCtlBounds.height / 2) - Math.round(progressCtlBounds.height / 2);
    
    // set the progress element to this position
    Sys.UI.DomElement.setLocation(progressCtl, x, y);
}
function UpdatePanelAnimationExtender_OnUpdated() {
    var progressCtl = $get('divProgress');
    progressCtl.style.display = 'none';
    scrollTo(0, 0);
    if (ConfigureProducts != null)
        ConfigureProducts();
}
