﻿
/*
    Computer Science Group, LLC
    225-766-2397 office
    225-205-0263 cell
    darrell@computersciencegroup.com
    Copyright © 2008 Computer Science Group, LLC, All rights reserved.
*/

//csgUpdatePanel(<opUpdatePanelID>, <opUpdateProgressID>)
//04/20/2008
function csgUpdatePanel(opUpdatePanelID, opUpdateProgressID)
{
    //global used in properties/methods/events
    var oCsgUpdatePanel = this;
    /****************************************************************************************
    properties
    ****************************************************************************************/
    //cannot continue if update panel is not found.
    this.updatePanel = document.getElementById(opUpdatePanelID);
    if (!this.updatePanel)
    {
//        alert("Update panel " + opUpdatePanelID + " not found.");
        return;
    }
    this.updatePanelID = opUpdatePanelID;
    //cannot continue if update progress is not found.
    this.updateProgress = document.getElementById(opUpdateProgressID);
    if (!this.updateProgress)
    {
        alert("Update progress " + opUpdateProgressID + " not found.");
        return;
    }
    this.updateProgressID = opUpdateProgressID;
    /****************************************************************************************
    methods
    ****************************************************************************************/
    //updateProgressPosition(<opTop>, <opLeft>)
    //09/24/2009
    this.updateProgressPosition = function(opTop, opLeft)
    {
        if (this.updateProgress)
        {
            for (i=0; i<this.updateProgress.children.length; i++)
            {
                //the div showing the update gif has a css class of "csgUpdateProgress"
                if (this.updateProgress.children[i].className == "updatePanelUpdateProgress")
                {
                    this.updateProgress.children[i].style.top = opTop;
                    this.updateProgress.children[i].style.left = opLeft;
                    break;
                }
            }
        }
    }
    //doPostBack(<opPostBackActionValue>)
    //09/24/2009
    this.doPostBack = function (opPostBackActionValue)
    {
        if (opPostBackActionValue) { ocsgPage.setUpdatePanelPostBackActionValue(opPostBackActionValue); }
        __doPostBack(this.updatePanelID);
    }
}