// JavaScript Document

$(document).ready(function(){
	var $bannerState ="close";
	$("#banner_tabs").bind("click", function(){
		if($bannerState=="close"){
			openBanner();
			$bannerState="open";
		};
	});
	
	$("#banner_closeButton").bind("click", function(){
		if($bannerState=="open"){
			closeBanner();
			$bannerState="close";
		};
	});


	function openBanner(){
		$("#banner").animate({ 
			width: 400,
			right: 0
		  }, 800, 'easeOutExpo' )
	};
	
	function closeBanner(){
		$("#banner").animate({ 
			right: 0,
			width: 35
		  }, 400, 'easeInExpo' )
	};


	//Properties and animations for the bottom tab.
	var $footerState;
	$footerState = "close";
	
	
	$("#footer_tabs_sitemap").bind('click', function(){
		 toggleFooter();
	 });
													 
	$("#content").bind('click', function(){
		if($footerState=="open"){
			closeFooter();
			$footerState="close";
		};
		
		if($bannerState=="open"){
			closeBanner();
			$bannerState="close";
		};
									  });
							   
	function toggleFooter(){
		if ($footerState=="close"){
			openFooter();
			$footerState="open";
		} else if ($footerState=="open"){
			closeFooter();
			$footerState="close";
		};
	};
	
	function openFooter(){
		$("#footer").animate({ 
		height: 573
		}, 800, 'easeOutExpo' );
		$("#footer_tabs_arrow").attr({ src: "images/footer_tab_sitemap_arrowDown.png" });
		
	};

	function closeFooter(){
		$("#footer").animate({ 
		height: 64
		}, 800, 'easeOutBounce' );
		$("#footer_tabs_arrow").attr({ src: "images/footer_tab_sitemap_arrowUp.png" });
	};

});
