var ipixwin = 0;
var photo = 0;
var menuwin = 0;

function getObj(id)
{
	return document.getElementById(id);
}

function gaussian(id)
{
	linker = getObj(id);
	linker.style.backgroundPosition = '-225px 0px';
}

function sharp(id)
{
	linker = getObj(id);
	linker.style.backgroundPosition = '0px 0px';
}

function popIpix(file)
{
	var left = (screen.width-400)/2;
	var top = (screen.height-400)/2;
	if (!ipixwin.closed && ipixwin.location)
	{
		ipixwin.location.href = '/ipix/popupIpix.php?file=' + file;
	}
	else
	{
		ipixwin=window.open('/ipix/popupIpix.php?file=' + file, 'ipixwinPopup','resizable=no,width=400,height=400,scrollbars=0,top=' + top + ',left=' + left + '');
		if (!ipixwin.opener) ipixwin.opener = self;
	}
	if (window.focus)
	{
		ipixwin.focus();
	}
}

function popup(imageId,x,y)
{
	x = parseInt(x);
	y = parseInt(y);

	photoX = x+30;
	photoY = y+115;

	var left = (screen.width-photoX)/2;
	var top = (screen.height-photoY)/2;
	if (!photo.closed && photo.location)
	{
		photo.resizeTo(photoX,photoY);
		photo.moveTo(left, top);
		//photo.location.href = '/bayBar/popupImage.php?file=' + file + '&desc=' + desc + '&x=' + x + '&y=' + y;
		photo.location.href = '/bayBar/popupImage.php?id=' + imageId;
	}
	else
	{
		photo=window.open('/bayBar/popupImage.php?id=' + imageId, 'photoPopup','resizable=no,width=' + photoX + ',height=' + photoY + ',scrollbars=0,top=' + top + ',left=' + left + '');
		if (!photo.opener) photo.opener = self;
		photo.resizeTo(photoX,photoY);
	}
	if (window.focus)
	{
		photo.focus();
	}
}


function popMenu()
{
	var left = (screen.width-350)/2;
	var top = (screen.height-550)/2;
	if (!menuwin.closed && menuwin.location)
	{
		menuwin.location.href = 'menu.html';
	}
	else
	{
		menuwin=window.open('menu.html', 'menuwinPopup','resizable=no,width=350,height=550,scrollbars=0,top=' + top + ',left=' + left + '');
		if (!menuwin.opener) menuwin.opener = self;
	}
	if (window.focus)
	{
		menuwin.focus();
	}
}

function popMenu2()
{
	var left = (screen.width-550)/2;
	var top = (screen.height-750)/2;
	if (!menuwin.closed && menuwin.location)
	{
		menuwin.location.href = 'menu-2.html';
	}
	else
	{
		menuwin=window.open('menu-2.html', 'menuwinPopup','resizable=yes,width=550,height=750,scrollbars=1,top=' + top + ',left=' + left + '');
		if (!menuwin.opener) menuwin.opener = self;
	}
	if (window.focus)
	{
		menuwin.focus();
	}
}

function popMenu3()
{
	var left = (screen.width-550)/2;
	var top = (screen.height-750)/2;
	if (!menuwin.closed && menuwin.location)
	{
		menuwin.location.href = '/esplanade/menu-3.html';
	}
	else
	{
		menuwin=window.open('/esplanade/menu-3.html', 'menuwinPopup','resizable=yes,width=550,height=750,scrollbars=1,top=' + top + ',left=' + left + '');
		if (!menuwin.opener) menuwin.opener = self;
	}
	if (window.focus)
	{
		menuwin.focus();
	}
}