<!-- // hide from non-Javascript browsers
/**********************************************************************
  WINDOW FUNCTIONS LIBRARY
**********************************************************************/

///////////////////////////////////////////////////////////////////////
// SCREENSIZE DETECT
///////////////////////////////////////////////////////////////////////
var screenWidth = (window.screen.width);
var screenHeight = (window.screen.height);


///////////////////////////////////////////////////////////////////////
// FUNCTION: winOpen
// Opens a new window with the specified properties:
// URL :: the URL of the file to load in the window [string]
// name :: the name of the window [string]
// width :: the width (in pixels) of the window [integer]
// height :: the height (in pixels) of the window [integer]
// xPos :: the position X of the window [integer]
// yPos :: the position y of the window [integer]
// drawToCenter :: if TRUE, the window is drawn to the center of the screen, x and y are ignored [boolean]
// fullScreen :: if TRUE, the window is drawn full-screen, x and y are ignored [boolean]
// titlebar :: if TRUE, the window titlebar is displayed [boolean]
// menubar :: if TRUE, the menubar is displayed [boolean]
// toolbar :: if TRUE, the toolbar is displayed [boolean]
// statusbar :: if TRUE, the statusbar is displayed [boolean]
// scrollable :: if TRUE, the window is scrollable [boolean]
// resizable :: if TRUE, the window is resizable [boolean]
///////////////////////////////////////////////////////////////////////
function winOpen(url, name, width, height, xPos, yPos, drawToCenter, fullScreen, titlebar, menubar, toolbar, locbar, statusbar, scrollable, resizable) {

	var newWin;
	var strWidth, strHeight, strUrl, strName, strXPos, strYPos, strStatusbar, strMenubar, strToolbar, strTitlebar, strLocbar, strScroll, strResize, strProps;

	if (!url.length) {
		return false;
	} else {	
		strUrl = url;
	}
	
	if (!name.length) {
		strName = url;
	} else {
		strName = name;
	}
	
			
	if (!fullScreen) {
		strWidth = "width=" + width;
		strHeight = "height=" + height;
		if (drawToCenter) {
			xPos = screen.width/2 - width/2;
			yPos = screen.height/2 - height/2;
		}
	} else {
		strWidth = "width=" + (screen.width - 10);
		strHeight = "height=" + (screen.height - 30);
		xPos = 0;
		yPos = 0;
	}
	

	if (document.all) {
		strXPos = "left=" + xPos;
		strYPos = "top=" + yPos;
	} else {
		strXPos = "screenX=" + xPos;
		strYPos = "screenY=" + yPos;
	}

	(titlebar) ? strTitlebar = "titlebar=yes" : strTitlebar = "titlebar=no";
	(menubar) ? strMenubar = "menubar=yes" : strMenubar = "menubar=no";
	(toolbar) ? strToolbar = "toolbar=yes" : strToolbar = "toolbar=no";
	(locbar) ? strLocbar = "location=yes" : strLocbar = "location=no";
	(statusbar) ? strStatusbar = "status=yes" : strStatusbar = "status=no";
	(scrollable) ? strScroll = "scrollbars=yes" : strScroll = "scrollbars=no";
	(resizable) ? strResize = "resizable=yes" : strResize = "resizable=no";
		
	strProps = strWidth + "," + strHeight + "," + strXPos + "," + strYPos + "," + strTitlebar + "," + strMenubar + "," + strToolbar + "," + strLocbar + "," + strStatusbar + "," + strScroll + "," + strResize;
	
	newWin = window.open(strUrl, strName, strProps);
	newWin.focus();
}

///////////////////////////////////////////////////////////////////////
// Shorthand window method
///////////////////////////////////////////////////////////////////////
function displayWinOpen(url, name, width, height){

	if(!name.length){
		name = "newWindow";
	}
	
	if(width==undefined){
		width = 640;
	}
	
	if(height==undefined){
		height = 480;
	}
			
	var xPos = 20;
	var yPos = 20;
	var drawToCenter = false;
	var fullScreen = false;
	var titlebar = true;
	var menubar = false;
	var toolbar = false;
	var locbar = false;
	var statusbar = false;
	var scrollable = true;
	var resizable = true;
	
	winOpen(url, name, width, height, xPos, yPos, drawToCenter, fullScreen, titlebar, menubar, toolbar, locbar, statusbar, scrollable, resizable);
	
}

///////////////////////////////////////////////////////////////////////
// FUNCTION: winResize
// Resizes the window to the width and height specified.
// If 'drawToCenter' is TRUE, the window is centered on the current display.
///////////////////////////////////////////////////////////////////////
function winResize(w, h, drawToCenter) {

	window.resizeTo(w, h);

	if (drawToCenter) {
		var xPos = screen.width/2 - w/2;
		var yPos = screen.height/2 - h/2;
		winMove(xPos,yPos);
	}

}
///////////////////////////////////////////////////////////////////////
// FUNCTION: winMove
// Moves the window to the x and y coordinates specified
///////////////////////////////////////////////////////////////////////
function winMove(x,y) {
	window.moveTo(x,y);
}

///////////////////////////////////////////////////////////////////////
// FUNCTION: winNoFrames
// Prevents the window from being embedded inside a frameset.
// Call this function on the window.onLoad event.
///////////////////////////////////////////////////////////////////////
function winNoFrames() {
    if (window != top)
		top.location.href = location.href;
}

/////////////////////////////////////////////////////////////////////
// FUNCTION: winStatus
// Sets the text of the status bar to the specified string
/////////////////////////////////////////////////////////////////////
function winStatus(str) {
	window.status = str;
	return true;
}

/////////////////////////////////////////////////////////////////////
// FUNCTION: showHelp
// Displays the specified help page in a popup window
/////////////////////////////////////////////////////////////////////
function showHelp(url){
	if(!url.length){ return; }
	displayWinOpen(url, "helpWin", 400, 500)
}

/////////////////////////////////////////////////////////////////////
// FUNCTION: showHelp
// Displays the specified help page in a popup window
/////////////////////////////////////////////////////////////////////
function showPromo(url){
	if(!url.length){ return; }
	displayWinOpen(url, "promoWin", 400, 350)
}

//-->
