// FOOTER CODE
/*

	This code controls the sliding animation of the sitemap and contact me button at the footer of the page.
	All Styles and elements are hardcoded so any changes to the script will also need to be change in the html
	
*/


var sliderHeight = "22px";
var sliderOpenHeight = "320px";
var sliderSitemapOpenHeight = "320px";

$(document).ready(function() {
	$(".footerBar").css("height", sliderHeight);
	
	//$("#btnSitemap").click(function() { openSitemap(); });
	$("#btnContactMe").click(function() { openContact(); });
});

function openSitemap() {
	$(".contactPanel").css("display", "none");
	//$(".sitemapPanel").css("display", "block");
	
	$(".footerBar").animate({"height": sliderSitemapOpenHeight}, {duration: "slow" });
	
	unbindControls();
	//$("#btnSitemap").click(function() { closePanel(); });
	$("#btnContactMe").click(function() { switchToContact(); });
}

function openContact() {
	$(".contactPanel").css("display", "block");
	//$(".sitemapPanel").css("display", "none");
	
	$(".footerBar").animate({"height": sliderOpenHeight}, {duration: "slow" }, clearAnimations());
	
	unbindControls();
	$("#btnContactMe").click(function() { closePanel(); });
	//$("#btnSitemap").click(function() { switchToSitemap(); });
}

function closePanel() {
	$(".footerBar").animate({"height": sliderHeight}, {duration: "slow" }, clearAnimations());
	
	unbindControls();
	//$("#btnSitemap").click(function() { openSitemap(); });
	$("#btnContactMe").click(function() { openContact(); });
}

function switchToSitemap() {
	//$(".sitemapPanel").css("display", "block");
	$(".contactPanel").css("display", "none");
	
	unbindControls();
	//$("#btnSitemap").click(function() { closePanel(); });
	$("#btnContactMe").click(function() { switchToContact(); });
}

function switchToContact() {
	$(".contactPanel").css("display", "block");
	//$(".sitemapPanel").css("display", "none");
	
	unbindControls();
	//$("#btnSitemap").click(function() { switchToSitemap(); });
	$("#btnContactMe").click(function() { closePanel(); });
}	

function clearAnimations() {
	$(".footerBar").clearQueue();
	$(".footerBar").stop();
}

function unbindControls() {
	//$("#btnSitemap").unbind();
	$("#btnContactMe").unbind();
}
