/* javascriptFunctions.js
*************************
Variety of javascript functions that may be used throughout the site

Functions:
	- minimizeWindow(windowID)
	- maximizeWindow(windowID)
	- popupWindow(windowURL, windowWidth, windowHeight)
	- toggleShowHide(divID)

*/

/* minimizeWindow
*****************
"shrinks" a menu Mac style
*/
function minimizeWindow(windowID){
	document.getElementById(windowID).style.display = 'none';
}

/* maximizeWindow
*****************
"expands" a menu Mac style
*/
function maximizeWindow(windowID){
	document.getElementById(windowID).style.display = 'block';
}

/* toggleShowHide
*****************
Toggles allowing show or hide.
*/
function toggleShowHide(divID){
	if(document.getElementById(divID).style.display=='block'){
		document.getElementById(divID).style.display='none';
	}
	else{
		document.getElementById(divID).style.display='block';
	}
}


/* popupWindow
**************
Just opens a window at the given url with given dimensions
*/
var newWin;

function popupWindow(windowURL, windowWidth, windowHeight){
	var topPos = "";
	var leftPos = "";
	if(!windowWidth) windowWidth = 0;
	if(!windowHeight) windowHeight = 0;

	if(windowWidth == 0){
		if(screen){
			windowWidth = screen.availWidth -10;
		}
		else{
			windowWidth = 790;
		}
		leftPos = ",left=0";
	}

	if(windowHeight == 0){
		if(screen){
			windowHeight = screen.availHeight -30;
		}
		else{
			windowHeight = 790;
		}
		topPos = ",top=0";
	}

	newWin = window.open(windowURL,"ywam","toolbar=no,menubar=0,width="+windowWidth+",height="+windowHeight+topPos+leftPos+",scrollbars=yes,resizable=yes");

	if(javascript_version > 1.0){
		setTimeout('newWin.focus();',100);
	}
}