// open a popup window - width and height are given as seperate parameters
// so that a centred position can be determined (if required)
function openWin(winURL,winName,winAttributes,winWidth,winHeight,isCentred){
	if(window.screen && isCentred){ // check for boolean attribute to centre the window
		var winLeft = (screen.width-winWidth)/2; // window left
		var winTop = (screen.height-winHeight)/2; // window top
		winAttributes += winAttributes.length ? "," : "";
		winAttributes += "left=" + winLeft + ",top=" + winTop; // append to attributes string
	}
	winAttributes += winAttributes.length ? "," : "";
	winAttributes += "width=" + winWidth + ",height=" + winHeight; // append width and height to attributes string
	winToOpen = window.open(winURL,winName,winAttributes); // define window
	if(window.focus){ // focus window if supported
		winToOpen.focus();
	}
}