/* level2.js */
var nsDiv = "navDefault";

function swapImage() {
	if (document.images) {
		for(var i=0;i<arguments.length;i++) {
			document.images[arguments[i]].src = arguments[i+1];
			++i;
		}
	}
}

if (document.layers) {
	origWinWidth = window.innerWidth;
	origWinHeight = window.innerHeight;
	
	window.onresize = function() {
		currWinWidth = window.innerWidth;
		currWinHeight = window.innerHeight;
		if((origWinWidth != currWinWidth) || (origWinHeight != currWinHeight)) location.reload();
	}
} else if (isIE) {
	window.onresize = reloadPage;
}

function reloadPage() {
	setTimeout("window.location.reload(0)",500);
}

function getWindowHeight() {
	h = (isIE)?document.body.offsetHeight:window.innerHeight;
	if (isNS4) h+=4;
	if (isMacIE5) h+=2;
	if (isMacIE45) h+=4;
	return h;
}

function getImageTop(img) {
	if (isNS4) return document.images[img].y;
	imgTop = document.images[img].offsetTop;
	imgParent = document.images[img].offsetParent;
	while (imgParent != null) {
		imgTop += imgParent.offsetTop;
		imgParent = imgParent.offsetParent;
	}
	return imgTop
}

function swapHTML(div, markup) {
	var objHTML = (isDOM)?document.getElementById(div):(isIE4)?document.all[div]:(isNS4)?document.layers[div]:null;
	if (isDOM || isIE4) {
		objHTML.innerHTML = markup;
	}
	if (isNS4) {
		objHTML.document.open();
		objHTML.document.write(markup);
		objHTML.document.close();
	}
}

function writeSpacer() {
	spacerHeight = getWindowHeight()-getImageTop("testHeight")-5;
	if (spacerHeight>0) {
		swapHTML("divSpacer",'<img src="/images/spacer_blue.gif" width="775" height="'+spacerHeight+'" border="0" alt="" />');
	}
}

