window.onresize = adjustLayout;

//adjusts layout width window
function adjustLayout() {



    //get height and width values for window
    browserHeight = getBrowserHeight();
    browserWidth = getBrowserWidth();
    
    //get height and width values for header and footer
    headerHeight=document.getElementById('header').offsetHeight;
    footerHeight=document.getElementById('footer').offsetHeight;
	bodyHeight=document.getElementById('content').offsetHeight;
    
   //set page height
    pageHeight = headerHeight + bodyHeight + footerHeight;
    
    
    //for interior pages -- if page height is less than browser window height, set footer to bottom of browswer window
    if (pageHeight < browserHeight) {
    document.getElementById('footer').style.position = "absolute";
    document.getElementById('footer').style.marginLeft = "auto";
    document.getElementById('footer').style.marginRight = "auto";
    document.getElementById('footer').style.bottom = "0px";
    document.getElementById('footer').style.width = (browserWidth - 10) + "px";
    }
    
    if (pageHeight > browserHeight) {
    document.getElementById('footer').style.position = "static";
    }
}
    
    
    
/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ADJUST FOOTER POSITION FOR LARGE SCREENS FOR HOME PAGE 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
    

    

//retrieves height of browser window
function getBrowserHeight() {
    if (window.innerHeight) {
    return window.innerHeight;    
    }
    if (document.documentElement.clientHeight) {
    return document.documentElement.clientHeight;    
    }
 return (null);
}
//retrieves width of browser window
function getBrowserWidth() {
    if (window.innerWidth) {
    return window.innerWidth;    
    }
    if (document.documentElement.clientWidth) {
    return document.documentElement.clientWidth;    
    }
 return (null);
}		


/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
POP UP WINDOWS
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
// POP UP
function popUp(url, width, height, windowName, ypos, xpos, scrollbars) { 
	params = "toolbar=0,";
	params += "location=0,";
	params += "directories=0,";
	params += "status=0,";
	params += "menubar=0,";
	params += "resizable=1,"; 
	
	params += "width="+width+",";
	params += "height="+height;
	if (xpos != null) { params += ",screenX="+xpos; }
	if (ypos != null) { params += ",screenY="+ypos; }
	if (scrollbars != null) 
	{ 
		params += ",scrollbars=" + scrollbars; 
	} else {
		params += ",scrollbars=yes";
	}
	win = window.open(url, windowName, params);
	//win.target =  windowName;
	win.opener.name = "opener";
	win.focus();
}

//pop screen shot gallery-fixed width to 725x600
function SSpopUp(url, windowName, scrollbars) { 
	params = "toolbar=0,";
	params += "location=0,";
	params += "directories=0,";
	params += "status=0,";
	params += "menubar=0,";
	params += "resizable=1,"; 

	if (scrollbars != null) 
	{ 
		params += ",scrollbars=" + scrollbars; 
	} else {
		params += ",scrollbars=yes";
	}
	win = window.open(url, windowName, "width=725,height=660,"+params);
	//win.target =  windowName;
	win.opener.name = "opener";
	win.focus();
}

// POP UP with headers
function popUpHeaders(url, width, height, windowName, ypos, xpos, scrollbars) { 
	params = "toolbar=1,";
	params += "location=1,";
	params += "directories=0,";
	params += "status=1,";
	params += "menubar=1,";
	params += "resizable=1,"; 
	
	params += "width="+width+",";
	params += "height="+height;
	if (xpos != null) { params += ",screenX="+xpos; }
	if (ypos != null) { params += ",screenY="+ypos; }
	if (scrollbars != null) 
	{ 
		params += ",scrollbars=" + scrollbars; 
	} else {
		params += ",scrollbars=yes";
	}
	win = window.open(url, windowName, params);
	//win.target =  windowName;
	win.opener.name = "opener";
	win.focus();
}


function openFullWindow(url){

	if (window.opener) {
		 window.opener.location = url;
		 window.opener.focus();
	}
	
	else {
	window.open(url, '', '');
		 }
}

