CapaDescrip = Class.create();

CapaDescrip.prototype = {
	win : null,
	opciones : null,

	initialize : function() {
		this.opciones = Object.extend({
			titol : "",
			ancho : 300,
			alto : 300,
			mostrar : "",
      		onComplete : Prototype.emptyFunction,
      		onCloseWindow : Prototype.emptyFunction
    	}, arguments[0] || {});
	},

	mostrar : function(){
		this.win = new Window('modal_window', {
            className: "dialog",
            title: "<img src='img/shim.gif'>",
            width: this.opciones.ancho,
            height: this.opciones.alto,
            zIndex:150,
            opacity:1,
            minimizable: false,
            maximizable: false,
            resizable: false,
            closable : false,
            draggable : false,
            //showEffect : Effect.BlindDown,
			//hideEffect : Effect.BlindUp,
			keepMultiModalWindow : true
		});

		this.win.setDestroyOnClose();

		var params = {asynchronous:true, evalScripts: true, encoding: 'UTF-8', onComplete : this.completado.bindAsEventListener(this)};
		url = "descripcion.aspx";
		this.win.setAjaxContent(url, params, true, true);
	},

	completado : function(){
		Event.observe($('cerrarDescript'), "click", this.cerrarDescript.bindAsEventListener(this));
		new Ajax.Updater('contenidoDescript', this.opciones.mostrar, {
			onComplete : this.opciones.onComplete,
			method : 'get'
		});
	},

	cerrarDescript : function(){
		this.win.close();
		this.opciones.onCloseWindow();
	}
}