// Reformats the table for low vision users

// version:   1.0
// author:    Paul Boag
// email:     paul.boag@headscape.co.uk
// website:   http://www.headscape.co.uk


// Add Load Event - Used to attach events to page load

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

// This is the function that moves the content of the right hand column down the bottom 
function moveNav() {
	if (!document.getElementById || !document.createElement) return false; //Just a bit of error checking
	var parentOfContent = document.getElementById("navigationDiv"); // This finds the container who's content we wish to copy
	var contentList = parentOfContent.childNodes; // This creates an array of all of the content of the parent container
	var newParent = document.createElement("div"); // Creates our new containing DIV
	newParent.setAttribute("id","nNavigationDiv"); // sets the ID of our new containing DIV
	// Below is a loop that adds each of the child elements held in our array to our new containing DIV
	for (var i=0; i < contentList.length; i++) {
		var newElement = contentList[i].cloneNode(true);
		newParent.appendChild(newElement);
	}
	document.getElementById("innerContainer").appendChild(newParent); // This new takes our new containing DIV and adds it back into the document at the end of innerContainer	
	parentOfContent.parentNode.removeChild(parentOfContent); // removes the original parent
}
addLoadEvent(moveNav); // This calls the moveNav function on page load using our Add load event function
