$(document).ready(function() {
	$('#thumbnails ol li').hover(
		function() {
			// Get the ID of this thumbnail and find the item in the list which matches it
			var thumbnail = $(this);
			var id = thumbnail.attr('id');
			id = id.substring(6);
			
			// Find all the meta items which have this ID as their class
			$('#meta').find('#listing-'+id).addClass('hover');
		},
		function() {
			// We need to remove the hover class from the meta items
			var items = $('#meta').find('a.hover').each(function() {
				$(this).removeClass('hover');
			});
		}
	);
	
	$('#meta ol li a').hover(
		function() {
			// Get the ID of this item and find any find the corresponding thumbnail
			var item = $(this);
			var id = item.attr('id');
			id = id.substring(8);
			
			// Find all the meta items which have this ID as their class
			$('#thumbnails').find('#thumb-'+id+' a').addClass('hover');
		},
		function() {
			// We need to remove the hover class from the meta items
			var items = $('#thumbnails').find('a.hover').each(function() {
				$(this).removeClass('hover');
			});
		}
	);
});
