var NewWin	= null;
var foto	= new Object();
function Foto(img)
{
	if (NewWin)
	{
		NewWin.close();
	}
	foto		= new Image();
	foto.src	= img;
	Control(img);
}
function Control(img)
{
	if ((foto.width != 0) && (foto.height != 0))
	{
		viewFoto(img);
	}
	else
	{
		functie = "Control('"+img+"')";
		interval = setTimeout(functie,20);
	}
}
function viewFoto(img)
{
	var title		= "Fotogallery";
	var width  		= foto.width;
	var height		= foto.height;
	var leftc		= (screen.width/2) - (width/2);
	var topc  		= (screen.height/2) - (height/2);
	NewWin = window.open('about:blank',"Foto","toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1,location=0,width="+width+",height="+height+",left="+leftc+",top="+topc+"");
	NewWin.document.writeln("<html><head><title>"+title+"</title><link href=\"css/main.css\" rel=\"stylesheet\" type=\"text/css\" /></head>");	
	NewWin.document.writeln("<body class=\"popup\"><a href=\"javascript:window.close();\" title=\"Klik om het venster te sluiten\"><img src=\""+img+"\" border=\"0\" alt=\"Klik hier om het venster te sluiten\" /></a></body></html>");	
}
