var ventanaBusqueda = null;
var fotoAux1 = new Image();
function verFoto (urlFoto)
{
	var cont = "<html><head><title>Ver Foto</title></head>\n";
	cont += "<body bgcolor=#F3F3F3><table width=\"100%\" height=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
	cont += "<tr><td align=center><font face=verdana size=1>Cargando imagen...</font></td>\n";
	cont += "</tr></table>\n";
	cont += "</body></html>";
	openWindow ("", "ventanaFoto", 250, 300, "no", "no");
	ventanaBusqueda.document.open();
	ventanaBusqueda.document.write (cont);
	ventanaBusqueda.document.close();
	fotoAux1.onload=loadFoto;
	fotoAux1.src = urlFoto;
}
function loadFoto ()
{
	var w = fotoAux1.width + 10;
	var h = fotoAux1.height + 29;
	if (w > screen.width - 20)
	{
		var w2 = screen.width - 20;
		h = Math.round (h * w2 / w);
		w = w2;
	}
	if (h > screen.height - 60)
	{
		var h2 = screen.height - 60;
		w = Math.round (w * h2 / h);
		h = h2;
	}
	var cont = "<html><head><title>Ver Foto</title></head>\n";
	cont += "<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 onKeyDown=\"window.close();\" onContextMenu=\"return (false);\">\n";
	cont += "<img name=foto border=0 width=" + (w - 10) + " heigth=" + (h - 29) + ">\n";
	cont += "</body></html>";
	ventanaBusqueda.resizeTo (w, h);
	ventanaBusqueda.moveTo (Math.round (screen.width / 2) - Math.round (w / 2), Math.round (screen.height / 2) - Math.round (h / 2));
	ventanaBusqueda.document.open();
	ventanaBusqueda.document.write (cont);
	ventanaBusqueda.document.close();
	ventanaBusqueda.document.images["foto"].src = fotoAux1.src;
}
function abreVentanaModal (win, form, action, target)
{
	win.onLoad = enviaForm (form, action, target);
}
function enviaForm (form, action, target)
{
	form.submit();
	form.action = action;
	form.target = target;
}
function openWindow (url, name, w, h, scrollbars, resizable)
{
	if (ventanaBusqueda && !ventanaBusqueda.closed)
		ventanaBusqueda.close();
	var left = Math.round (screen.width / 2) - Math.round (w / 2);
	var top = Math.round (screen.height / 2) - Math.round (h / 2);
	ventanaBusqueda = window.open (url, name, "top=" + top + ", left=" + left + ", width=" + w + ", height=" + h + ", scrollbars=" + scrollbars + ", resizable=" + resizable);
	//ventanaBusqueda.focus();
}
//funciones de capas:
var isNS4=(document.layers) ? 1 : 0;
var isIE4=((document.all) && !isNS4)? 1 : 0;
var isMoz=((document.getElementById) &&!(isNS4) && !(isIE4)) ? 1 :0;
function get_layer (name)
{
	if(isNS4)
	{
		layer=findLayer(name, document);
		return layer;
	}
	else 
	if (isIE4)
	{
		return document.all[name];
	}
	else
	if (isMoz)
	{
		return document.getElementById(name);
	}
	return null;	
}
function contenido_layer (layer,content)
{
	if(isNS4)
	{
		layer.document.write(content);
		layer.document.close();	
	}
	else if(isIE4||isMoz)
		{
			layer.innerHTML=content;
		}
}