document.observe("dom:loaded", function() {
	var footer = $("footer");
	if(footer) {
		var footerContentHeight = 0;
		var footerWrapperHeight = 0;
		footer.select(".footerContent").each(function(footerContent) {
			if(footerContent.getHeight() > footerContentHeight)
				footerContentHeight = footerContent.getHeight();
		});
		
		var content = footer.select(".footerContent").first();
		var contentPadding = parseInt(content.getStyle("paddingTop")) + parseInt(content.getStyle("paddingBottom"));
		
		footerContentHeight -= contentPadding;
		footerWrapperHeight = footerContentHeight + contentPadding;
		
		footer.select(".footerContent", ".footerWrapper").invoke("setStyle", {height: footerContentHeight + "px"})
		footer.select(".footerWrapper").first().setStyle({
			height: footerWrapperHeight + "px"
		});
		
		var footerHeight = footer.getHeight();
		$("content").setStyle({
			marginBottom: footerHeight + "px"
		});
		
		var tabs = footer.select(".tab");
		tabs.each(function(tab) {
			tab.observe("click", function() {
				tabs.invoke("removeClassName", "active");
				footer.select(".footerContent").invoke("setStyle", {zIndex: 10});
				
				this.addClassName("active");
				$(this.readAttribute("rel")).setStyle({
					zIndex: 100
				});
			});
			
			tab.observe("focus", function() {
				this.blur();
			});
		});
	}
});