jQuery(function($) {
  $block_links = $('.block-links');

  turnBlockElementsToLinks($block_links);

  /**
	 * This function takes a set of modules and wraps them in
	 * a-tags. This makes it possible to make an entire module
	 * clickable while still conforming to XHTML 1.0 Strict.
	 */
	
	function turnBlockElementsToLinks(modules) {
		modules.each(function() {
			var link = $('<div>').append($(this).find('a:first').clone()).find('a');
			link.html('')
		
			$(this).find('a').each(function() {
				$(this).replaceWith($(this).html());
			});
			
			var content = $('<div>').append($(this).children().clone()).remove();
			
			$(this).html('').append(link.append(content));
			$(this).children('a').addClass('block-link');
		});
	}
});
