/******************************************************************************************************************************/
/* These window.open functions include a workaround for a problem in Google Chrome whereby a second and subsequent write to   */
/* 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;
var flyerwin = 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=900,height=700,top=50,left=50,scrollbars=1,toolbar=0,titlebar=0,location=0,resizable="no",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+',top=70,left=70,scrollbars=1,toolbar=0,titlebar=0,location=0,resizable="no",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,top=90,left=90,scrollbars=1,toolbar=0,titlebar=0,location=0,resizable="no",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,top=200,left=100,scrollbars=1,toolbar=0,titlebar=0,location=0,resizable="no",status=0,menubar=0');
    window.boardwin.focus();
}

function showFlyer(flyer) {
	if (navigator.userAgent.indexOf('Chrome/') > 0) {
		if (window.flyerwin) {
			window.flyerwin.close();
			window.flyerwin = null;
		}
	}
	window.flyerwin = window.open(flyer,
			'flyer',
			'width=750,height=750,top=100,left=200,scrollbars=1,toolbar=0,titlebar=0,location=0,resizable="no",status=0,menubar=0');
    window.flyerwin.focus();
}

function showElvis(elvis) {
	if (navigator.userAgent.indexOf('Chrome/') > 0) {
		if (window.elviswin) {
			window.elviswin.close();
			window.elviswin = null;
		}
	}
	window.elviswin = window.open(elvis,
			'elvis',
			'width=500,height=750,top=100,left=200,scrollbars=1,toolbar=0,titlebar=0,location=0,resizable="no",status=0,menubar=0');
    window.elviswin.focus();
}
