/*
    browser_base.js
    
    This file is an override of the syncfusion callback control's destroy method, as it was causing
    errors and conflicting with mootools.
    
    Whenever the DataCallBackPanel is used this script needs to be included in the BODY section
    to override the default behaviour.
    
    --Jack W

*/

window.addEvent("domready",function()
{
    
    var oldDestroyTree = SFCallBackControl_DestroyTree;
    
    SFCallBackControl_DestroyTree = function( oEl, oElPar )
    {
        var oChilds = $(oEl).getChildren();
        for (var i = oChilds.length - 1;i >= 0;i--)
        {
            var oNode = oChilds[i];if( oNode.dispose && ( typeof(oNode.dispose) === "function") )
            {
                $(oNode).m_dispose();
            }
            SFCallBackControl_DestroyTree( oNode, oElPar );
            /* commented out because trying to remove a disposed element seems to be causing problems.
            if ( !oElPar || oEl == oElPar )
            {
                if ($(oNode) != null)
                {
                    oEl.removeChild( $(oNode) );
                }
            }        
            */
        }
    }
    
    
});