// JavaScript Document
Array.prototype.inArray = function (value) {
	var i;
	for (i=0; i < this.length; i++) {
		if (this[i] === value) {
			return true;
		}
	}
	return false;
};
var console = true;
window.onresize = pageOnResize;
function allPagesOnLoad() {
	if (console) {
		document.getElementById("outer_frame").style.position = "absolute";
		document.getElementById("outer_frame").style.left = "0px";
		document.getElementById("outer_frame").style.top = "0px";
		document.getElementById("outer_frame").style.width = "760px";
		document.getElementById("outer_frame").style.height = "420px";

		document.getElementById("inner_frame").style.position = "relative";
		document.getElementById("inner_frame").style.backgroundColor = "#FFFFFF";
		document.getElementById("inner_frame").style.marginLeft = "20px";
		document.getElementById("inner_frame").style.marginRight = "20px";
		document.getElementById("inner_frame").style.top = "30px";
		document.getElementById("inner_frame").style.marginTop = "0px";
		document.getElementById("inner_frame").style.height = "260px";

		document.getElementById("content_frame").style.position = "relative";
		document.getElementById("content_frame").style.zIndex = 0;
		document.getElementById("content_frame").style.left = "20px";
		document.getElementById("content_frame").style.top = "0px";
		document.getElementById("content_frame").style.width = "680px";
		document.getElementById("content_frame").style.height = "260px";
		document.getElementById("content_frame").style.paddingRight = "8px";
		document.getElementById("content_frame").style.overflow = "auto";

		if (document.getElementById("html_content_noscript")) {
			document.getElementById("html_content_noscript").style.position = "absolute";
			document.getElementById("html_content_noscript").style.zIndex = 2;
			document.getElementById("html_content_noscript").style.top = "0px";
			document.getElementById("html_content_noscript").style.left = "20px";
			document.getElementById("html_content_noscript").style.width = "640px";
			document.getElementById("html_content_noscript").style.height = "260px";
		}

		document.getElementById("html_content").style.position = "absolute";
		document.getElementById("html_content").style.zIndex = 1;
		document.getElementById("html_content").style.top = "0px";
		document.getElementById("html_content").style.left = "20px";
		document.getElementById("html_content").style.width = "640px";
		document.getElementById("html_content").style.height = "260px";
		document.getElementById("html_content").style.overflow = "auto";

		document.getElementById("inner_frame_bottom").style.position = "absolute";
		document.getElementById("inner_frame_bottom").style.bottom = "-20px";
		document.getElementById("inner_frame_bottom").style.height = "20px";
		document.getElementById("inner_frame_bottom").style.backgroundColor = "#FFFFFF";
		document.getElementById("inner_frame_bottom").style.width = "100%";	

		document.getElementById("footer").style.position = "relative";
		document.getElementById("footer").style.marginLeft = "40px";
		document.getElementById("footer").style.marginRight = "40px";
		document.getElementById("footer").style.top = "54px";
		document.getElementById("footer").style.height = "76px";	

		pageOnResize();
	} else {
		document.body.style.height = null;
		htmls = document.getElementsByTagName("html");
        htmls.item(0).style.width = null;
	}
}
function pageOnResize() {
	var theWidth;
	var theHeight;
//	var leftRightMargins = 40;
//	var topBottomMargins = 240;
	var minFrameWidth = 760;
	var minFrameHeight = 480;
	var innerFrameTBClear = 180;
	var contentFrameLRClear = 100;
	var contentFrameTBClear = 180;
	var mapLRClear = 400;
	var mapTBClear = 240;
	if (window.innerWidth) {
		theWidth = window.innerWidth;
		theHeight = window.innerHeight;
	} else if (document.all) {
		theWidth = document.body.clientWidth;
		theHeight = document.body.clientHeight;
	}
	if (theWidth > 0 && console) {
		if (theWidth > (minFrameWidth+20)) { 
			document.getElementById("outer_frame").style.width = (theWidth-20) + "px";
			document.getElementById("content_frame").style.width = (theWidth - contentFrameLRClear) + "px";
			document.getElementById("html_content").style.width = (theWidth - contentFrameLRClear) + "px";
			if (document.getElementById("map")) {
				document.getElementById("map").style.width = (theWidth - mapLRClear) + "px";
			}
		} else {
			document.getElementById("outer_frame").style.width = (minFrameWidth) + "px";
			document.getElementById("content_frame").style.width = (minFrameWidth - contentFrameLRClear) + "px";
			document.getElementById("html_content").style.width = (minFrameWidth - contentFrameLRClear) + "px";
			if (document.getElementById("map")) {
				document.getElementById("map").style.width = (minFrameWidth - mapLRClear) + "px";
			}
		}
	}
	if (theHeight > 0 && console) {
		if (theHeight > (minFrameHeight+60)) { 
			document.getElementById("outer_frame").style.height = (theHeight-60) + "px";
			document.getElementById("inner_frame").style.height = (theHeight - innerFrameTBClear) + "px";
			document.getElementById("content_frame").style.height = (theHeight - contentFrameTBClear) + "px";
			document.getElementById("html_content").style.height = (theHeight - contentFrameTBClear) + "px";
			if (document.getElementById("map")) {
				document.getElementById("map").style.height = (theHeight - mapTBClear) + "px";
			}
			if (document.getElementById("results")) {
				document.getElementById("results").style.height = (theHeight - mapTBClear) + "px";
			}
		} else {
			document.getElementById("outer_frame").style.height = (minFrameHeight) + "px";
			document.getElementById("inner_frame").style.height = (minFrameHeight - innerFrameTBClear) + "px";
			document.getElementById("content_frame").style.height = (minFrameHeight - contentFrameTBClear) + "px";
			document.getElementById("html_content").style.height = (minFrameHeight - contentFrameTBClear) + "px";
			if (document.getElementById("map")) {
				document.getElementById("map").style.height = (minFrameHeight - mapTBClear) + "px";
			}
			if (document.getElementById("results")) {
				document.getElementById("results").style.height = (minFrameHeight - mapTBClear) + "px";
			}
		}
	}
	if (this.map) {
		this.map.onResize();
	}
}
