//-- author:	Andy Squires
//-- date:		10th September 2002
//-- desc:		Functions to open up various types of windows from a call on a web page.
//						(read function descriptions for more details
//-- note:		Copy PARAMETERS section and any function(s) you need
//						Either add to script section on page or if many windows are required
//						throughout site then add to js file and include 'REL' tag in each page
//------------------------------------------------------------------------------
//------------------- add pop-up window ----------------------------------------
//------------------- DEFINE PARAMETERS ----------------------------------------
// -- work out available screen size
screenH = window.screen.availHeight;
screenW = window.screen.availWidth;
//- set up parameters of pop-up (width, height, position)
winW    = 717; 
winH    = 550;
//-- set up left and top position for window to ensure center of screen
posLeft = (screenW/2) - (winW/2);
posTop  = (screenH/2) - (winH/2);
//-- define the width and height of the users window
fullWinH= screenH;
fullWinW= screenW;
//------------------------------------------------------------------------------
//-- function:	open a page in a sized window and center it in users window
//-- pName:			page name and extension passed to function
//-- winParam:	sets up parameters of window
function openPage(pName){
	winParam = "menubar=0,toolbar=0,resizable=no,scrollbars=yes,toolbar=0,status=0,width=" + winW + ",height=" + winH + ",top=" + posTop + ",left=" + posLeft;
	newWin = window.open(pName,'pageWin',winParam);
	newWin.focus();
	}
//------------------------------------------------------------------------------
//-- function:	open a page as a full screen window with no furniture
//-- pName:			page name and extension passed to function
//-- winParam:	sets up parameters of window
function openFullPage(pName){
	winParam = "menubar=0,toolbar=0,resizable=no,scrollbars=no,toolbar=0,status=0,width=" + fullWinW + ",height=" + fullWinH + ",top=0,left=0";
	newWin = window.open(pName,'siteWin',winParam);
	newWin.focus();
	}	
//------------------------------------------------------------------------------	
//-- function:	- open a page in a sized window with no furniture
//							- writes html to the window to display an image.
//							- amend 'winLayout' to add any other features that are required in the page
//-- sTitle:		title to be displayed in window title bar
//-- imageName:	name / path of image to be displayed in window, including extension
//-- wW:				width of new window	(if no value then default value is taken)
//-- wH:				height of new window	(if no value then default value is taken)
function openDynamicWin(sTitle,imageName,wW,wH){
	//-- if no values passed set width and height to default values
	if(wW == 0){wW = winW;}
	if(wH == 0){wH = winH;}
	//-- set top and left attributes
	posLeft = (screenW/2) - (wW/2);
	posTop  = (screenH/2) - (wH/2);	
	winLayout = "<html><head><title>" + sTitle + "</title><head><body leftmargin=0 topmargin=0><table width=100% height=100% cellpadding=0 cellspacing=0 border=0><tr><td align=center><a href='javascript:self.close()'>close window</a></td></tr><tr><td align=center valign=center><img src='" + imageName + "'></td></tr></table></body>";
	winParam = "menubar=0,toolbar=0,resizable=no,scrollbars=no,toolbar=0,status=0,width=" + wW + ",height=" + wH + ",top=" + posTop +",left= " + posLeft;
	newWin = window.open('','newWin',winParam);
	newWin.document.write(winLayout);
	newWin.focus();
}
//-----------------------------------------------------------------------------
