// JavaScript Document
// determine and return inner window height
function pageHeight()
{return window.innerHeight != null? window.innerHeight: document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight:document.body != null? document.body.clientHeight:null;}
// determine and return inner window width
function pageWidth()
{return window.innerWidth != null? window.innerWidth: document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth:document.body != null? document.body.clientWidth:null;}

//this function is kludgy -- using magic numbers and with element ids hard-coded into it; will fix when time allows
function setSizes()
{
	//get dimensions for map: page width and height, minus some known border areas (magic numbers, I know . . .)
	var mapHeight  = pageHeight() - 200;
	//var mapWidth  = pageWidth() - 75;
	var mapWidth  = pageWidth() - 345;
	
	//I read somewhere that google maps will render faster if the map dimensions are even numbers
	mapHeight = (mapHeight % 2 == 0) ? mapHeight : mapHeight - 1;
	mapWidth = (mapWidth % 2 == 0) ? mapWidth : mapWidth - 1;
	
	//set map width and height dimensions
	var elem = document.getElementById("pageMap");
	elem.style.height = mapHeight + "px";
	elem.style.width = mapWidth + "px";
	
	//fix height for mainBox
	var mainBoxHeight = pageHeight() - 145;//magic number again
	mainBoxHeight = (mainBoxHeight < 470) ? 470 : mainBoxHeight;
	elem2 = document.getElementById("mainBox");
	elem2.style.height = mainBoxHeight + "px";
}
