

var detect = navigator.userAgent.toLowerCase();

var OS,browser,version,total,thestring;



if (checkIt('konqueror'))

{

	browser = "Konqueror";

	OS = "Linux";

}

else if (checkIt('safari')) browser = "Safari"

else if (checkIt('omniweb')) browser = "OmniWeb"

else if (checkIt('opera')) browser = "Opera"

else if (checkIt('webtv')) browser = "WebTV";

else if (checkIt('icab')) browser = "iCab"

else if (checkIt('msie')) browser = "Internet Explorer"

else if (!checkIt('compatible'))

{

	browser = "Netscape Navigator"

	version = detect.charAt(8);

}

else browser = "An unknown browser";



if (!version) version = detect.charAt(place + thestring.length);



if (!OS)

{

	if (checkIt('linux')) OS = "Linux";

	else if (checkIt('x11')) OS = "Unix";

	else if (checkIt('mac')) OS = "Mac"

	else if (checkIt('win')) OS = "Windows"

	else OS = "an unknown operating system";

}



function checkIt(string)

{

	place = detect.indexOf(string) + 1;

	thestring = string;

	return place;

}



var req;



function callAjax(url, params)

{

  if(window.XMLHttpRequest) {

    try {

      req = new XMLHttpRequest();

    } catch(e) {

      req = false;

    }

  } else if(window.ActiveXObject) {

    try {

      req = new ActiveXObject("Msxml2.XMLHTTP");

    } catch(e) {

      try {

        req = new ActiveXObject("Microsoft.XMLHTTP");

      } catch(e) {

        req = false;

      }

    }

  }

  if(req) {

    req.open("GET", url + '?marginHeight=' + params, true);

    req.send(null);

    return true;

  }

  return false;

}



function setHeight() {

var windowHeight;

if ((OS == "Windows") & (browser == "Internet Explorer")) { // Set Height - Win IE 

	if (document.documentElement && (document.documentElement.clientHeight)) { // IE 6+ in 'standards compliant mode'

	windowHeight = parseInt(document.documentElement.clientHeight,10);

  	} else if (document.body && (document.body.clientHeight)) { // IE 4 compatible

    windowHeight = parseInt(document.body.clientHeight,10);

  	}

	//alert(windowHeight);

	var contentHeight = parseInt(document.getElementById('centreColumn').offsetHeight,10);

	var marginHeight = Math.round((windowHeight - contentHeight) / 2)

	if (windowHeight <= (contentHeight + 80)) {

	document.getElementById('content').style.marginTop = 40;

	}

	else if (windowHeight > (contentHeight + 80)) {

	document.getElementById('content').style.marginTop = marginHeight;

	}	

}

else if ((OS == "Mac") & (browser == "Internet Explorer")) { // Set Height - Mac IE 

	var windowHeight = parseInt(document.body.offsetHeight,10);

	var contentHeight = parseInt(document.getElementById('centreColumn').offsetHeight,10);

	var marginHeight = Math.round((windowHeight - contentHeight) / 2)

	var content = document.getElementById('content');

	if (windowHeight <= (contentHeight + 80)) {

	content.style.marginTop = "40px";

	}

	else if (windowHeight > (contentHeight + 80)) {

	content.style.marginTop = marginHeight + "px";

	}	

}

else { // Set Height - Mozilla & Netscape, Both Platforms 

	var windowHeight = parseInt(window.innerHeight,10);

	var contentHeight = parseInt(document.getElementById('centreColumn').offsetHeight,10);

	var marginHeight = Math.round((windowHeight - contentHeight) / 2)	

	if (windowHeight <= (contentHeight + 80)) {

	document.getElementById('content').style.marginTop = "40px";

	}

	else if (windowHeight > (contentHeight + 80)) {

	document.getElementById('content').style.marginTop = marginHeight + "px";

	}

}

//callAjax('/NoIndex/CodeIncludes/AJAX.asp',marginHeight)

document.getElementById('content').style.display = 'block';

//cookieSet('marginHeight',marginHeight)

}



// Load menu content

function init() {

//window.setTimeout('loopSlideOutMenu.pageLoad(\'menu\')', 100);

setHeight();

window.onresize = function onresize() { 

	if (browser == "Internet Explorer") {

		window.setTimeout("setHeight()", 100);

	}

		else {

		setHeight();

		}

	}

}




