function redimensionar(ancho,alto)
{
ventana.resizeTo(ancho+12,alto+38)
ventana.moveTo((screen.width-ancho)/2,(screen.height-alto)/2) //centra la ventana. Eliminar si no se quiere centrar el popup
}


<!-- funcion pop -up imagenes -->
var ventana
var cont=0
var titulopordefecto = "IMAGEN AMPLIADA" 

function afoto(cual,titulo)

{

            if(cont==1){ventana.close();ventana=null}

            if(titulo==null){titulo=titulopordefecto}

            ventana=window.open('','ventana','resizable=yes,scrollbars=no')

            ventana.document.write('<html><head><title>' + titulo + '</title></head><body style="overflow:hidden" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" scroll="no" onUnload="opener.cont=0"><img src="' + cual + '" onLoad="opener.redimensionar(this.width, this.height)">')

            ventana.document.close()

            cont++

}
function ___mostrar_capa(nombreCapa, numero_capas, nombrePestanya){
	for(i=1;i<numero_capas+1;i++){
		if (document.getElementById('capa'+i) != null)
			document.getElementById('capa'+i).style.display="none";
		if (document.getElementById('p'+i) != null)
			document.getElementById('p'+i).className="";
	}
	document.getElementById(nombreCapa).style.display="inline";
	document.getElementById(nombrePestanya).className='current';
}
	for(i=1;i<=5;i++){
		if (document.getElementById('capa'+i) != null)
			document.getElementById('capa'+i).style.display="none";
		if (document.getElementById('p'+i) != null)
			document.getElementById('p'+i).className="";
	}



function open_cat(versionID) 
{
	toggleBox('cat_'+versionID, 1) // 1 ble, 0 hidden	
	toggleBox('cat_txt_'+versionID, 0) // 1 ble, 0 hidden		
	toggleBox('cat_txt_bold_'+versionID, 1) // 1 ble, 0 hidden
}

function show(dID) 
{
	for(i=1;i<=5;i++)
	{
		toggleBox('content_'+i, 0) // 1 ble, 0 hidden	
	}

	toggleBox('content_'+dID, 1) // 1 ble, 0 hidden	
}

function hide(dID) 
{
	toggleBox('content_'+dID, 0) // 1 ble, 0 hidden	
}

function toggleBox(szDivID, iState) // 1 ble, 0 hidden
{

    if(document.layers)	   //NN4+
    {
		if (document.layers[szDivID] != null)
		{
			document.layers[szDivID].display= iState ? "block" : "none";
		}
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
		if (document.getElementById(szDivID) != null)
		{
			var obj = document.getElementById(szDivID);	
			obj.style.display= iState ? "block" : "none";
		}
    }
    else if(document.all)	// IE 4
    {
    
        if (document.all['content_'+szDivID] != null)
        {
			document.all['content_'+szDivID].style.display= iState ? "block" : "none";
        }
    }
}


function show_text(versionID) 
{
	var campo = document.getElementById('hid_' + versionID);
	var capa = document.getElementById('texto');
	capa.innerHTML = campo.value;
}

function hide_text() 
{
	var capa = document.getElementById('texto');
	capa.innerHTML = '';
}


function baja() 
{

	var texto1 = document.getElementById('email');
	var texto1_ok = document.getElementById('email_ok');
	var texto2 = document.getElementById('pwd');
	var texto2_ok = document.getElementById('pwd_ok');
	var err_msg = document.getElementById('error_msg');
	
	if ((texto1.value != '') &&(texto2.value != ''))
	{
		if ((texto1.value == texto1_ok.value) &&(texto2.value == texto2_ok.value))
		{
		document.location.href = 'inicio.html?event=usr_block_current_user';
		}
		else
		{
			alert(err_msg.value);
		}
	}

}


function recordar() 
{
	var texto1 = document.getElementById('email');
	
	if (texto1.value != '')
	{
		document.location.href = 'recordar_pwd_ok.html?event=usr_remember_password&user_login=' + texto1.value;
	}
}