// Purpose: Resize a Window to max Size
function ResizeToMax()
{
	top.window.moveTo(0,0);
	if (document.all)
		top.window.resizeTo(screen.availWidth,screen.availHeight);
	else if (document.layers || document.getElementById) 
	{
		if (top.window.outerHeight < screen.availHeight || top.window.outerWidth < screen.availWidth)
		{
			top.window.outerHeight = screen.availHeight;
			top.window.outerWidth = screen.availWidth;
		}
	}
}

// Purpose: Open a centered window
function OpenCenteredWindow(strURL, strName, intWidth, intHeight, blnStatus, blnScroll, blnNavBar)
{
	var strStatus;
	var strScroll;
	var strNavBar;
	if (blnStatus) 
		strStatus = 'yes';
	else 
		strStatus = 'no';
	if (blnScroll) 
		strScroll = 'yes';
	else 
		strScroll = 'no';
	if (blnNavBar) 
		strNavBar = 'yes';
	else
		strNavBar = 'no';
		
	var intLeft = 0;
	if (screen.availWidth > intWidth)
	    intLeft = (screen.availWidth - intWidth)/2;
	var intTop = 0;
	if (screen.availHeight > intHeight)
		intTop = (screen.availHeight - intHeight)/2;
	
	strWinProp = "toolbar=" + strNavBar        
				+ ",status=" + strStatus       
				+ ",scrollbars=" + strScroll   
				+ ",resizable=yes"
				+ ",titlebar=yes"     
				+ ",width=" + intWidth    
				+ ",height=" + intHeight        
				+ ",top=" + intTop              
				+ ",left=" + intLeft;
	if (strName != '')
		var uW = window.open(strURL,strName,strWinProp);
	else
		var uW = window.open(strURL,'',strWinProp);
	if (parseInt(navigator.appVersion) >= 4) 
		uW.window.focus();
}

// Purpose: Open a centered window
function OpenHorizCenteredWindow(strURL, strName, intTop, intWidth, intHeight, blnStatus, blnScroll, blnNavBar)
{
	var strStatus;
	var strScroll;
	var strNavBar;
	if (blnStatus) 
		strStatus = 'yes';
	else 
		strStatus = 'no';
	if (blnScroll) 
		strScroll = 'yes';
	else 
		strScroll = 'no';
	if (blnNavBar) 
		strNavBar = 'yes';
	else
		strNavBar = 'no';
		
	var intLeft = 0;
	if (screen.availWidth > intWidth)
	    intLeft = (screen.availWidth - intWidth)/2;
	//var intTop = (screen.height - intHeight)/2;
	
	strWinProp = "toolbar=" + strNavBar        
				+ ",status=" + strStatus       
				+ ",scrollbars=" + strScroll   
				+ ",resizable=yes"
				+ ",titlebar=yes"     
				+ ",width=" + intWidth    
				+ ",height=" + intHeight        
				+ ",top=" + intTop              
				+ ",left=" + intLeft;
	if (strName != '')
		var uW = window.open(strURL,strName,strWinProp);
	else
		var uW = window.open(strURL,'',strWinProp);
	if (parseInt(navigator.appVersion) >= 4) 
		uW.window.focus();
}

// Purpose: Open a window
function OpenWindow(strURL, strName, intLeft, intTop, intWidth, intHeight, blnStatus, blnScroll, blnNavBar)
{
	var strStatus;
	var strScroll;
	var strNavBar;
	if (blnStatus) 
		strStatus = 'yes';
	else 
		strStatus = 'no';
	if (blnScroll) 
		strScroll = 'yes';
	else 
		strScroll = 'no';
	if (blnNavBar) 
		strNavBar = 'yes';
	else
		strNavBar = 'no';
		
	strWinProp = "toolbar=" + strNavBar        
				+ ",status=" + strStatus       
				+ ",scrollbars=" + strScroll   
				+ ",resizable=yes"
				+ ",titlebar=yes"     
				+ ",width=" + intWidth    
				+ ",height=" + intHeight        
				+ ",top=" + intTop              
				+ ",left=" + intLeft;
	if (strName != '')
		var uW = window.open(strURL,strName,strWinProp);
	else
		var uW = window.open(strURL,'',strWinProp);
	if (parseInt(navigator.appVersion) >= 4) 
		uW.window.focus();
}

