var titulopordefecto = "Popup";
var ventana;
var cont=0;
var x=screen.width/2;
var y=screen.height/2;

function abrirPopupImagen(cual,titulo){
	var altur = 250;
	var anchur = 400;
	if(cont==1){ventana.close();ventana=null}
	if(titulo==null){titulo=titulopordefecto}
	ventana=window.open('','ventana','position: absolute,toolbar=no,width='+anchur+',height='+altur+',top='+(y-altur/2)+',left='+(x-anchur/2))
//	alert('paro');
	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 redimensionar(ancho, alto){
	ventana.resizeTo(ancho+6,alto+50);
	ventana.moveTo((screen.width-ancho)/2,(screen.height-alto)/2); //centra la ventana. Eliminar si no se quiere centrar el popup
	ventana.focus();
}

function abrirPopupTexto(Url,Ancho,Alto,picTitle){
	var x=screen.width/2
	var y=screen.height/2
	var x1= Ancho
	var y1= Alto
	var Dress = Url
	var titulo = picTitle
	var params="'position: absolute, scrollbars=yes, top=" + (y-y1/2) + ", left=" + (x-x1/2) + ", height=" + y1 + ", width=" + x1 + "'"
	MM_openBrWindow(Dress,titulo,params)
}

function MM_openBrWindow(theURL,winName,features) {
  ventanita = window.open(theURL,winName,features);

}
