﻿/* Wait icon */

function ShowWait() {
    $get("WaitDiv").style.display = "";
    $get("GridControlsDiv").style.display = "none";
    $get("GridDiv").style.display = "none";
    $get("ConfigurationDiv").style.display = "none";
}

function ShowWaitForProgressWithValidation(validationGroup) {

    if (typeof (Page_ClientValidate) == 'function') {
        if (Page_ClientValidate(validationGroup)) {
            $get("ProgressDiv").style.display = "";
            $get("ContentDiv").style.display = "none";
        }
        else 
        {
            $get("ProgressDiv").style.display = "none";
            $get("ContentDiv").style.display = "";
        }
    }
    else {
        $get("ProgressDiv").style.display = "";
        $get("PromptDiv").style.display = "none";
    }
}

function ShowWaitForProgress() {
   $get("ProgressDiv").style.display = "";
    $get("ContentDiv").style.display = "none";
}

function ShowPagerWait() {
    $get("WaitDiv").style.display = "";
    $get("CriteriaDiv").style.display = "none";
    $get("GridDiv").style.display = "none";
}

function ShowPromptWait() {
    if (typeof (Page_ClientValidate) == 'function') {
        if (Page_ClientValidate('FilterPrompt')) 
        {
            $get("WaitDiv").style.display = "";
            $get("PromptDiv").style.display = "none";
        }
    }
    else {
        $get("WaitDiv").style.display = "";
        $get("PromptDiv").style.display = "none";
    }
}


var Page;
var postBackElement;

function pageLoad() {
    Page = Sys.WebForms.PageRequestManager.getInstance();
    Page.add_endRequest(endRequest);
}

function endRequest(sender, args) {
    $get("WaitDiv").style.display = "none";
    $get("GridDiv").style.display = "";
    $get("GridControlsDiv").style.display = "";
    $get("PromptDiv").style.display = "";
    $get("CriteriaDiv").style.display = "";
    $get("ConfigurationDiv").style.display = "";
}

function pageLoadForProgress() 
{
    Page = Sys.WebForms.PageRequestManager.getInstance();
    Page.add_endRequest(endRequestForProgress);
}

function endRequestForProgress(sender, args) {
    $get("ProgressDiv").style.display = "none";
    $get("ContentDiv").style.display = "";
}

/* Export */

function DownloadFile(url) {

    // Create an IFRAME.
    var iframe = document.createElement("iframe");

    // Point the IFRAME to GenerateFile, with the
    //   desired region as a querystring argument.
    iframe.src = url;

    // This makes the IFRAME invisible to the user.
    iframe.style.display = "none";

    // Add the IFRAME to the page.  This will trigger
    //   a request to GenerateFile now.
    document.body.appendChild(iframe);

}