var ventanaPopup = null;
function showPopWin(url, titulo, ancho, alto, returnFunc) {
    if (window.showModalDialog) { // para Internet Explorer

	Xpos=(screen.width/2)-ancho
	Ypos=(screen.height/2)-alto	        

        var cadenaparametros = "dialogTop=Ypos; dialogLeft=Xpos; dialogWidth=" + ancho +"px;" +
	"dialogHeight=" + alto +"px; center=yes; help=no; maximize=no; minimize=no; " +
	"resizable=no; status=no; scroll=no"
	
        objNewWindow = window.showModalDialog(url, "llll", cadenaparametros)


    } else { // para otro navegador
        var parametros = "width=" + ancho + ",height=" + alto;
        ventanaPopup = window.open(url, "_blank", cadenaparametros);
    }
}

function controlPopup() {
    if (ventanaPopup == null) {
        return;
    } else if (!ventanaPopup.closed) {
        ventanaPopup.focus();
    }
}
window.onfocus = controlPopup;