function menu() {
	var url = window.location.href;
	if (url.substring(url.length - 1, url.length) != "/") {
		var fileName = url.substring(url.lastIndexOf("/") + 1, url.lastIndexOf("."));
	} else {
		var fileName = "index";
	}
	if (document.getElementById("mainMenu")) {
		var mainCurrentAttribute = document.createAttribute("class");
		mainCurrentAttribute.nodeValue = "current";
		var mainA = document.getElementById("mainMenu").getElementsByTagName("a");
		var mainALength = mainA.length;
		for (var i = 0; i < mainALength; i++) {
			var mainAName = mainA[i].href.substring(mainA[i].href.lastIndexOf("/") + 1, mainA[i].href.lastIndexOf("."));
			if (mainAName == fileName) {
				mainA[i].parentNode.setAttributeNode(mainCurrentAttribute);
			}
		}
	}
}
function windowHeightCalculation() {
	var windowHeight = (window.innerHeight) ? /*non IE*/ window.innerHeight : /*IE 6+*/ document.documentElement.clientHeight;
	return windowHeight;
}
function footerPlacement() {
	if (document.getElementById) {
		var windowHeight = windowHeightCalculation();
		if (windowHeight > 0) {
			var footerElement = document.getElementById('footer');
			var contentElement = document.getElementById('content');
			var headerHeight = document.getElementById('header').offsetHeight;
			var contentHeight = contentElement.offsetHeight;
			var footerHeight  = footerElement.offsetHeight;
			var footerOffset = windowHeight - (headerHeight + contentHeight + footerHeight);
			if (footerOffset >= 0) {
				contentElement.style.height = contentHeight + footerOffset + 'px';
				footerElement.style.top = footerOffset + 'px';
			} else {
				footerElement.style.top = '0px';
			}
		}
	}
}
window.onload = function() {
	menu();
	footerPlacement();
}
window.onresize = function() {
	footerPlacement();
}
