(function($) {
	$(document).ready(function() {		
		$('.location-name').click(
			function() {
				// Hide any and all info boxes and thumbnails
				$('.location-info').css('display', 'none');
				$('.location').css('z-index', '98');
				$('.location-info-right').css('display', 'none');
				$('.location-thumb').css('display', 'none');
								
				// Show the thumbnail and info box (effectively all children of parent)
				sibilings = $(this).parent().children()
				sibilings.css('display', 'block');

				info = $(this).parent().children('.location-info');
				if (info != null) {
					zindex = info.css("z-index");
					$(this).parent().css("z-index", ++zindex);
				}
			}
		);
		
		$('.location-info-close').click(
			function() {
				// Find grandparent, the entire info box
				grandparent = $(this).parent().parent();
				
				// Hide all the children
				grandparent.children().css('display', 'none');
				// ...except the name, we still want that
				grandparent.children('.location-name').css('display', 'block');

				// Reset the z-index for IE
				//$('.location').css("z-index","98");
				//$('.location-first').css("z-index","98");
				//$('.location-last').css("z-index","98");
			}
		);
    });
})(jQuery);
