/********************************************************************************************/
/* These window.open functions include a workaround for a problem in Google Chrome whereby  */
/* a second and subsequent write to an existing window does not bring it back to the front. */
/* See http://www.razzed.com/2009/03/16/chrome-problems-window-focus-workaround/            */
/* Problem actually only affects the showXmasMenu function as it's called for the Xmas &    */
/* Xmas Day menus, but I decided to rewrite all the functions in the same way.              */
/********************************************************************************************/

var menuwin = null;
var xmaswin = null;
var winewin = null;
var boardwin = null;

function showMenu(menu) {
	if (navigator.userAgent.indexOf('Chrome/') > 0) {
		if (window.menuwin) {
			window.menuwin.close();
			window.menuwin = null;
		}
	}
	window.menuwin = window.open(menu,
				'menu',
				'width=1000,height=700,scrollbars=1,toolbar=0,titlebar=0,location=0,resizable="no",left=100,top=100,status=0,menubar=0');
	window.menuwin.focus();
}

function showXmasMenu(menu, w, h) {
	if (navigator.userAgent.indexOf('Chrome/') > 0) {
		if (window.xmaswin) {
			window.xmaswin.close();
			window.xmaswin = null;
		}
	}
	window.xmaswin = window.open(menu,
				'xmasmenu',
				'width=' + w + ',height=' + h + ',scrollbars=1,toolbar=0,titlebar=0,location=0,resizable="no",left=300,top=25,status=0,menubar=0');
	window.xmaswin.focus();
}
function showWine(wine) {
	if (navigator.userAgent.indexOf('Chrome/') > 0) {
		if (window.winewin) {
			window.winewin.close();
			window.winewin = null;
		}
	}
	window.winewin = window.open(wine,
				'wine',
				'width=1000,height=700,scrollbars=1,toolbar=0,titlebar=0,location=0,resizable="no",left=200,top=200,status=0,menubar=0'); 
	window.winewin.focus();
}
function showBoard(board) {
	if (navigator.userAgent.indexOf('Chrome/') > 0) {
		if (window.boardwin) {
			window.boardwin.close();
			window.boardwin = null;
		}
	}
	window.boardwin = window.open(board,
			'board',
			'width=1000,height=700,scrollbars=1,toolbar=0,titlebar=0,location=0,resizable="no",left=200,top=200,status=0,menubar=0');
    window.boardwin.focus();
}