﻿/* This class controls some behaviors of the price control, and holds the methods that can be added 
 * to the click and mouseover events of the price tables that are built. */
LangloWeb.PriceControlMgr = function() 
{
}

LangloWeb.PriceControlMgr.prototype = 
{ 
    //Since the collapsible & modal popup take sometime before hiding the contents of the panel.
    showHide : function(sender, hiddenRowId) 
    {
        var hRow = $get('hidden' + hiddenRowId); 
         
        if (hRow && hRow.style.display == 'none') 
        {
            // On load display = 'none' - this also sets a delegate to hide the row when collapse 
            // is down so there will be no line. 
            hRow.style.display =  ''

            var hide = Function.createDelegate(hRow, this.hideMe);
            var myBehavior = $find('cpBehavior' + hiddenRowId); 
            if (myBehavior != null) 
                myBehavior.add_collapsed(hide);
            else 
            {
                myBehavior = $find('mpBehavior' + hiddenRowId); 
                if (myBehavior != null) 
                    myBehavior.add_hidden(hide); 
            } 
        }
    },

    // Function hides the table row that encapsulates the cascading table. 
    hideMe : function (sender, args) 
    {
        this.style.display = 'none';
    }
} 


LangloWeb.PriceControlMgr.registerClass('LangloWeb.PriceControlMgr'); 

// Bootstrap, but only on modern browsers
if (typeof document.getElementById != 'undefined')
    priceControlMgr = new LangloWeb.PriceControlMgr();

if (typeof(Sys) !== "undefined")
    Sys.Application.notifyScriptLoaded();
