function openfoto(param) {
url = '' + param;
okno = window.open(url, "", "toolbar=0,location=0,resizable=1,directories=0,status=0,menubar=0, scrollbars=0,width=50,height=50");
okno.document.write('<html><head><title>Foto</title>');
okno.document.write('<SCRIPT LANGUAGE="JavaScript">');
okno.document.write(' function resize() {');
okno.document.write(' var i = 0; ');
okno.document.write(" if (navigator.appName == 'Netscape') i=40;");
okno.document.write(' if (document.images[0]) { ');
okno.document.write(' window.resizeTo(document.images[0].width+10, document.images[0].height+40-i)');
okno.document.write(' }');
okno.document.write(' }');
okno.document.write(" </SCRIPT>");
okno.document.write("</head>");
okno.document.write('<body bgcolor="#FFFFFF" leftMargin="0" topMargin="0" marginheight="0" marginwidth="0"><IMG src="'+param+'" mce_src="'+param+'" onLoad="resize()"></body></html>');
okno.focus();
}
<td><a href="javascript:openfoto('images/galeria/p_001.jpg')" class="imgCompLink"><img src="images/galeria/small/p_001.jpg" border="0" width="150" height="120"></a></td>