var _validationgroup = '';
var _progressdiv = '';
var _progressdiv2 = '';

function definirPosicionProgress(_valgroup, _prgdiv, _prgdiv2)
{    
    // Define variables para utilizarlas luego y no tenes que pasarlas siempre por parámetro    
    _validationgroup = _valgroup;
    _progressdiv = _prgdiv;
    _progressdiv2 = _prgdiv2;    
}

function onUpdatingProgress(_tipo, _valgroup, _prgdiv, _prgdiv2)
{

    // Abre el progress
    //_tipo = 0 - UpdatePanel
    //_tipo = 1 - Boton
    
    // Si hay alguna ayuda abierta, la cierra en este momento
    var divAyuda = document.getElementById('navayuda');    
    if (divAyuda != null) 
    {        
        ieop = 0;
        WriteAyuda(0, 0, 0, 0, 0);
    }
    
    definirPosicionProgress(_valgroup, _prgdiv, _prgdiv2);

    if (_tipo==1 && _validationgroup != '')
    {        
        // Si debe validar la página, se fija que no haya dado ningún error de validación
        Page_ClientValidate(_validationgroup);
        if (!Page_IsValid) return false;
    }

    var updateProgressDiv = document.getElementById(_progressdiv);
    var updateProgressDiv2 = document.getElementById(_progressdiv2);
    var iframeprogress = $get('iframeprogress');                
    
    if (updateProgressDiv == null) return;

    findTamVentanaPopUp(updateProgressDiv);
    
    updateProgressDiv.style.display = '';
      
    if (updateProgressDiv2 != null) 
    {
      
        updateProgressDiv2.style.display = '';
        PosScrollCentradoPopUp(updateProgressDiv2, true, 100, 100);
        
    }
      
    if (iframeprogress != null) 
    {
        iframeprogress.style.display = '';
        iframeprogress.style.width = updateProgressDiv.style.width;
        iframeprogress.style.height = updateProgressDiv.style.height;
    }
            
}

function onUpdatedProgress(_prgdiv, _prgdiv2) 
{
 
    // Cuando finaliza, cierra el Progress
 
    if (_prgdiv == '') return;
    
    var updateProgressDiv = $get(_prgdiv); 
    var updateProgressDiv2 = $get(_prgdiv2); 
    var iframeprogress = $get('iframeprogress'); 
    
    if (updateProgressDiv == null) return;
    
    updateProgressDiv.style.display = 'none';
    updateProgressDiv.style.width = '0px';
    updateProgressDiv.style.height = '0px';
    
    if (updateProgressDiv2 != null) 
    {
        updateProgressDiv2.style.display = 'none';
    }
    
    if (iframeprogress != null) 
    {
        iframeprogress.style.display = 'none';
        iframeprogress.style.width = '0px';
        iframeprogress.style.height = '0px';
    }
                    
}