// javascript functions
// last updated 09/05/08

i = 0;
if (window.addEventListener) {
	window.addEventListener('load', checkCount, false);
	window.addEventListener('resize', checkCount, false);
} else if (window.attachEvent) {
	window.attachEvent('onload', checkCount);
	window.attachEvent('onresize', checkCount);
} else {
	window.onload = checkCount;
	window.onresize = checkCount;
}

function checkCount() {
	
	if (window.outerWidth) {
		// FF
		var dim = window.outerWidth;
		dimCheck(dim, 725, 800);
	} else {
		// IE
  	if (i == 0) {
			var dim = document.body.clientWidth;
  		dimCheck(dim, 625, 685);
  		i = 1;
  	} else if (i == 1) {
  		i = 0;
  	}
	}
}
	
function dimCheck(dim, s1, s2) {

	var body = document.body;
	var pNav = document.getElementById('primary-nav');
  var content = document.getElementById('content');
	var footer = document.getElementById('footer');
	if (dim <= s1) {
		var newHeight = document.getElementById('logos').offsetHeight+85;
		var cssParams = 'margin-top:' + newHeight + 'px;';
		body.className = 'm725';
		content.className = 'pos725';
		content.style.cssText = cssParams;
		pNav.className = 'p725';
		footer.className = 'p725';
	} else if (dim <= s2) {
		// small window - set the class names to adjust the margins
		body.className = 'm800';
		pNav.className = 'p800';
		content.className = '';
		content.style.cssText = '';
		footer.className = 'p800';
	} else {
		// larger window - clear class names and revert to defaults 
		body.className = '';
		pNav.className = '';
		content.className = '';
		content.style.cssText = '';
		footer.className = '';
	}
}
