var windowX = 0;
var windowY = 0;

function popup(pic)
{
	var left = (screen.width/2)-200;
	var top = (screen.height/2)-150;
	popupWindow = window.open('/html/popup.php?picture=' + pic + '','popup','width=400,height=300,left=' + left + ',top=' + top + ',toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No');
	popupWindow.focus();
}

function trigger()
{
	pic = document.images[0];
	windowX = (pic.width)+40;
	windowY = (pic.height)+90;
	window.resizeTo(windowX,windowY);
	var left = (screen.width/2)-(windowX/2);
	var top = (screen.height/2)-(windowY/2);
	window.moveTo(left,top);
}

function menu()
{
	var menuX = 550;
	var menuY = 800;

	var left = (screen.width-menuX)/2;
	var top = (screen.height-menuY)/2;

	if (!menu.closed && menu.location)
	{
		menu.moveTo(left, top);
		menu.resizeTo(menuX,menuY);
		menu.location.href = '/html/menu.html';
	}
	else
	{
		menu = window.open('/html/menu.html', 'menuPopup','resizable=0,width='+ menuX +',height='+ menuY +',scrollbars=0,top=' + top + ',left=' + left + '');
		if (!menu.opener) menu.opener = self;
		menu.resizeTo(menuX,menuY);
		menu.moveTo(left, top);
	}

	if (window.focus)
	{
		menu.focus();
	}
}