// Macromedia Generated JavaScripts

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


// NON - Macromedia Scripts, etc...


/* ##############################################################################################
##########          Dynamically Adjust Height of Content DIVs by Browser Type          ##########
############################################################################################## */

function resizeDiv() {

	var clientWidth;
	var clientHeight;
	var divRight;
	var divContent;
	var divWidth;
	var contentDivWidth;
	var contentDivHeight;
	var leftDivWidth = 310;
	var toLeft = 332;
	var toTop = 97;
	
	//Determine which Browser is Being Used and set maximum available width to document width.
	
	//IE5+
	if (document.getElementsByTagName && typeof(document.body.clientWidth) == 'number' && typeof(window.innerWidth) != 'number') {
		divRight = document.getElementById("container");
		if (document.getElementById("subPageContent")) {
			divContent = document.getElementById("subPageContent");
		}
		clientWidth = document.body.clientWidth;
		clientHeight = document.body.clientHeight;
		var isIE = true;
	}
	//NN6+
	else if (document.getElementsByTagName && typeof(window.innerWidth) == 'number') {
		divRight = document.getElementById("container");
		if (document.getElementById("subPageContent")) {
			divContent = document.getElementById("subPageContent");
		}
		clientWidth = window.innerWidth;
		clientHeight = window.innerHeight;
		var isNN = true;
	}
	//IE4
	else if (document.all && !document.getElementsByTagName) {
		divRight = document.all.elementID("right");
		if (document.all.elementID("subPageContent")) {
			divContent = document.all.elementID("subPageContent");
		}
		clientWidth = document.body.clientWidth;
		clientHeight = document.body.clientHeight;
		var isIE4 = true;
	}
	//NN4
	else if (document.layers && !document.getElementsByTagName) {
		divRight = document.right;
		if (document.subPageContent) {
			divContent = document.subPageContent;
		}
		clientWidth = window.innerWidth;
		clientHeight = window.innerHeight;
		var isNN4 = true;
	}
	
	//Test for 800x600 resolutions and hard-set the content-div's width.
	if (screen.availWidth < 800) {
		divWidth = 460;
		contentDivWidth = 438;
	} else { // If resolution is larger than 800x600
		divWidth = clientWidth;
		contentDivWidth = clientWidth - toLeft;
		contentDivHeight = clientHeight - toTop;
		//alert("Available Client Height = " + clientHeight + "\nContent Div Height = " + contentDivHeight);
	}

	//If browser is IE5+ then set width appropriately
	if (isIE) {
		if (divWidth - 310 > 0) {
			document.getElementById("right").style.width = divWidth - 310;
		} else {
			document.getElementById("right").style.width = divWidth
		}
		if (document.getElementById("subPageContent")) {
			document.getElementById("subPageContent").style.width = contentDivWidth;
			document.getElementById("subPageContent").style.height = contentDivHeight - 110;
		}
	}
	
	//If browser is NN6+ then set width appropriately
	if (isNN) {
		if (divWidth - 310 > 0) {
			document.getElementById("right").style.width = divWidth - 310;
		} else {
			document.getElementById("right").style.width = divWidth
		}
		if (document.getElementById("subPageContent")) {
			document.getElementById("subPageContent").style.width = contentDivWidth - 15;
			document.getElementById("subPageContent").style.height = contentDivHeight - 110;
		}
	}
// End Function	
}

/* ##############################################################################################
######################          End Dynamic Resize Function       ###############################
############################################################################################## */

//Popup script specifically for Map.
function getMap(){
	var mapURL = "/map.htm";
	var aW = screen.availWidth;
	var aH = screen.availHeight;
	var top = (aH - 700)/2;
	var left = (aW - 700)/2;
	var newWin;
	newWin = window.open(mapURL,'map','top='+top+',left='+left+',width=700,height=700,scrollbars=no,resizable=yes');
	if (parseInt(navigator.appVersion >= 4)){ newWin.window.focus(); }
}

/*############################################################################################
	Pop-up window for larger photographs

	This function opens a new window whose size is determined by that of the
	target image.  The image is dynamically written to the new window with a
	hotspot that closes the new window when an individual clicks on the image
	contained within.  
	It has been tested in IE 5.5 + and NN 6.2 + 
############################################################################################*/
	  