// Purpose: Open a window at max size
function OpenMaxWindow(strURL, strName, blnAll, blnNavBar)
{
	var strWinProp = "";
	if (blnAll) 
		strWinProp = " toolbar=yes"        
						+ ",location=yes"     
						+ ",directories=yes"  
						+ ",status=yes"       
						+ ",menubar=yes"      
						+ ",scrollbars=yes"   
						+ ",resizable=yes"
						+ ",titlebar=yes"     
						+ ",width="+screen.availwidth    
						+ ",height="+screen.availheight        
						+ ",top=0"              
						+ ",left=0";
	else // slimmer menu bars, maybe nav bar
	{
		var strNavBar;
		if (blnNavBar) 
			strNavBar = 'yes';
		else
			strNavBar = 'no';
			
		strWinProp = "toolbar=" + strNavBar        
					+ ",location=no"     
					+ ",directories=no"  
					+ ",status=yes"       
					+ ",menubar=no"      
					+ ",scrollbars=yes"   
					+ ",resizable=yes"
					+ ",titlebar=yes"     
					+ ",width="+screen.availwidth    
					+ ",height="+screen.availheight        
					+ ",top=0"              
					+ ",left=0";
	}	
	if (strName != '')
		var dW = window.open(strURL, strName, strWinProp);
	else
		var dW = window.open(strURL, '', strWinProp);
}

// Open Centered Modal Window (for IE only)
function OpenCenteredModal(strURL, strName, intWidth, intHeight, blnStatus, blnScroll, blnRet)
{
	var strStatus;
	var strScroll;
	if (blnStatus)
		strStatus = 'yes';
	else
		strStatus = 'no';
	if (blnScroll) 
		strScroll = 'yes';
	else
		strScroll = 'no';

	var strRet;
	if (strName != '') 
		strRet = window.showModalDialog(strURL, strName, "dialogwidth: " + intWidth + "px; dialogheight: " + intHeight + "px; scroll: " + strScroll + "; status: " + strStatus + ";") + "";
	else
		strRet = window.showModalDialog(strURL, '', "dialogwidth: " + intWidth + "px; dialogheight: " + intHeight + "px; scroll: " + strScroll + "; status: " + strStatus + ";") + "";
	
	if (blnRet)
		return strRet;
}

// Open Horizontally Centered Modal Window (for IE only)
function OpenHorizCenteredModal(strURL, strName, intTop, intWidth, intHeight, blnStatus, blnScroll)
{
	var strStatus;
	var strScroll;
	if (blnStatus)
		strStatus = 'yes';
	else
		strStatus = 'no';
	if (blnScroll) 
		strScroll = 'yes';
	else
		strScroll = 'no';

	var strRet;
	if (strName != '') 
		strRet = window.showModalDialog(strURL, strName, "dialogTop: " + intTop + "px; dialogwidth: " + intWidth + "px; dialogheight: " + intHeight + "px; scroll: " + strScroll + "; status: " + strStatus + ";") + "";
	else
		strRet = window.showModalDialog(strURL, '', "dialogTop: " + intTop + "px; dialogwidth: " + intWidth + "px; dialogheight: " + intHeight + "px; scroll: " + strScroll + "; status: " + strStatus + ";") + "";
	
	if (blnRet)
		return strRet;
}

// Open Modal Window (for IE only)
function OpenModal(blnRet, strURL, strName, intTop, intLeft, intWidth, intHeight, blnStatus, blnScroll, strRet)
{
	var strStatus;
	var strScroll;
	if (blnStatus)
		strStatus = 'yes';
	else
		strStatus = 'no';
	if (blnScroll) 
		strScroll = 'yes';
	else
		strScroll = 'no';
	
	var strRet;
	if (strName != '') 
		strRet = window.showModalDialog(strURL, strName, "dialogtop: " + intTop + "px; dialogleft: " + intLeft + "px; dialogwidth: " + intWidth + "px; dialogheight: " + intHeight + "px; scroll: " + strScroll + "; status: " + strStatus + ";") + "";
	else
		strRet =  window.showModalDialog(strURL, '', "dialogtop: " + intTop + "px; dialogleft: " + intLeft + "px; dialogwidth: " + intWidth + "px; dialogheight: " + intHeight + "px; scroll: " + strScroll + "; status: " + strStatus + ";") + "";

	if (blnRet)
		return strRet;
}

// Navigate to a different webpage
function GotoURL(URL) 
{
    window.location.href = URL;
}

