function updateControlPanelList(li_id)
{
  var ul_parent = jQuery('#'+li_id).parent();

  jQuery('#'+li_id).fadeOut(500, function(){
    
    if (ul_parent.children().length == 1)
    {
       var h3_id = 'h3_'+ ul_parent.attr('id');
       var p_id  = 'p_'+ ul_parent.attr('id');
       jQuery('#'+h3_id).fadeOut(500, function(){
         jQuery('#'+h3_id).remove();
       });
       jQuery('#'+p_id).fadeOut(500, function(){
         jQuery('#'+p_id).remove();
       });
	   ul_parent.fadeOut(500, function(){
         ul_parent.remove();
       });
    }
    else
    {
       jQuery('#'+li_id).remove();
    }
    
  });
  
  if ($('restore_view_link').style.display == 'none')
  {
    $('restore_view_link').show();
  }
}


function showHideDivAndLinksAjax(div_id, expand_link_id, close_link_id, section_to_update)
{
	if (!$(div_id)) return false;
	if (!$(expand_link_id) || !$(close_link_id))
	{
        showHide(div_id);
        return;
    }

	if ($(div_id).style.display == 'none')
    {
        if (!eval('hp_section_'+section_to_update+'_expanded'))
        {
            new Ajax.Updater('main_my_'+section_to_update,
                     '/index.php/load_my_activity/'+section_to_update+'.html', {
                     asynchronous: true,
                     evalScripts:  false,
                     onLoading:    function(request, json){
	                                  updateGeneralNoticeMessageJQ("Loading...");
                                   },
                     onComplete:   function(request, json){
                                      closeGeneralNoticeJQ();
                                      eval('hp_section_'+section_to_update+'_expanded = true;');
                                      $(expand_link_id).hide();
                                      Effect.BlindDown(div_id, {duration:0.5});
                                      $(close_link_id).show();
                                   }
            });
        }
        else
        {
            $(expand_link_id).hide();
            Effect.BlindDown(div_id, {duration:0.5});
            $(close_link_id).show();
        }
    }
	else
    {
        $(close_link_id).hide();
        Effect.BlindUp(div_id, {duration:0.5});
        $(expand_link_id).show();
    }
}