function getPhoto(Img,W,H){ //receives the target image name, width, and size respectively
	var photoWin 	= null;
	var wScroll 	= "no";
	var reSize		= "no";
	
	/*---------------------------------------------------------------------------
	/	sets the default url for the target image.  To change the                 /
	/	url, simply replace the "/images/" with the appropriate path (URL)				/
	/	Just be sure that the target image exists in the path (URL) specified.		/
	---------------------------------------------------------------------------*/
	var URL 			= "/images/" +Img; 

	var aW 				= screen.availWidth;
	var aH 				= screen.availHeight;
	
	//set the width & height value for the pop-up window by adding 20 pixels to the target image's width
	//and 40 pixels to the target image's height.  If the resulting window is greater than the user's
	//available screen space, then the window width and height are set to the maximum viewable area of the
	//user's screen respectively. 
	var wW 				= 20 + (parseInt(W));
	var wH 				= 40 + (parseInt(H));
	
	if (wW > aW) { wW = aW; wScroll = "yes"; reSize = "yes"; }
	if (wH > aH) { wH = aH; wW = (wW + 30); wScroll = "yes"; reSize = "yes"; }			
	


	/*------------- Positioning the Pop-Up Window ---------------------------------------------------------
	/		 To set the default top and left locations of the pop-up window, specify the appropriate values   /
	/		 below.  winTop is the distance from the top of the user's screen (in pixels).  winLeft is the    /
	/		 distance from the left of the user's screen (in pixels). Comment and uncomment the following     /
	/    lines to set the desired location of the pop up window.																					/
	-----------------------------------------------------------------------------------------------------*/

	//##### Center Window on Screen #####//
	var winTop		= (aH - wH)/2;												
	var winLeft 	= (aW - wW)/2;
	
	//##### Position window to TOP RIGHT #####//
	//var winTop 		= 0;
	//var winLeft 	= aW - (10 + parseInt(wW));
	
	//##### Position window to TOP LEFT #####//
	//var winTop	= 0;
	//var winLeft = 0;
	
	//##### Position window to TOP CENTER #####//
	//var winTop	= 0;
	//var winLeft = (aW - wW)/2;			
	

	/*---------------------------------------------------------------------------------------------------
	/		Now, we assign the HTML that's to be dynamically written into our pop-up window to a variable		/
	/		It shouldn't be necessary to change any of the code for this variable 													/	
	---------------------------------------------------------------------------------------------------*/
	 	
	var strImage 	= "<html>\r";
			strImage += "<head>\r";
			
			//define a function that resizes the window based upon the target image width and height
			strImage += "<SCR"+"IPT language='JavaScript'> \r";
			strImage += "<!-- \r";
			strImage += "function reSize(){ \r";
			strImage += "if (window.width != "+wW+"){ \r"; 							//checks existing window width
			strImage += " var wW = "+wW+";} \r"; 					 							//sets the window width to the appropriate value
			strImage += "if (window.height != "+wH+"){ \r";							//checks existing window height
			strImage += " var wH = "+wH+";} \r";					 							//sets the window height to the appropraite value
			strImage += "  window.resizeTo(wW,wH); \r";		 							//resizes the window to the new window width & height values (if necessary)
			strImage += "  window.moveTo("+winLeft+","+winTop+"); \r";	//moves the window to the appropriate place on the screen
			strImage += "} \r";
			strImage += "//--> \r";
			strImage += "</scr"+"ipt> \r";
			//end our function
			
			strImage += "</head> \r";
			strImage += "<body bgcolor='#FFFFFF' topmargin='5' leftmargin='5' marginwidth='5' marginheight='5' onLoad='reSize();'> \r";
			strImage += "<p align='center'><a href='javascript:self.close();'> \r";
			strImage += "<img src='"+URL+"' border='0' width='"+W+"' height='"+H+"'> \r";
			strImage += "</a></p> \r";
			strImage += "</body></html> \r";


/* Now that we've finished assigning our new HTML to a variable, it's time to open the pop-up window */				
	photoWin = window.open('','photoWin','width='+wW+',height='+wH+',left='+winLeft+',top='+winTop+',scrollbars='+wScroll+',resizable='+reSize+'');
	photoWin.window.focus();
	
	//Write the Image to the New Window & we're done.
	photoWin.document.write(strImage);
	photoWin.document.close();
}
