(function($){

  $.fn.toggletitle = function(settings) {
    
    var config = {
      body_selector: '.toggle_body' 
    };    
  
    if (settings) $.extend(config, settings);
    
    this.each(function(){
      
      $(this).wrapInner('<a href="#"></a>');
      
      var toggle_body = $(this).next(config.body_selector);
          
      $(this).find('a').click(function(){
        if($(toggle_body).css('display') =='none'){
          toggle_body.show('fast'); 
          $(this).parent().addClass('toggle_expanded');
        }else{
          toggle_body.hide('fast'); 
          $(this).parent().removeClass('toggle_expanded');
        }
        return false; 
        
      });  
        
    });    
  
  }
})(jQuery);        
