/**
 * @author mpeccini
 */




//--------------------------------------
//this controls all the formatting of the interlocking frames units in px
			var bannerHeight = 60;
			var subBannerHeight = 26;
			//var bannerWidth = 1000;
			var leftFrameWidth = 0;
			var leftFrameHeight;
			var bottomFrameHeight = 20;
			var bottomFrameWidth;
			var mapFrameHeight;
			var mapFrameWidth;
			var theWidth, theHeight;
			var mapTitleWidth = 300;
			var projectPageWidth = 700;
			
			var zoomGroupPos =  10;
			
			var zoomToolsPositionRight = 5;
			var zoomToolsPositionTop = zoomGroupPos;
			var zoomRight = 22; 
			var zoomTop = zoomGroupPos + 2;
			var googleZoomTop = 40;
			var googleZoomRight = 5;
			var backRightPosition = 34;
			var backTopPosition = 2;
//-------------------------------------------
//builds the simulated frameset
			var loaded=false;

			function resizeFrames(){
			//alert("resize frames")
			//Gets client window sizes
			if (window.innerWidth) {
				theWidth=window.innerWidth;
			}
			else if (document.documentElement && document.documentElement.clientWidth) {
				theWidth=document.documentElement.clientWidth;
			}
			else if (document.body) {
				theWidth=document.body.clientWidth;
			}
			
			if (window.innerHeight) {
				theHeight=window.innerHeight;
			}
			else if (document.documentElement && document.documentElement.clientHeight) {
				theHeight=document.documentElement.clientHeight;
			}
			else if (document.body) {
				theHeight=document.body.clientHeight;
			}

				//resetTitleOnResize();
				mapFrameHeight = theHeight - bottomFrameHeight - bannerHeight - subBannerHeight //- (bannerHeight + bottomFrameHeight)
				mapFrameWidth = theWidth //- (leftFrameWidth)
				bannerWidth = theWidth;
				leftFrameHeight = theHeight - bannerHeight- subBannerHeight;
				bottomFrameWidth = theWidth - leftFrameWidth;
				//banner position
				document.getElementById("banner").style.height = bannerHeight+"px";
				document.getElementById("banner").style.width = bannerWidth+"px";
				document.getElementById("banner").style.opacity = 1;
				//subBanner position
				document.getElementById("subBanner").style.top = bannerHeight+"px";
				document.getElementById("subBanner").style.height = subBannerHeight+"px";
				document.getElementById("subBanner").style.width = bannerWidth+"px";
				document.getElementById("subBanner").style.opacity = 1;				
				//left position
				document.getElementById("leftFrame").style.width = leftFrameWidth+"px";
				document.getElementById("leftFrame").style.top = bannerHeight+"px";
				document.getElementById("leftFrame").style.height = leftFrameHeight+"px";
				//document.getElementById("leftFrame").style.z-index = 100;
				//map position
				document.getElementById("mapFrame").style.top = bannerHeight+subBannerHeight+"px";
				document.getElementById("mapFrame").style.left = 0//leftFrameWidth+"px";
				document.getElementById("mapFrame").style.height = mapFrameHeight+"px";
				document.getElementById("mapFrame").style.width = mapFrameWidth+"px";
				
				document.getElementById("splash").style.top = theHeight/2-50+"px";
				document.getElementById("splash").style.left = mapFrameWidth/2-100+"px"//leftFrameWidth+"px";
				document.getElementById("splash").style.height = "40px"
				document.getElementById("splash").style.width = "150px";
				//document.getElementById("splash").style.opacity = 0.5;
				
				document.getElementById("download").style.top = mapFrameHeight/2+"px";
				document.getElementById("download").style.left = mapFrameWidth/2+"px";
				document.getElementById("download").style.height = mapFrameHeight+"px";
				document.getElementById("download").style.width = mapFrameWidth+"px";
				//document.getElementById("download").style.opacity = 0.5;
				
				//footer position
				document.getElementById("bottomFrame").style.height = bottomFrameHeight+"px";
				document.getElementById("bottomFrame").style.left = leftFrameWidth+"px";
				document.getElementById("bottomFrame").style.width = bottomFrameWidth+"px";
				
				//map layer size
				document.getElementById("googleMap").style.height = mapFrameHeight+"px";
				document.getElementById("googleMap").style.width = mapFrameWidth+"px";
				
				//zoom tools
				document.getElementById("zoomTools").style.top = zoomToolsPositionTop+"px";
				document.getElementById("zoomTools").style.right = zoomToolsPositionRight+"px";
				
				//map title
				//alert(mapFrameWidth/2-250)
				document.getElementById("mapTitleContent").style.left = mapFrameWidth/2-250+"px";
				document.getElementById("mapTitleContent").style.top = bannerHeight+subBannerHeight+5+"px";
				//if (titleOn == true){
					//document.getElementById("mapTitleContent").style.display = "block";
				//}
				
				//project page
				document.getElementById("projectPage").style.top = 0+"px";
				document.getElementById("projectPage").style.left = 0+"px";
				document.getElementById("projectPage").style.height = mapFrameHeight+bannerHeight+subBannerHeight+bottomFrameHeight+"px";
				document.getElementById("projectPage").style.width = mapFrameWidth+"px";
				//document.getElementById("projectPage").style.opacity = 0.7;
				
				
				document.getElementById("page").style.top = bannerHeight+10+"px";
				document.getElementById("page").style.left = (mapFrameWidth/2 - projectPageWidth/2) +"px";
				document.getElementById("page").style.height = mapFrameHeight+subBannerHeight-20+"px";
				document.getElementById("page").style.width = projectPageWidth+"px";
				

				
				document.getElementById("projectPageFrame").style.top = bannerHeight+10+"px";
				document.getElementById("projectPageFrame").style.left = (mapFrameWidth/2 - projectPageWidth/2) +"px";
				document.getElementById("projectPageFrame").style.height = mapFrameHeight+subBannerHeight-50+"px";
				document.getElementById("projectPageFrame").style.width = projectPageWidth+"px";
				


				document.getElementById("imageViewer").style.top = bannerHeight+subBannerHeight+0.25*mapFrameHeight+"px";
				document.getElementById("videoViewer").style.top = bannerHeight+subBannerHeight+0.1*mapFrameHeight+"px";
				//document.getElementById("imageViewer").style.left = (mapFrameWidth/2 - projectPageWidth/2) +"px";
				//document.getElementById("imageViewer").style.height = mapFrameHeight+subBannerHeight-50+"px";
				//document.getElementById("imageViewer").style.width = projectPageWidth+"px";
	
/*
				document.getElementById("jquery-overlay").style.top = bannerHeight+subBannerHeight+"px";
				document.getElementById("jquery-overlay").style.left = "0px"//leftFrameWidth+"px";
				document.getElementById("jquery-overlay").style.height = theHeight - bottomFrameHeight - bannerHeight - subBannerHeight+"px"
				document.getElementById("jquery-overlay").style.width = mapFrameWidth+"px";
*/


				
				//add version number
				document.getElementById("version").innerHTML = version;
				
				if(loaded==true){
					resetTitleOnResize();
				}
				loaded = true;
			}
		
			
var zoomButtonCode = "";
	zoomButtonCode +='<table class="zoom_buttons"><tr>'
	//zoomin
	//zoomButtonCode +='<td class="zoom_buttons" id="z1"  onmousedown="javascript: setTool(\'zoomIn\')" onmouseup="this.style.border=\'1px solid red\'" ><img class="icon" src="images/nav_buttons/zoomin_1.gif" alt="zoom in"></td>'
	//pan
	//zoomButtonCode +='<td class="zoom_buttons" id="z2" onmousedown="javascript: setTool(\'pan\')" onmouseup="this.style.border=\'1px solid red\'" ><img class="icon" src="images/nav_buttons/pan_1.gif" alt="pan"></td>'
	//zoom all
	//zoomButtonCode +='<td class="zoom_buttons" onclick="javascript: zoomToFull()"><img class="icon" src="images/nav_buttons/zoom_to_all.gif" alt="zoom to full extent" name="zoom to full extent"></td>'
	zoomButtonCode +='</tr></table>'
	document.getElementById("zoomTools").innerHTML = zoomButtonCode;
			
resizeFrames()

