﻿Layout = new (function () {
	this.fix = function () {
		var elm = document.getElementById ('ExpandaNav');
		var sidebar = document.getElementById ('SideBarMain');
		var contactLink = document.getElementById ('SideBarContactLink');
		var height = elm.parentNode.offsetHeight - 26;
		var padding = 0;
		var node = null;
		
		if (elm.offsetHeight < height) elm.style.height = height + 'px';
		
		var coord = document.getElementsByClassName ('coordItems')
		if (coord.length) {
			var elm2 = document.getElementById ('InnerContent');
			var height2 = elm2.parentNode.offsetHeight - 35;
		
			if (elm2.offsetHeight < height2) elm2.style.height = height2 + 'px';
			coord [0].style.position = 'absolute';
			coord [0].style.bottom = '0px';
		}
		
		if (contactLink) {
			for (var i = 0; i < sidebar.childNodes.length; i++) {
				node = sidebar.childNodes [i];
				if (node.offsetHeight && node !== contactLink) {
					padding += sidebar.childNodes [i].offsetHeight;
				}
			}
			contactLink.style.marginTop = (sidebar.offsetHeight - contactLink.offsetHeight - padding) + 'px';
		}
	}
}) ();
