var footerActive = '';

// Setup Footer Animation
$(document).ready(function() { 
	$("#footer .footerIcon").click(function(){
		$("#footerSlideOut").slideUp("fast");
		if(footerActive != "")
			$("#" + footerActive + "Icon").attr("src", "/images/" + footerActive + "_off.gif");
		if(footerActive == this.id){
			footerActive = "";
			return;
		}
		$("#footerSlideOutContent").html($("#" + this.id + "Content").html());
		$("#" + this.id + "Icon").attr("src", "/images/" + this.id + "_on.gif");

		// Load all footer images
		$("#footerSlideOutContent img[src='']").attr('src', function(){
			return $(this).attr('tag');
		});

		$("#footerSlideOut").slideDown("fast");
		$("html, body").animate({
			scrollTop: $("#footerEnd").offset().top
		}, 400);
		footerActive = this.id;
	});
});


// Preload Footer Tabs
if(document.images){ 
	var preObj = new Image();
	var preURLs = new Array(
		'/images/footerQuestions_on.gif',
		'/images/footerArticles_on.gif',
		'/images/footerBlogPosts_on.gif',
		'/images/footerProperties_on.gif',
		'/images/footerGroups_on.gif',
		'/images/footerDirectory_on.gif'
	);
	for(var i = 0; i <= preURLs.length; i++) 
		preObj.src = preURLs[i];
}

