function associateButtonWithPanel(buttonId, panelId) {
  var panel = jQuery(panelId);
  if (panel == null)
    return;

  var panelWidth = panel.width();
  
  panel.hide();
  panel.css('overflow', 'hidden');

  jQuery(buttonId).click(function(event) {
    if (!panel.is(':visible')) {
      panel.hide().width(0).animate({ 'width': panelWidth }, 500, function() {
        applyGeneralHeadings();
      });
      panel.find('.click_to_close').effect('pulsate', { times: 10 }, 1000);
    }
    event.preventDefault();
  });

  panel.find('.click_to_close').click(function(event) {
    panel.animate({ 'width': 0 }, 500, function() { panel.hide(); })
    event.preventDefault();
  });
}