// Sidebar
function showTabs(tab) {
    if(tab == 'keywords') {
        document.getElementById("keywords_link").blur();
        document.getElementById("keywords").className = "on";
        document.getElementById("archives").className = "";
        document.getElementById("contributors").className = "last_tab";
        document.getElementById("tab-keywords").style.display = "";
        document.getElementById("tab-keywords-random").style.display = "none";
        document.getElementById("tab-archives").style.display = "none";
        document.getElementById("tab-contributors").style.display = "none";
        document.getElementById("tab-keywords-random").style.display = "none";
    }
    if(tab == 'keywords-random') {
        document.getElementById("tab-keywords").style.display = "none";
        document.getElementById("tab-keywords-random").style.display = "";
    }
    if(tab == 'archives') {
        document.getElementById("archives_link").blur();
        document.getElementById("keywords").className = "";
        document.getElementById("archives").className = "on";
        document.getElementById("contributors").className = "last_tab";
        document.getElementById("tab-keywords").style.display = "none";
        document.getElementById("tab-keywords-random").style.display = "none";
        document.getElementById("tab-archives").style.display = "";
        document.getElementById("tab-contributors").style.display = "none";
    }
    if(tab == 'contributors') {
        document.getElementById("contributors_link").blur();
        document.getElementById("keywords").className = "";
        document.getElementById("archives").className = "";
        document.getElementById("contributors").className = "last_tab on";
        document.getElementById("tab-keywords").style.display = "none";
        document.getElementById("tab-keywords-random").style.display = "none";
        document.getElementById("tab-archives").style.display = "none";
        document.getElementById("tab-contributors").style.display = "";
    }
    return false;
}


// Footer
function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	} else {
	if (document.documentElement && document.documentElement.clientHeight) {
		windowHeight = document.documentElement.clientHeight;
	} else {
	if (document.body && document.body.clientHeight) {
		windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
	}
	function setFooter() {
		if (document.getElementById) {
		var windowHeight = getWindowHeight();
		if (windowHeight > 0) {
			var contentHeight = document.getElementById('page').offsetHeight;
			var footerElement = document.getElementById('footer');
			var footerHeight  = footerElement.offsetHeight;
			if (windowHeight - (contentHeight + footerHeight) >= 0) {
				footerElement.style.position = 'relative';
				/*footerElement.style.top = (windowHeight - (contentHeight + footerHeight)) + 'px';*/
			} else {
				footerElement.style.position = 'static';
				}
			}
		}
	}
	window.onload = function() {
	setFooter();
	}
	window.onresize = function() {
		setFooter();
}

