/* Layout fix 
If the central column is NOT the longest, the footer will appear to rise up the page
and be overlapped by the outer columns. To fix this we simply need to resize the central 
column on these occasions.
### Event listeners note ###
haven't managed to program this with listeners yet.
It is the ONLY js file which requires a window.onload function call at the bottom
*/
function findHeight() {

	var bodyId = document.getElementsByTagName('body')[0];
	var bodyId = bodyId.id
	
	var x = document.getElementById("content");
	var a = x.offsetHeight;
	if (bodyId == "campaignsSection"){
		
	}
	else {
		
	/* it's not the campaigns section so assign a variable to the other two columns */
	
	var y = document.getElementById("navWrapper");
	var z = document.getElementById("tertiaryLinks");

	//assign a variable to their heights 
	var b = y.offsetHeight;
	var c = z.offsetHeight;
		/* check to see if a is the tallest */
		if (a > b && a > c) {
			
			return;
		}
			/* if it is not, then work out which column is tallest, b or c, 
			then assign its height to a (+ 20 for safety) */
	
		else {
			
			if (c>a && c>b){	/* section links tallest */
				x.style.height = c + 80 + "px";
				}
			else if (b>a && b>c) { /* navigation tallest */
				x.style.height = b + 50 + "px";
				
			}
		}
	/* next line just for use in testing
	alert("Content = " + a + ", navigation = " + b + " and sidebar = " + c)*/
	
	
	}// end bodyId if
	
}

window.onload = findHeight;