function textfilePopup(textfile, w, h)
{
	var url = "popup.php?text="+textfile;
	var newwin = window.open(url,'popup','width='+w+',height='+h+',top='+(screen.height-h)/2 +',left='+(screen.width-w)/2+',location=0,directories=0,status=no,menuBar=no,scrollBars=yes,resizable=yes');
	if (newwin != null)
		newwin.focus();	
}

function max(a, b)
{
	if (a > b)
		return a;
	else
		return b;
}

function min(a, b)
{
	if (a < b)
		return a;
	else
		return b;
}

function imagePopup(imagename)
{
	var url = "popup.php?image="+imagename;
	var w = 600;
	var h = 500;
	var newwin = window.open(url,'popup','width='+w+',height='+h+',top='+0 +',left='+(screen.width-w)/2+',location=0,directories=0,status=no,menuBar=no,scrollBars=yes,resizable=yes');
	if (newwin != null)
		newwin.focus();	
}

function copyrightPopup()
{
	textfilePopup("copyright", 550, 450);
}

function inImagePopup()
{
	self.resizeTo(
		max(min(document.bigimage.width+80, 800), 320),
		max(min(document.bigimage.height+200, 600), 240));
}
