﻿
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginReq);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endReq);


function toggleProgressPanel(ID) {
    var ctrlID = document.getElementById(ID);

    if (ctrlID == null)
        ctrlID = ID;

    if (ctrlID != null) {
        if (ctrlID.style.display == 'none') {
            ctrlID.style.display = 'block';
        }
        else {
            ctrlID.style.display = 'none';
        }
    }
}



function beginReq(sender, args) {

    //debugger;
    // shows the Popup 
    //toggleProgressPanel(divUpdateProgress);
    //$find(ModalProgress).show();
    ShowModalProgress();
}

function endReq(sender, args) {
    // Hide the Popup 
    //toggleProgressPanel(divUpdateProgress);
    //$find(ModalProgress).hide();
    //alert('endReq');

    if (IsInPageEditMode == false) {
        ControlStyler();
    }
    //TabReStyler();
    FontStyler();
    CloseModalProgress();
}


function ShowModalProgress() {
    var _message_to_show = '<br/><h2 style="text-align: center;"><img style="width:32px; height:32px; vertical-align:middle" src="/SiteCollectionImages/SiteImages/Loading.gif"/> <span>Processing....</span></h2><br /><br /><p style="padding:0px 100px 0px 100px;">Please wait while your request are processed.</p><br /><br />';

            // on page load show the modal box
            // more info about the options you can find on the fancybox site
        $.fancybox(
            _message_to_show,
            {
                'width': 350,
                'height': 300,
                'transitionIn': 'none',
                'transitionOut': 'elastic',
                'centerOnScroll': 'true',
                'overlayOpacity': 0.7,
                'overlayColor': '#c0c0c0',
                'modal': 'true'
            }
        );
}

function CloseModalProgress()
{
    $.fancybox.close();
}
