jQuery.preloadImages = function()
{
	for(var i = 0; i<arguments.length; i++)
	{
		jQuery("<img>").attr("src", arguments[i]);
	}
}

$('document').ready(function() {

	$('#sub-content li a').each(function() {
		//var title = $("this").attr("title");
		//console.log(this.href);
		$.preloadImages(this.href);
	});
	
	$('#sub-content li a').click(function(e) {
		var newImg = this.href;
		var desc = this.title;
		$('#sub-content li a').removeClass("active");
		this.className += "active";
		$('#facility img').fadeOut('normal',function() {
			this.src = newImg;
			$('#facility img').fadeIn('normal');
			$("p#desc").html(desc);
			
		})
		e.preventDefault();
	});

});

