i18n = new I18n();

function ShowCompDlg() {
	// Se almacena información útil
	this.showCompDlg = null;
}

ShowCompDlg.prototype = {
	open: function() {
		// Se almacena una referencia a este objeto para poder acceder luego a él
		var thisDlg = this;
		
		// Se abre el diálogo del mapa
		$.ajax({
			type: "POST",
			url: i18n.linkTo("mngrShowCompDlg.php"),
			data: {op: "showCompDlg"},
			success: function (data) {
				if (data.errorCode) {
					alert(data.errorMessage);
					return;
				}
				
				var showCompDlg = $(data.showCompDlg);
				showCompDlg.appendTo("body");
				
				// Se le da funcionalidad al botón cerrar
				showCompDlg.find("#showComp_cerrar").click(function () { thisDlg.close(); });
				
				// Por último, se almacena la referencia al diálogo
				thisDlg.showCompDlg = showCompDlg;
			},
			dataType: "json",
			async: false
		});
	},
	
	close: function() {
		this.showCompDlg.remove();
	}
};
