/************************************************************************
* IBZSection.js									   FECHA: 12-09-2002 *
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
* PROPOSITO : Define los objetos encargados de soportar la operacion	*
*	 general de los formularios en el Framework.
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
* AUTOR: Mauricio Mendez M.											 *
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
* id = "$Id: IBZSection.js,v 1.3 2009/01/19 16:18:56 GOYA\admingoya Exp $"
************************************************************************/

/*-----------------------------------------------------------------------
* DESCRIPCION:
*	 Construye un objeto de tipo Section en un formulario
* PARAMETROS:
*	 parentForm: Formulario al cual pertenece
*	 xmlDocument: Documento XML que define el campo
* RESULTADO:
*	 Construye un nuevo objeto
* PRE:
* POST:
* OJO: 
*-------------------------------------------------------------------- */
function Section( parentForm, xmlDocument )
{
	/********************************************************
			Declaracion de atributos del objeto				*
	*********************************************************/

	this.parentForm = parentForm;
	this.widget = null;
	this.XMLDocument = xmlDocument;
	this.sectionId = new String();
	this.security = new String();
	this.title = new String();
	this.visible = new String();
	this.collapsed = new String();
	this.collapsible = new String();
	this.style = new String();

	/********************************************************
	*		Declaracion de metodos del objeto				*
	********************************************************/

	//Metodos cargue general de atributos y cambio de estado
	this.LoadProperties = IBZForm_LoadProperties;
	this.ChangeState = IBZForm_ChangeStateAll;
	this.Update = IBZForm_Update;
	//Metodos cambio de estado
	this.Enable = IBZSection_Enable;
	this.Disable = IBZSection_Disable;
	this.Hide = IBZSection_Hide;
	this.Show = IBZSection_Show;
	this.SetStyle = IBZSection_SetStyle;

	/********************************************************
	*		Inicializacion del objeto						*
	*********************************************************/

	//Cargue de propiedades
	this.LoadProperties();
	//Cargue de objeto HTML
	this.widget = document.getElementById( this.sectionId );

	if( this.widget == null ) {
		// El campo no tiene un objeto correspondiente en la interfaz Html 
		alert( "La seccion " + this.sectionId + " no tiene un objeto correspondiente en la interfaz Html" );
	}
	else
	{
		this.ChangeState();

		//Se adiciona la seccion a las estructuras de datos de control de secciones
		parentForm.sectionArray[ parentForm.sectionArray.length ] = this;
		parentForm.sectionAssocArray[ this.sectionId ] = this;
	}

}

/*-----------------------------------------------------------------------
* DESCRIPCION:
*	 Desactiva la edición del campo, impidiendo que sea modificado por
*	 el usuario desde la interfaz
* PARAMETROS:
*	 None
* RESULTADO:
*	 None
* PRE:
* POST:
* OJO: 
*-------------------------------------------------------------------- */
function IBZSection_Enable()
{
	this.widget.disabled = false;
}

/*-----------------------------------------------------------------------
* DESCRIPCION:
*	 Desactiva la edición del campo, impidiendo que sea modificado por
*	 el usuario desde la interfaz
* PARAMETROS:
*	 None
* RESULTADO:
*	 None
* PRE:
* POST:
* OJO: 
*-------------------------------------------------------------------- */
function IBZSection_Disable()
{
	this.widget.disabled = true;
}

/*-----------------------------------------------------------------------
* DESCRIPCION:
*	 Desactiva la edición del campo, impidiendo que sea modificado por
*	 el usuario desde la interfaz
* PARAMETROS:
*	 None
* RESULTADO:
*	 None
* PRE:
* POST:
* OJO: 
*-------------------------------------------------------------------- */
function IBZSection_Hide()
{
	this.widget.style.display = "none";
}

/*-----------------------------------------------------------------------
* DESCRIPCION:
*	 Desactiva la edición del campo, impidiendo que sea modificado por
*	 el usuario desde la interfaz
* PARAMETROS:
*	 None
* RESULTADO:
*	 None
* PRE:
* POST:
* OJO: 
*-------------------------------------------------------------------- */
function IBZSection_Show()
{
	this.widget.style.display = "";
}

/*-----------------------------------------------------------------------
* DESCRIPCION:
*	 Desactiva la edición del campo, impidiendo que sea modificado por
*	 el usuario desde la interfaz
* PARAMETROS:
*	 None
* RESULTADO:
*	 None
* PRE:
* POST:
* OJO: 
*-------------------------------------------------------------------- */
function IBZSection_SetStyle()
{
	this.widget.className = this.style;
}


