jQuery.fn.caritas_image_title = function() {
  // Show on mouse enter
  jQuery(this).mouseenter(function(){
    jQuery('.image-title', this).fadeIn(500);
  });
  // Hide on mouse leave (duh)
  jQuery(this).mouseleave(function(){
    jQuery('.image-title', this).fadeOut(1000);
  });
}

jQuery.fn.caritas_map = function() {
  // Set handy variables
  var $menu_item = jQuery('ul li', this);
  var $map = jQuery('.map-holder', this);
  
  // Loop through each menu item to do cool stuff
  $menu_item.each(function(){
    // Toggle map class based on link name
    jQuery(this).mouseenter(function(){
      var $c = jQuery('.title a', this).text().toLowerCase();
      $map.append('<div class="overlay ' + $c +'" />');
      jQuery('.overlay', $map).show();
    });
    jQuery(this).mouseleave(function(){
      jQuery('.overlay', $map).remove();
    });
  });
}
;
jQuery(function(){
  // Invoke fading image title function
  jQuery('#node .view-content-media .field-content').caritas_image_title();
  jQuery('#node .field-type-image').caritas_image_title();
  jQuery('.view-content-listing-header-messages .image > div').caritas_image_title();

  // Invoke map function
  jQuery('.caritas-map').caritas_map();
});
;

