<!-- // 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();
	
	return newWin;
	
}

///////////////////////////////////////////////////////////////////////
// FUNCTION displayWinOpen
// Draws a window to center-stage with the url and window size specified.
// The window is non-resizable and non-scrollable, with no window controls.
///////////////////////////////////////////////////////////////////////
function displayWinOpen(url, name, width, height){
	var win = winOpen(url, name, width, height, 0, 0, true, false, false, false, false, false, false, false, true);
	return win;
}

///////////////////////////////////////////////////////////////////////
// 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: addFavorites
// Adds the specified page to the favorites
/////////////////////////////////////////////////////////////////////
function addFavorites(url, title) {
   if(document.all){
	 window.external.AddFavorite(url, title);
   } else {
     alert("This feature only works on Internet Explorer 6.0 and higher.");	 
   }
   return false;
}

//-->
