
	var KEY_ENTER = 13;
	var KEY_SPACE = 32;
	var KEY_TAB = 9;
	var KEY_CURSOR_UP = 38;
	var KEY_CURSOR_DOWN = 40;

	/****************************************************/
	// CAMPOS										  	//
	/****************************************************/

	function initFieldsChanged(aFields){
		for (var i = 0; i < aFields.length; i++){
			if(aFields[i].setChanged != null) aFields[i].setChanged(false);
		}
	}

	function checkFieldsChanged(aFields){
		for (var i = 0; i < aFields.length; i++){
			if(aFields[i].isChanged != null && aFields[i].isChanged())
				return confirm(getMessage("msg15"));
		}
		return false;
	}

	function initFields(aFields){
		for (var i = 0; i < aFields.length; i++){
			if(aFields[i].init != null) aFields[i].init();
		}
	}

	function initFieldsHash(aFields){
		for (var i in aFields){
			if(aFields[i].init != null) aFields[i].init();
		}
	}
	
	function checkFields(aFields){
		for (var i = 0; i < aFields.length; i++){
			if (aFields[i].checkMandatory != null && !aFields[i].checkMandatory()){
				alert(getMessage("msg02"));
				if (aFields[i].getObj != null) aFields[i].getObj().focus();
				// Si es un multidioma
				else if (aFields[i].fields != null)
					for (var j = 0; j < aFields[i].fields.length; j++){
						if (!aFields[i].fields[j].checkMandatory())
							if (aFields[i].fields[j].getObj != null) aFields[i].fields[j].getObj().focus();
					}
				
				return false;
			}

			if (aFields[i].checkMaxLength != null && !aFields[i].checkMaxLength()){
				alert(getMessage("msg14"));
				if(aFields[i].getObj != null) aFields[i].getObj().focus();
				return false;
			}

			if (aFields[i].check != null && !aFields[i].check()){
				alert(getMessage("msg01"));
				if(aFields[i].getObj != null) aFields[i].getObj().focus();
				return false;
			}
		}

		return true;
	}

	function blockFields(aFields){
		for (var i = 0; i < aFields.length; i++){
			if (aFields[i].setReadOnly != null) aFields[i].setReadOnly(true)
		}
	}

	function unblockFields(aFields){
		for (var i = 0; i < aFields.length; i++){
			if (aFields[i].setReadOnly != null) aFields[i].setReadOnly(false)
		}
	}
	
	function Translate (value, type) {
		this.TEXT = 0;
		this.IMG = 1;
		this.value = value;
		this.type = type;
		this.obj = null;
		if (this.type == this.TEXT) {
			this.obj = document.createElement("span");
			this.obj.innerHTML = this.value;
		} else if (this.type == this.IMG) {
			if (this.value != null) {
				this.obj = document.createElement("img");
				this.obj.src = this.value;
			} else {
				this.obj = document.createElement("div");
			}
		}
	}
	Translate.prototype.getObj = function() {return this.obj;}
	Translate.prototype.cloneNode = function() {
		var trans = new Translate(this.value, this.type);
		return trans;
	}

	function Translates() {
		this.translates = new Array();
	}
	Translates.prototype.put = function(key, translate) {
		this.translates[key] = translate;
	}
	Translates.prototype.get = function(key) {
		if(this.translates[key] == null) return "";
	    else return this.translates[key].getObj();
	}
	Translates.prototype.cloneNode = function() {
		var trans = new Translates();
		for(var i in this.translates){
			trans.put(i, this.translates[i].cloneNode());
		}
		return trans;
	}

	
	/*************************************/
	//		CLASE FIELD (SuperClass)	 //
	/*************************************/
   	function Field(resXPath, number){

		this.field = true;

		this.resXPath = resXPath;
		this.reqXPath = resXPath;
		this.readOnly = false;
		this.mandatory = false;
		this.maxLength = null;
		this.changed = false;
		this.number = (number != null) ? number : false;

		this.objParent = null;
		this.obj = null;
		this.objRight = null;
		this.objMandatory = null;
	}
	Field.prototype.getObj = function(){return this.obj;}
	Field.prototype.getValue = function(){return this.obj.value;}
	Field.prototype.getResXpath = function(){return this.resXPath;}
	Field.prototype.getReqXpath = function(){return this.reqXPath;}
	Field.prototype.isReadOnly = function(){return this.readOnly;}
	Field.prototype.isMandatory = function(){return this.mandatory;}
	Field.prototype.isEmpty = function(){return isEmpty(this.obj.value);}
	Field.prototype.init = function(){this.obj.value = "";}
	Field.prototype.setValue = function(value){this.obj.value = value; this.changed = true;}
	Field.prototype.setValueXML = function(xmlDoc){this.setValue(getNodeValue(xmlDoc, this.resXPath));}
	Field.prototype.addToXML = function(field, reqXMLDoc){addToXML(field, reqXMLDoc);}
	Field.prototype.setResXpath = function(resXPath){this.resXPath = resXPath;}
	Field.prototype.setReqXpath = function(reqXPath){this.reqXPath = reqXPath;}
	Field.prototype.setChanged = function(changed){this.changed = changed;}
	Field.prototype.setWidth = function(width){if (width != null) this.obj.style.width = width + "px";}
	Field.prototype.setWidthPercent = function(width){if (width != null) this.obj.style.width = width + "%";}
	Field.prototype.isChanged = function(){return this.changed;}
	Field.prototype.refreshStyle = function(isFocus){
		var cName = (this.readOnly? "fieldro" : ((isFocus)? "fieldf" : "field")) + (this.number? "n":"");
		this.obj.className = cName;

		this.objMandatory.style.visibility = (this.mandatory? "" : "hidden");
	}
	Field.prototype.setReadOnly = function(readOnly){
		this.readOnly = readOnly;
		this.obj.readOnly = readOnly;
		this.refreshStyle(false);
	}
	Field.prototype.setMandatory = function(mandatory){
		this.mandatory = mandatory
		this.refreshStyle(false);
	}
	Field.prototype.hide = function(){this.setDisplay(false);}
	Field.prototype.show = function(){this.setDisplay(true);}
	Field.prototype.setDisplay = function(display){
		this.objParent.style.display = (display? "" : "none");
	}
	Field.prototype.setMaxLength = function(maxLength){
		this.maxLength = maxLength;
		this.obj.maxLength = maxLength;
	}
	Field.prototype.checkMaxLength = function(){
		return !(this.maxLength != null && this.getValue().length > this.maxLength);
	}
	Field.prototype.checkMandatory = function(){
		return !((this.mandatory) && (this.obj.value == "" || this.obj.value == null || (this.obj.value != null && this.obj.value.replace(/ /g,"") == "")));
	}
	Field.prototype.fieldFocus = function(){this.refreshStyle(true);}
	Field.prototype.fieldBlur = function(){this.refreshStyle(false);}
	Field.prototype.setObjRight = function(obj){
		if (this.objRight == null) insertAfter(obj, this.obj);
		this.objRight = obj;
		this.objRight.style.marginLeft = "2px";
	}
	Field.prototype.getObjRight = function(){return this.objRight;}
	Field.prototype.setTarget = function(target){if (target != null) target.appendChild(this.objParent);}
	Field.prototype.addEvent = function(eventName, action){addEvent(this.obj, eventName, action);}
	Field.prototype.create = function(target, isSelect, isMultiple, isPassword, isTextarea){

		isSelect = (isSelect != null) ? isSelect : false;
		isMultiple = (isMultiple != null) ? isMultiple : false;
		isPassword = (isPassword != null) ? isPassword : false;
		isTextarea = (isTextarea != null) ? isTextarea : false;

		this.objParent = document.createElement("div");
		this.objParent.style.whiteSpace = "nowrap";

		if (isTextarea) {
			var spanSize = document.createElement("span");
			if (target != null)
				spanSize.setAttribute("id", "sizeTextArea" + target.id);
			spanSize.innerHTML = "&nbsp;&nbsp;<br/>";
			spanSize.style.display = "none";
			this.objParent.appendChild(spanSize);
		}
		
		var span = document.createElement("span");
		span.className = "mandatory";
		span.innerHTML = "*";
		this.objMandatory = span;
		this.objParent.appendChild(span);

		if (isSelect) {
			this.obj = document.createElement("select");
			if (isMultiple) this.obj.multiple = "multiple";
		} else if (isTextarea) {
			this.obj = document.createElement("textarea");
		} else {
			if (isIE && isPassword) {
				this.obj = document.createElement("<input type=\"password\" />");
			} else {
				this.obj = document.createElement("input");
				if (isPassword) this.obj.type = "password";
			}
		}

		this.objParent.appendChild(this.obj);
		this.obj.field = this;

		addEvent(this.obj, "onblur", "this.field.fieldBlur();");
		addEvent(this.obj, "onfocus", "this.field.fieldFocus();");
		addEvent(this.obj, "onchange", "this.field.setChanged(true);");

		this.setWidth(150);
		this.refreshStyle(false);
		this.setTarget(target);
	}
	Field.prototype.cloneNode = function(target){

		var field = new Field(this.resXPath, this.number);
		field.readOnly = this.readOnly;
		field.mandatory = this.mandatory;
		field.maxLength = this.maxLength;
		field.changed = this.changed;
		field.reqXPath = this.reqXPath;

		field.objParent = this.objParent.cloneNode(false);

		field.objMandatory = this.objMandatory.cloneNode(true);
		field.objParent.appendChild(field.objMandatory);

		field.obj = this.obj.cloneNode(true);
		field.obj.field = field;
		field.objParent.appendChild(field.obj);

		if (this.objRight != null) {
			field.objRight = this.objRight.cloneNode(true);
			field.objParent.appendChild(field.objRight);
		}

		field.setTarget(target);

		return field;
	}


	/*************************************/
	//		CLASE FCONTENT				 //
	/*************************************/
   	function FContent(target, resXPath, contentType, align){
   		this.type = "FCONTENT";
		this.separator = null;
		this.contentType = null;
		this.resXPath = null;
		this.currency = getUserConfig().getCurrency();
		this.formatDate = getUserConfig().getFormatDate();

		this.typeCurrency = "C";
		this.typeNumber = "N";
		this.typePercent = "P";
		this.typeDate = "D";
		this.typeImage = "I";

		this.translates = null;

		this.obj = null;
		this.align = null;
		this.maxLength = null;
		this.value = "";

		this.create(target);
		if (resXPath != null) 		this.setResXpath(resXPath);
		if (contentType != null) 	this.setContentType(contentType);
		if (align != null)			this.setAlign(align);
	}
	FContent.prototype.getType = function(){return this.type;}
	FContent.prototype.setTranslates = function(translates){this.translates = translates;}
	FContent.prototype.addEvent = function(eventName, action){addEvent(this.obj, eventName, action);}
	FContent.prototype.getObj = function(){return this.obj;}
	FContent.prototype.getResXpath = function(){return this.resXPath;}
	FContent.prototype.setResXpath = function(resXPath){this.resXPath = resXPath;}
	FContent.prototype.init = function(){this.obj.innerHTML = "&nbsp;";}
	FContent.prototype.isEmpty = function(){return ((this.getValue() == "&nbsp;") || (this.getValue() == ""));}
	FContent.prototype.setCurrency = function(currency){this.currency = currency; if (this.contentType == this.typeCurrency && this.value != null) this.obj.innerHTML = this.value +" "+ getCurrencySymbol(this.currency);}
	FContent.prototype.setValueXML = function(xmlDoc){this.setValue(getNodeValue(xmlDoc, this.resXPath, this.separator));}
	FContent.prototype.setValue = function(pvalue){
		var text = "";
		this.value = pvalue;
		var value;
		if (this.contentType == this.typeImage && pvalue != "") {
			value = "<img src=" + pvalue + ">";
		}
		else value = pvalue;
		if (this.contentType == this.typeCurrency) text = " " + getCurrencySymbol(this.currency);
		else if (this.contentType == this.typePercent) text = " %";
		else if (this.contentType == this.typeDate && value != "") {
			if (this.formatDate == "ESP") value = parseInt(value.substr(0, 2), 10) + " " + getMessage("mes" + value.substr(3, 2)) + " " + value.substr(6);
			else if (this.formatDate == "ENG") value = getMessage("mes" + value.substr(0, 2)) + " " + parseInt(value.substr(3, 2), 10) + " " + value.substr(6);
		}
		if (this.align != null) this.obj.align = this.align;
		else if (this.contentType == this.typeDate || this.contentType == this.typeImage) this.obj.align = "center";
		else if (this.contentType == this.typeCurrency || this.contentType == this.typePercent || this.contentType == this.typeNumber) this.obj.align = "right";
		if (this.translates != null && value != "") {
			if (this.translates.get(value) != null && this.translates.get(value) != ""){
				this.obj.appendChild(this.translates.get(value))
			}
		} else {
			this.obj.innerHTML = value + text;
		}
	}
	FContent.prototype.getValue = function(){return this.obj.innerHTML;}
	FContent.prototype.setTitle = function(title){ if(this.obj != null) this.obj.title = title;}
	FContent.prototype.getTitle = function(){ if(this.obj != null) return this.obj.title;}
	FContent.prototype.setSeparator = function(separator){this.separator = separator;}
	FContent.prototype.setContentType = function(type){
		if (type == this.typeCurrency || type == this.typeNumber || type == this.typePercent) {
			this.noWrap();
			this.obj.style.textAlign = "right";
		} else {
			this.obj.style.textAlign = "left";
		}
		this.contentType = type;
	}
	FContent.prototype.getContentType = function(){return this.contentType;}
	FContent.prototype.display = function(display){
		this.obj.style.display = (display? "" : "none");
	}
	FContent.prototype.setAction = function(action){
		this.action = action;
		this.obj.onclick = action;
		this.refreshStyles();
	}
	FContent.prototype.setTarget = function(target){if (target != null) target.appendChild(this.obj)}
	FContent.prototype.noWrap = function(){this.obj.style.whiteSpace = "nowrap";}
	FContent.prototype.refreshStyles = function(mouseover){
		if (mouseover && this.action != null) this.obj.className = "fieldccf";
		else if (this.action != null) this.obj.className = "fieldcc";
		else this.obj.className = "fieldc";
	}
	FContent.prototype.setAlign = function(align){
		this.align = align;
		if (this.obj != null) this.obj.style.textAlign = align;
	}
	FContent.prototype.getAlign = function(){ return this.align; }
	FContent.prototype.setMaxLength = function(maxLength){this.obj.maxLength = maxLength;}
	FContent.prototype.getMaxLength = function(){return this.obj.maxLength;}
	FContent.prototype.getValueAsFloat = function(){
		var fn = new FormatNumber(2);
		return fn.parse(this.getValue());
	}
	FContent.prototype.setValueFromFloat = function(value) {
		var fn = new FormatNumber(2);

		if (isNaN(value)) this.setValue("");
		else this.setValue(fn.getFormattedNumber(value, false, false, false));
	}
	FContent.prototype.create = function(target){
		this.obj = document.createElement("div");
		this.obj.style.display = "inline";
		var fcontent = this;
		this.obj.onmouseover = function () {fcontent.refreshStyles(true);}
		this.obj.onmouseout = function () {fcontent.refreshStyles(false);}
       	this.refreshStyles();
       	this.setContentType(this.contentType);
       	this.setTarget(target);
	}
	FContent.prototype.cloneNode = function(target){
		var fcontent = new FContent(null, this.resXPath);
		fcontent.separator = this.separator;
		fcontent.contentType = this.contentType;
		fcontent.currency = this.currency;
		fcontent.obj = this.obj.cloneNode(true);
		fcontent.obj.onmouseover = function () {fcontent.refreshStyles(true);}
		fcontent.obj.onmouseout = function () {fcontent.refreshStyles(false);}
		fcontent.align = this.align;
		if (this.translates != null) fcontent.translates = this.translates.cloneNode();

		fcontent.setTarget(target);

		return fcontent;

	}


	/*************************************/
	//		CLASE FHIDDEN				 //
	/*************************************/
	function FHidden(resXPath, value){
		this.type = "FHIDDEN";
		this.value = value;
		this.resXPath = resXPath;
		this.reqXPath = resXPath;
		this.changed = false;
	}
	FHidden.prototype.getType = function(){return this.type;}
	FHidden.prototype.getValue = function(){return this.value;}
	FHidden.prototype.getResXpath =	function(){return this.resXPath;}
	FHidden.prototype.getReqXpath =	function(){return this.reqXPath;}
	FHidden.prototype.init = function(){this.value = "";}
	FHidden.prototype.setValue = function(value){this.value = value;}
	FHidden.prototype.setValueXML = function(xmlDoc){this.setValue(getNodeValue(xmlDoc, this.resXPath));}
	FHidden.prototype.addToXML = function(reqXMLDoc){addToXML(this, reqXMLDoc);}
	FHidden.prototype.setResXpath = function(resXPath){this.resXPath = resXPath;}
	FHidden.prototype.setReqXpath =	function(reqXPath){this.reqXPath = reqXPath;}
	FHidden.prototype.checkMandatory = function(){return true;}
	FHidden.prototype.setChanged = function(changed){this.changed = changed;}
	FHidden.prototype.isChanged = function(){return this.changed;}
	FHidden.prototype.isEmpty = function(){return ((this.value == null) || (this.value == ""));}

	/*************************************/
	//		CLASE FTEXT					 //
	/*************************************/
	function FText(target, resXPath, isPassword, type){
		this.type = (type != null)? type : "FTEXT";
		this.base = new Field(resXPath);
		this.base.create(target, false, false, isPassword);

		if(this.type == "FNIF"){
			this.addEvent("onblur", "checkNIF(this, true);");
		} else if(this.type == "FEMAIL"){
			this.addEvent("onblur", "checkEmail(this, true);");
		} else if(this.type == "FACCOUNT"){
			this.setWidth(180)
			this.setMaxLength(34);
			this.addEvent("onblur", "checkAccount(this, true);");
		} else if(this.type == "FCARD"){
			this.addEvent("onblur", "checkCard(this, true);");
		}else if(this.type == "FTIME"){
			this.base.setWidth(35);

			addEvent(this.getObj(), "onchange", "checkTime(this);");
			addEvent(this.getObj(), "onblur", "checkTime(this);");
		}
	}

	FText.prototype.getType = function(){return this.type;}
	FText.prototype.addEvent = function(eventName, action){this.base.addEvent(eventName, action);}
	FText.prototype.getObj = function(){return this.base.getObj();}
	FText.prototype.getValue = function(){return this.base.getValue();}
	FText.prototype.getResXpath = function(){return this.base.getResXpath();}
	FText.prototype.getReqXpath = function(){return this.base.getReqXpath();}
	FText.prototype.isReadOnly = function(){return this.base.isReadOnly();}
	FText.prototype.isMandatory = function(){return this.base.isMandatory();}
	FText.prototype.isEmpty = function(){return this.base.isEmpty();}
	FText.prototype.init = function(){this.base.init();}
	FText.prototype.setValue = function(value){this.base.setValue(value);}
	FText.prototype.setValueXML = function(xmlDoc){this.base.setValueXML(xmlDoc);}
	FText.prototype.addToXML = function(reqXMLDoc){this.base.addToXML(this, reqXMLDoc);}
	FText.prototype.setResXpath = function(resXPath){this.base.setResXpath(resXPath);}
	FText.prototype.setReqXpath = function(reqXPath){this.base.setReqXpath(reqXPath);}
	FText.prototype.setReadOnly = function(readOnly){this.base.setReadOnly(readOnly);}
	FText.prototype.setMandatory = function(mandatory){this.base.setMandatory(mandatory);}
	FText.prototype.setDisplay = function(display){ this.base.setDisplay(display);}
	FText.prototype.checkMandatory = function(){return this.base.checkMandatory();}
	FText.prototype.setMaxLength = function(maxLength){this.base.setMaxLength(maxLength);}
	FText.prototype.checkMaxLength = function(){return this.base.checkMaxLength();}
	FText.prototype.display = function(display){this.base.display(display);}
	FText.prototype.setChanged = function(changed){this.base.setChanged(changed);}
	FText.prototype.isChanged = function(){return this.base.isChanged();}
	FText.prototype.setWidth = function(width){this.base.setWidth(width);}
	FText.prototype.setWidthPercent = function(width){this.base.setWidthPercent(width);}
	FText.prototype.cloneNode = function(target){
		var fText = new FText();
		fText.base = this.base.cloneNode(target);
		return fText;
	}
	FText.prototype.check = function(){
		if(this.type == "FNIF"){
			return checkNIF(this.getObj(), false);
		} else if(this.type == "FEMAIL"){
			return checkEmail(this.getObj(), false);
		} else if(this.type == "FACCOUNT"){
			return checkAccount(this.getObj(), false);
		} else if(this.type == "FCARD"){
			return checkCard(this.getObj(), false);
		}else if(this.type == "FTIME"){
			return checkTime(this.getObj(), false);
		}
		return true;
	}

	/*************************************/
	//		CLASE FCHECKBOX				 //
	/*************************************/
	function FCheckBox(target, text, value, resXPath, action){
		this.type = "FCHECKBOX";
		this.resXPath = resXPath;
		this.reqXPath = resXPath;
		this.text = text;
		this.value = value;
		this.readOnly = false;
		this.changed = false;
		this.action = action;
		this.param = null;

		this.objParent = null;
		this.obj = null;
		this.objText = null;

		this.create(target);
	}
	FCheckBox.prototype.getType = function(){return this.type;}
	FCheckBox.prototype.setValue = function(){this.value = value;}
	FCheckBox.prototype.isExists = function(){return(this.value != null);}
	FCheckBox.prototype.addEvent = function(eventName, action){addEvent(this.obj, eventName, action); addEvent(this.objText, eventName, action);}
	FCheckBox.prototype.getObj = function(){return this.obj;}
	FCheckBox.prototype.setParam = function(param){this.param = param;}
	FCheckBox.prototype.getValue = function(){
		if (!this.isExists()) {
			if(this.isChecked()) return "S"; else return "N";
		} else {
			if(this.isChecked()) return this.value; else return null;
		}
	}
	FCheckBox.prototype.getText = function(){return this.text; }
	FCheckBox.prototype.setText = function(text){this.text = text; if (this.text != null) this.objText.innerHTML = this.text;}
	FCheckBox.prototype.getResXpath = function(){return this.resXPath;}
	FCheckBox.prototype.getReqXpath = function(){return this.reqXPath;}
	FCheckBox.prototype.isReadOnly = function(){return this.readOnly;}
	FCheckBox.prototype.init = function(){this.checked(false);}
	FCheckBox.prototype.checked = function(checked){this.getObj().checked = checked; this.setChanged(true);}
	FCheckBox.prototype.isChecked = function(){return this.getObj().checked;}
	FCheckBox.prototype.setValue = function(value){
		this.getObj().value = value;
		if(!this.isExists()){
			if(value == "S") this.checked(true);
			else this.checked(false);
		}
	}
	FCheckBox.prototype.setValueXML = function(xmlDoc){
		if (!this.isExists()) {
			var value = getNodeValue(xmlDoc, this.resXPath);
			this.setValue(value);
		} else {
			if(selectNodes(xmlDoc, this.resXPath).length > 0) this.checked(true);
			else this.checked(false);
		}
	}
	FCheckBox.prototype.addToXML = function(reqXMLDoc){
		if (!this.isExists()) addToXML(this, reqXMLDoc);
		else if(this.getObj().checked) addToXML(this, reqXMLDoc);
	}
	FCheckBox.prototype.setResXpath = function(resXPath){this.resXPath = resXPath;}
	FCheckBox.prototype.setReqXpath = function(reqXPath){this.reqXPath = reqXPath;}
	FCheckBox.prototype.setReadOnly = function(readOnly){
		this.readOnly = readOnly;
		this.obj.disabled = readOnly;
	}
	FCheckBox.prototype.setDisplay = function(display){
		if(display) this.objParent.style.display = "";
		else this.objParent.style.display = "none";
	}
	FCheckBox.prototype.hide = function(){this.objParent.style.display = "none";}
	FCheckBox.prototype.show = function(){this.objParent.style.display = "";}
	FCheckBox.prototype.setChanged = function(changed){this.changed = changed;}
	FCheckBox.prototype.isChanged = function(){return this.changed;}
	FCheckBox.prototype.setTarget = function(target){
		if (target != null) {
			target.appendChild(this.objParent);
			if (this.text != null && this.text != "") {
				var fcheckbox = this;
				this.objText.onclick = function(){fcheckbox.checked(!fcheckbox.isChecked());};
			}
		}
	}
	FCheckBox.prototype.create = function(target){

		this.objParent = document.createElement("div");
		this.objParent.style.whiteSpace = "nowrap";

		this.obj = document.createElement("input");
		this.obj.type = "checkbox";
		this.obj.field = this;
		this.objParent.appendChild(this.obj);

		this.objText = document.createElement("label");
		this.setText(this.text);
		this.objParent.appendChild(this.objText);

		addEvent(this.obj, "onchange", "this.field.setChanged(true); if (this.field.action != null) this.field.action(this.field.param);");

		this.setTarget(target);
	}
	
	FCheckBox.prototype.cloneNode = function(target){

		var fcheckbox = new FCheckBox(target, this.text, this.value, this.resXPath);
		fcheckbox.reqXPath = this.reqXPath;
		fcheckbox.readOnly = this.readOnly;
		fcheckbox.changed = this.changed;
		fcheckbox.action = this.action;
		fcheckbox.obj.field = fcheckbox;
		fcheckbox.obj.checked = this.isChecked();

		return fcheckbox;
	}

	/*************************************/
	//		CLASE FRADIO				 //
	/*************************************/
	function FRadio(target, value, text, name){
		this.changed = false;
		this.text = text;
		this.create(target, value, name);
	}
	FRadio.prototype.getObj = function(){return this.obj;}
	FRadio.prototype.init = function(){this.obj.checked = false;}
	FRadio.prototype.setValue = function(value){this.obj.value = value;}
	FRadio.prototype.getValue = function(){return this.obj.value;}
	FRadio.prototype.setText = function(text){if (text != null) {this.objText.innerHTML = text; this.text = text;}}
	FRadio.prototype.setName = function(name){this.obj.name = name;}
	FRadio.prototype.setChecked = function(checked){this.obj.checked = checked; this.changed = true;}
	FRadio.prototype.setReadOnly = function(readOnly){this.obj.disabled = readOnly;}
	FRadio.prototype.setChanged = function(changed){this.changed = changed;}
	FRadio.prototype.isChanged = function(){return this.changed;}
	FRadio.prototype.isChecked = function(){return this.obj.checked;}
	FRadio.prototype.setTarget = function(target){
		if (target != null) {
			target.appendChild(this.objParent);
			this.obj.id = "_" + target.id;
			if (this.text != null && this.text != "") this.objText.setAttribute("for", "_" + target.id);
		}
	}
	FRadio.prototype.addEvent = function(eventName, action){addEvent(this.obj, eventName, action);}
	FRadio.prototype.create = function(target, value, name){

		this.objParent = document.createElement("div");
		this.objParent.style.whiteSpace = "nowrap";

		if (isIE) {
			this.obj = document.createElement("<input name=" + name + " />");
		} else {
			this.obj = document.createElement("input");
			this.obj.name = name;
		}

		this.obj.type = "radio";
		this.obj.fradio = this;
		this.objParent.appendChild(this.obj);

		this.objText = document.createElement("label");
		this.objParent.appendChild(this.objText);

		addEvent(this.obj, "onchange", "this.fradio.setChanged(true);");

		this.setValue(value);
		this.setText(this.text);

		this.setTarget(target);
	}

	/*************************************/
	//		CLASE FRADIOS				 //
	/*************************************/
	function FRadios(radios, resXPath){
		this.type = "FRADIO";
		this.radios = radios;
		this.resXPath = resXPath;
		this.reqXPath = resXPath;
		this.mandatory = false;
	}
	FRadios.prototype.getType = function(){return this.type;}
	FRadios.prototype.getValue = function(){
		for(var i in this.radios){if(this.radios[i].isChecked()) return this.radios[i].getValue()};
		return null;
	}
	FRadios.prototype.getResXpath = function(){return this.resXPath;}
	FRadios.prototype.getReqXpath = function(){return this.reqXPath;}
	FRadios.prototype.isMandatory = function(){return this.mandatory;}
	FRadios.prototype.init = function(){for(var i in this.radios){this.radios[i].init();}}
	FRadios.prototype.setValue = function(value){
		for(var i in this.radios){
			if(this.radios[i].getValue() == value){
				this.radios[i].setChecked(true);
				return;
			}
		}
	}
	FRadios.prototype.getText = function(){for(var i in this.radios){
		if(this.radios[i].isChecked()) return this.radios[i].text};
		return null;
	}
	FRadios.prototype.setValueXML = function(xmlDoc){this.setValue(getNodeValue(xmlDoc, this.resXPath));}
	FRadios.prototype.addToXML = function(reqXMLDoc){addToXML(this, reqXMLDoc);}
	FRadios.prototype.setResXpath = function(resXPath){this.resXPath = resXPath;}
	FRadios.prototype.setReqXpath = function(reqXPath){this.reqXPath = reqXPath;}
	FRadios.prototype.setReadOnly = function(readOnly){for(var i in this.radios) this.radios[i].setReadOnly(readOnly);}
	FRadios.prototype.setMandatory = function(mandatory){this.mandatory = mandatory;}
	FRadios.prototype.checkMandatory = function(){
		if(this.mandatory){
			for(var i in this.radios) if(this.radios[i].isChecked()) return true;
			return false;
		} else {
			return true;
		}
	}
	FRadios.prototype.setChanged = function(changed){for(var i in this.radios) this.radios[i].setChanged(changed);}
	FRadios.prototype.isChanged = function(){
		for(var i in this.radios) {
			if(this.radios[i].isChanged()) return true;
		}
		return false;
	}

	/*************************************/
	//		CLASE FDATE					 //
	/*************************************/
	function FDate(target, resXPath){

		this.type = "FDATE";
		this.separator = "/";
		this.base = new Field(resXPath);
		this.formatDate = getUserConfig().getFormatDate();
		
		this.iniDate = null;
		this.endDate = null;
		this.affectBy = null;

		this.weekend = false;
		this.origin = false;

		this.objImg = null;
		this.create(target);
	}
	FDate.prototype.getType = function(){return this.type;}
	FDate.prototype.addEvent = function(eventName, action){this.base.addEvent(eventName, action);}
	FDate.prototype.setAffectBy = function(affectBy){this.affectBy = affectBy;}
	FDate.prototype.getAffectBy = function(){return this.affectBy;}
	FDate.prototype.setIniDate = function(iniDate){this.iniDate = new Date(iniDate.getFullYear(), iniDate.getMonth(), iniDate.getDate());}
	FDate.prototype.getIniDate = function(){return this.iniDate;}
	FDate.prototype.setEndDate = function(endDate){this.endDate = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate());}
	FDate.prototype.getEndDate = function(){return this.endDate;}
	FDate.prototype.getObj = function(){return this.base.getObj();}
	FDate.prototype.getResXpath = function(){return this.base.getResXpath();}
	FDate.prototype.getReqXpath = function(){return this.base.getReqXpath();}
	FDate.prototype.isReadOnly = function(){return this.base.isReadOnly();}
	FDate.prototype.isMandatory = function(){return this.base.isMandatory();}
	FDate.prototype.isEmpty = function(){return this.base.isEmpty();}
	FDate.prototype.init = function(){this.base.init();}
	FDate.prototype.setValue = function(value){this.base.setValue(value);}
	FDate.prototype.setValueXML = function(xmlDoc){this.base.setValueXML(xmlDoc);}
	FDate.prototype.addToXML = function(reqXMLDoc){this.base.addToXML(this, reqXMLDoc);}
	FDate.prototype.setResXpath = function(resXPath){this.base.setResXpath(resXPath);}
	FDate.prototype.setReqXpath = function(reqXPath){this.base.setReqXpath(reqXPath);}
	FDate.prototype.setMandatory = function(mandatory){this.base.setMandatory(mandatory);}
	FDate.prototype.setDisplay = function(display){this.base.setDisplay(display);}
	FDate.prototype.check = function(){
		if (this.iniDate != null && this.iniDate > this.getDate()) return false;
		if (this.endDate != null && this.endDate < this.getDate()) return false;
		return true;
	}
	FDate.prototype.checkMandatory = function(){return this.base.checkMandatory();}
	FDate.prototype.getFormatDate = function(){return this.formatDate;}
	FDate.prototype.setFormatDate =	function(formatDate){this.formatDate = formatDate;}
	FDate.prototype.display = function(display){this.base.display(display);}
	FDate.prototype.getValue = function(){return this.base.getValue();}
	FDate.prototype.getDate = function(){return strToDate(this.getValue());}
	FDate.prototype.setValueFromDate = function(date){this.setValue(dateToStr(date));}
	FDate.prototype.getTime = function(){
		var date = strToDate(this.getValue());
		return (this.base.isEmpty()? 0 : date.getTime()); 
	}
	FDate.prototype.setTime = function(millisec){
		var date = new Date();
		date.setTime(millisec);
		this.setValueFromDate(date);
	}
	FDate.prototype.setToday = function(){this.setValueFromDate(new Date());}
	FDate.prototype.setChanged = function(changed){this.base.setChanged(changed);}
	FDate.prototype.isChanged = function(){return this.base.isChanged();}
	FDate.prototype.setWeekend = function(weekend){this.weekend = weekend;}
	FDate.prototype.isWeekend = function(){return this.weekend;}
	FDate.prototype.setOrigin = function(origin){this.origin = origin;}
	FDate.prototype.isOrigin = function(){return this.origin;}
	FDate.prototype.setReadOnly = function(readOnly){
		this.base.setReadOnly(readOnly);
		if(readOnly) this.objImg.disabled = true;
		else this.objImg.disabled = false;
	}
	FDate.prototype.createCalendar = function(){
		if (isIE) {	// Arreglo bug explorer
			this.objImg = document.createElement("img");
			this.objImg.style.cursor = "pointer";
			this.objImg.setAttribute("align", "middle");
		} else {
			this.objImg = document.createElement("input");
			this.objImg.setAttribute("type", "image");
			this.objImg.setAttribute("align", "top");
		}
		this.objImg.tabIndex = "0";
		this.objImg.field = this;
		this.objImg.setAttribute("src", getResources() + "/images/buttons/btnCalendar.gif");
		addEvent(this.objImg, "onclick", "showCalendar(this);");
		this.objImg.onkeypress = function(e){if (getKeyCode(getEvent(e)) == KEY_ENTER) showCalendar(this);};

		return this.objImg;
	}
	FDate.prototype.create = function(target){
		this.base.create(target);
		this.base.setObjRight(this.createCalendar());

		addEvent(this.getObj(), "onchange", "checkDate(this, '" + this.formatDate + "');");

		this.base.setWidth(65);
		this.base.setMaxLength(10);
		if(getUserConfig().getFormatDate() == "ESP")
			this.getObj().setAttribute("title", "dd/mm/yyyy");
		else
			this.getObj().setAttribute("title", "mm/dd/yyyy");
	}
	FDate.prototype.cloneNode = function(target){
		var fdate = new FDate();
		fdate.base = this.base.cloneNode(target);
		fdate.formatDate = this.formatDate;
		fdate.iniDate = (this.iniDate != null) ? new Date(this.iniDate.getFullYear(), this.iniDate.getMonth(), this.iniDate.getDate()) : null;
		fdate.endDate = (this.endDate != null) ? new Date(this.endDate.getFullYear(), this.endDate.getMonth(), this.endDate.getDate()) : null;
		fdate.affectBy = this.affectBy;
		fdate.objImg = fdate.base.getObjRight();
		fdate.objImg.field = fdate;

		return fdate;
	}

	/*************************************/
	//		CLASE FINTEGER				 //
	/*************************************/
	function FInteger(target, resXPath){
		this.type = "FINTEGER";
		this.base = new Field(resXPath, true);
		this.formatNumber = new FormatNumber(0);

		this.create(target);
	}
	FInteger.prototype.getFormatNumber = function(){return this.formatNumber;}
	FInteger.prototype.addEvent = function(eventName, action){this.base.addEvent(eventName, action);}
	FInteger.prototype.getType = function(){return this.type;}
	FInteger.prototype.getObj = function(){return this.base.getObj();}
	FInteger.prototype.getValue = function(){return this.base.getValue();}
	FInteger.prototype.getValueAsInt = function(){return this.formatNumber.parse(this.getValue());}
	FInteger.prototype.setValueFromInt = function(value) {
		if (isNaN(value)) this.setValue("");
		else this.setValue(this.formatNumber.getFormattedNumber(value, false, false, false));
	}
	FInteger.prototype.getResXpath = function(){return this.base.getResXpath();}
	FInteger.prototype.getReqXpath = function(){return this.base.getReqXpath();}
	FInteger.prototype.isReadOnly =	function(){return this.base.isReadOnly();}
	FInteger.prototype.isMandatory = function(){return this.base.isMandatory();}
	FInteger.prototype.isEmpty = function(){return this.base.isEmpty();}
	FInteger.prototype.init = function(){this.base.init();}
	FInteger.prototype.setValue = function(value){ this.base.setValue(value);}
	FInteger.prototype.setValueXML = function(xmlDoc){this.base.setValueXML(xmlDoc);}
	FInteger.prototype.addToXML = function(reqXMLDoc){this.base.addToXML(this, reqXMLDoc);}
	FInteger.prototype.setResXpath = function(resXPath){this.base.setResXpath(resXPath);}
	FInteger.prototype.setReqXpath = function(reqXPath){this.base.setReqXpath(reqXPath);}
	FInteger.prototype.setReadOnly = function(readOnly){this.base.setReadOnly(readOnly);}
	FInteger.prototype.setMandatory = function(mandatory){this.base.setMandatory(mandatory);}
	FInteger.prototype.setDisplay = function(display){this.base.setDisplay(display);}
	FInteger.prototype.check = function(){return this.formatNumber.check(this.getValue());}
	FInteger.prototype.checkMandatory = function(){return this.base.checkMandatory(); }
	FInteger.prototype.format = function(){this.setValue(this.formatNumber.format(this.getValue()));}
	FInteger.prototype.setChanged = function(changed){this.base.setChanged(changed);}
	FInteger.prototype.isChanged = function(){return this.base.isChanged();}
	FInteger.prototype.setWidth = function(width){this.base.setWidth(width);}
	FInteger.prototype.setMaxLength = function(maxLength){this.base.setMaxLength(maxLength);}
	FInteger.prototype.create = function(target){
		this.base.create(target);
		this.getObj().finteger = this;
		addEvent(this.getObj(), "onblur", "this.finteger.format();");
	}
	FInteger.prototype.cloneNode = function(target){
		var finteger = new FInteger();
		finteger.base = this.base.cloneNode(target);
		finteger.getObj().finteger = finteger;
		finteger.formatNumber = this.formatNumber.cloneNode();
		return finteger;
	}

	/*************************************/
	//		CLASE FDECIMAL				 //
	/*************************************/
	function FDecimal(target, resXPath, decimals){
		this.type = "FDECIMAL";
		this.base = new Field(resXPath, true);
		this.formatNumber = ((decimals == null)? new FormatNumber(2) : new FormatNumber(decimals));

		this.create(target);
	}
	FDecimal.prototype.getFormatNumber = function(){return this.formatNumber;}
	FDecimal.prototype.addEvent = function(eventName, action){this.base.addEvent(eventName, action);}
	FDecimal.prototype.getType = function(){return this.type;}
	FDecimal.prototype.getObj = function(){return this.base.getObj();}
	FDecimal.prototype.getValue = function(){return this.base.getValue();}
	FDecimal.prototype.getValueAsFloat = function(){return this.formatNumber.parse(this.getValue());}
	FDecimal.prototype.setValueFromFloat = function(value) {
		if (isNaN(value)) this.setValue("");
		else this.setValue(this.formatNumber.getFormattedNumber(value, false, false, false));
	}
	FDecimal.prototype.getResXpath = function(){return this.base.getResXpath();}
	FDecimal.prototype.getReqXpath = function(){return this.base.getReqXpath();}
	FDecimal.prototype.isReadOnly =	function(){return this.base.isReadOnly();}
	FDecimal.prototype.isMandatory = function(){return this.base.isMandatory();}
	FDecimal.prototype.isEmpty = function(){return this.base.isEmpty();}
	FDecimal.prototype.init = function(){this.base.init();}
	FDecimal.prototype.setValue = function(value){this.base.setValue(value);}
	FDecimal.prototype.setValueXML = function(xmlDoc){this.base.setValueXML(xmlDoc);}
	FDecimal.prototype.addToXML = function(reqXMLDoc){this.base.addToXML(this, reqXMLDoc);}
	FDecimal.prototype.setResXpath = function(resXPath){this.base.setResXpath(resXPath);}
	FDecimal.prototype.setReqXpath = function(reqXPath){this.base.setReqXpath(reqXPath);}
	FDecimal.prototype.setReadOnly = function(readOnly){this.base.setReadOnly(readOnly);}
	FDecimal.prototype.setMandatory = function(mandatory){this.base.setMandatory(mandatory);}
	FDecimal.prototype.setDisplay = function(display){this.base.setDisplay(display);}
	FDecimal.prototype.check = function(){return this.formatNumber.check(this.getValue());}
	FDecimal.prototype.checkMandatory = function(){return this.base.checkMandatory();}
	FDecimal.prototype.format = function(){this.setValue(this.formatNumber.format(this.getValue()));}
	FDecimal.prototype.fillZero = function(){this.setValue(this.formatNumber.fillZero(this.getValue()));}
	FDecimal.prototype.setChanged = function(changed){this.base.setChanged(changed);}
	FDecimal.prototype.isChanged = function(){return this.base.isChanged();}
	FDecimal.prototype.setWidth = function(width){this.base.setWidth(width);}
	FDecimal.prototype.create = function(target){
		this.base.create(target);
		this.getObj().fdecimal = this;
		addEvent(this.getObj(), "onkeyup", "this.fdecimal.format();");
		addEvent(this.getObj(), "onblur", "this.fdecimal.fillZero();");

	}
	FDecimal.prototype.cloneNode = function(target){
		var fdecimal = new FDecimal();
		fdecimal.base = this.base.cloneNode(target);
		fdecimal.getObj().fdecimal = fdecimal;
		fdecimal.formatNumber = this.formatNumber.cloneNode();
		return fdecimal;
	}

	/*************************************/
	//		CLASE FPERCENT				 //
	/*************************************/
	function FPercent(target, resXPath){
		this.type = "FPERCENT";
		this.base = new Field(resXPath, true);
		this.formatNumber = new FormatNumber(2);
		this.formatNumber.setMinValue(0);
		this.formatNumber.setMaxValue(100);
		this.formatNumber.setOnformatRound(true);

		this.create(target);
	}
	FPercent.prototype.getFormatNumber = function(){return this.formatNumber;}
	FPercent.prototype.addEvent = function(eventName, action){this.base.addEvent(eventName, action);}
	FPercent.prototype.getType = function(){return this.type;}
	FPercent.prototype.getObj = function(){return this.base.getObj();}
	FPercent.prototype.getValue = function(){return this.base.getValue();}
	FPercent.prototype.getValueAsFloat = function(){return this.formatNumber.parse(this.getValue());}
	FPercent.prototype.setValueFromFloat = function(value){this.setValue(this.formatNumber.getFormattedNumber(value));}
	FPercent.prototype.getResXpath = function(){return this.base.getResXpath();}
	FPercent.prototype.getReqXpath = function(){return this.base.getReqXpath();}
	FPercent.prototype.isReadOnly =	function(){return this.base.isReadOnly();}
	FPercent.prototype.isMandatory = function(){return this.base.isMandatory();}
	FPercent.prototype.isEmpty = function(){return this.base.isEmpty();}
	FPercent.prototype.init = function(){this.base.init();}
	FPercent.prototype.setValue = function(value){this.base.setValue(value);}
	FPercent.prototype.setValueXML = function(xmlDoc){this.base.setValueXML(xmlDoc);}
	FPercent.prototype.addToXML = function(reqXMLDoc){this.base.addToXML(this, reqXMLDoc);}
	FPercent.prototype.setResXpath = function(resXPath){this.base.setResXpath(resXPath);}
	FPercent.prototype.setReqXpath = function(reqXPath){this.base.setReqXpath(reqXPath);}
	FPercent.prototype.setReadOnly = function(readOnly){this.base.setReadOnly(readOnly);}
	FPercent.prototype.setMandatory = function(mandatory){this.base.setMandatory(mandatory);}
	FPercent.prototype.setDisplay = function(display){this.base.setDisplay(display);}
	FPercent.prototype.check = function(){return this.formatNumber.check(this.getValue());}
	FPercent.prototype.checkMandatory = function(){return this.base.checkMandatory();}
	FPercent.prototype.setWidth = function(width){this.base.setWidth(width);}
	FPercent.prototype.format = function(){this.setValue(this.formatNumber.format(this.getValue()));}
	FPercent.prototype.fillZero = function(){this.setValue(this.formatNumber.fillZero(this.getValue()));}
	FPercent.prototype.setChanged = function(changed){this.base.setChanged(changed);}
	FPercent.prototype.isChanged = function(){return this.base.isChanged();}
	FPercent.prototype.create = function(target){

		this.base.create(target);
		this.base.setWidth(40);

		var objRight = document.createElement("label");
		objRight.innerHTML = " %";
		objRight.className = "symbol";
		this.base.setObjRight(objRight);

		this.getObj().fpercent = this;

		// addEvent(this.getObj(), "onkeyup", "this.fpercent.format();");
		addEvent(this.getObj(), "onblur", "this.fpercent.format(); this.fpercent.fillZero();");
	}
	FPercent.prototype.cloneNode = function(target){
		var fpercent = new FPercent();
		fpercent.base = this.base.cloneNode(target);
		fpercent.getObj().fpercent = fpercent;
		fpercent.formatNumber = this.formatNumber.cloneNode();
		return fpercent;
	}

	/*************************************/
	//		CLASE FCURRENCY				 //
	/*************************************/
	function FCurrency(target, resXPath, negative){
		this.type = "FCURRENCY";
		this.base = new Field(resXPath, true);
		this.currency = getUserConfig().getCurrency();
		this.symbol = null;
		this.formatNumber = new FormatNumber(2);
		if (negative == null || !negative)
			this.formatNumber.setMinValue(0);

		this.create(target);
	}
	FCurrency.prototype.getFormatNumber = function(){return this.formatNumber;}
	FCurrency.prototype.addEvent = function(eventName, action){this.base.addEvent(eventName, action);}
	FCurrency.prototype.getType = function(){return this.type;}
	FCurrency.prototype.getObj = function(){return this.base.getObj();}
	FCurrency.prototype.getValue = function(){return this.base.getValue();}
	FCurrency.prototype.getValueAsFloat = function(){return this.formatNumber.parse(this.getValue());}
	FCurrency.prototype.getResXpath = function(){return this.base.getResXpath();}
	FCurrency.prototype.getReqXpath = function(){return this.base.getReqXpath();}
	FCurrency.prototype.isReadOnly = function(){return this.base.isReadOnly();}
	FCurrency.prototype.isMandatory = function(){return this.base.isMandatory();}
	FCurrency.prototype.isEmpty = function(){return this.base.isEmpty();}
	FCurrency.prototype.init = function(){this.base.init();}
	FCurrency.prototype.setValue = function(value){this.base.setValue(value);}
	FCurrency.prototype.setValueFromFloat = function(value){this.setValue(this.formatNumber.getFormattedNumber(value));}
	FCurrency.prototype.setValueXML = function(xmlDoc){this.base.setValueXML(xmlDoc);}
	FCurrency.prototype.addToXML = function(reqXMLDoc){this.base.addToXML(this, reqXMLDoc);}
	FCurrency.prototype.setResXpath = function(resXPath){this.base.setResXpath(resXPath);}
	FCurrency.prototype.setReqXpath = function(reqXPath){this.base.setReqXpath(reqXPath);}
	FCurrency.prototype.setReadOnly = function(readOnly){this.base.setReadOnly(readOnly);}
	FCurrency.prototype.setMandatory = function(mandatory){this.base.setMandatory(mandatory);}
	FCurrency.prototype.setDisplay = function(display){this.base.setDisplay(display);}
	FCurrency.prototype.check = function(){return this.formatNumber.check(this.getValue());}
	FCurrency.prototype.checkMandatory = function(){return this.base.checkMandatory();}
	FCurrency.prototype.format = function(){this.setValue(this.formatNumber.format(this.getValue()));}
	FCurrency.prototype.fillZero = function(){this.setValue(this.formatNumber.fillZero(this.getValue()));}
	FCurrency.prototype.getSymbol = function(){return this.symbol;}
	FCurrency.prototype.getCurrency = function(){return this.currency;}
	FCurrency.prototype.setCurrency = function(currency){this.currency = currency; this.setSymbol();}
	FCurrency.prototype.setNumDecimals = function(numDecimals){this.formatNumber.setNumberDecimals(numDecimals);}
	FCurrency.prototype.setChanged = function(changed){this.base.setChanged(changed);}
	FCurrency.prototype.isChanged = function(){return this.base.isChanged();}
	FCurrency.prototype.setWidth = function(width){this.base.setWidth(width);}
	FCurrency.prototype.setWidthPercent = function(width){this.base.setWidthPercent(width);}
	FCurrency.prototype.setSymbol = function(){
		this.symbol = getCurrencySymbol(this.currency);
		this.base.getObjRight().innerHTML = " " + this.symbol;
	}
	FCurrency.prototype.create = function(target){
		this.base.create(target);

		var objRight = document.createElement("label");
		objRight.className = "symbol";
		this.base.setObjRight(objRight);
		this.setSymbol();

		this.getObj().fcurrency = this;

		if (this.formatNumber.minValue != null && this.formatNumber.minValue == 0) {
			addEvent(this.getObj(), "onkeyup", "this.fcurrency.format();");
			addEvent(this.getObj(), "onblur", "this.fcurrency.fillZero();");
		}
		
		else {
			addEvent(this.getObj(), "onblur", "this.fcurrency.format();");
			addEvent(this.getObj(), "onblur", "this.fcurrency.fillZero();");
		}
	}
	FCurrency.prototype.cloneNode = function(target){
		var fcurrency = new FCurrency();
		fcurrency.base = this.base.cloneNode(target);
		fcurrency.getObj().fcurrency = fcurrency;
		fcurrency.formatNumber = this.formatNumber.cloneNode();
		fcurrency.symbol = this.symbol;
		fcurrency.currency = this.currency;
		return fcurrency;
	}

	/*************************************/
	//		CLASE FTEXTAREA				 //
	/*************************************/
	var controlAlertCut = 0; //variable global para solucionar problema de concurrencia en firefox 2

	function FTextArea(target, resXPath, alertCut){
		this.type = "FTEXTAREA";
		this.base = new Field(resXPath);
		this.create(target);
		this.cutText = null;
		this.alertCut = alertCut;
		if (target!=null)
			this.labelSize = "sizeTextArea" + target.id;
	}
	FTextArea.prototype.getType = function(){return this.type;}
	FTextArea.prototype.addEvent = function(eventName, action){this.base.addEvent(eventName, action);}
	FTextArea.prototype.getObj = function(){return this.base.getObj();}
	FTextArea.prototype.getValue = function(){return this.base.getValue();}
	FTextArea.prototype.getResXpath = function(){return this.base.getResXpath();}
	FTextArea.prototype.getReqXpath = function(){return this.base.getReqXpath();}
	FTextArea.prototype.isReadOnly = function(){return this.base.isReadOnly();}
	FTextArea.prototype.isMandatory = function(){return this.base.isMandatory();}
	FTextArea.prototype.isEmpty = function(){return this.base.isEmpty();}
	FTextArea.prototype.init = function(){this.base.init();}
	FTextArea.prototype.setValue = function(value){this.base.setValue(value); if (this.base.maxLength != null && this.labelSize != null) document.getElementById(this.labelSize).innerHTML = "&nbsp;&nbsp;<label><b>" + (this.base.maxLength - this.getValue().length) + "</b></label><br/>";}
	FTextArea.prototype.setValueXML = function(xmlDoc){this.base.setValueXML(xmlDoc); if (this.base.maxLength != null && this.labelSize != null) document.getElementById(this.labelSize).innerHTML = "&nbsp;&nbsp;<label><b>" + (this.base.maxLength - this.getValue().length) + "</b></label><br/>";}
	FTextArea.prototype.addToXML = function(reqXMLDoc){this.base.addToXML(this, reqXMLDoc);}
	FTextArea.prototype.setResXpath = function(resXPath){this.base.setResXpath(resXPath);}
	FTextArea.prototype.setReqXpath = function(reqXPath){this.base.setReqXpath(reqXPath);}
	FTextArea.prototype.setReadOnly = function(readOnly){this.base.setReadOnly(readOnly);}
	FTextArea.prototype.setMandatory = function(mandatory){this.base.setMandatory(mandatory);}
	FTextArea.prototype.setDisplay = function(display){this.base.setDisplay(display);}
	FTextArea.prototype.checkMandatory = function(){return this.base.checkMandatory();}
	FTextArea.prototype.setMaxLength = function(maxLength){
		if (this.alertCut == null) this.alertCut = 'N';
		this.base.setMaxLength(maxLength);
		if (this.labelSize != null) {
			document.getElementById(this.labelSize).style.display = "";
			document.getElementById(this.labelSize).innerHTML = "&nbsp;&nbsp;<label style='border: 0px none;'><b>" + (maxLength - this.getValue().length) + "</b></label><br/>";
		}
		addEvent(this.getObj(), "onfocus", "onfocusTextArea(this,'" + this.labelSize + "', '" + this.alertCut + "');");
		addEvent(this.getObj(), "onblur", "para(this);");
	}
	FTextArea.prototype.checkMaxLength = function(){return this.base.checkMaxLength();}
	FTextArea.prototype.display = function(display){this.base.display(display);}
	FTextArea.prototype.setChanged = function(changed){this.base.setChanged(changed);}
	FTextArea.prototype.isChanged = function(){return this.base.isChanged();}
	FTextArea.prototype.setWidth = function(width){this.base.setWidth(width);}
	FTextArea.prototype.setWidthPercent = function(width){this.base.setWidthPercent(width);}
	FTextArea.prototype.setRows = function(filas){this.getObj().rows = filas;}
	FTextArea.prototype.create = function(target){
		this.base.create(target, false, false, false, true);
	}
	FTextArea.prototype.cloneNode = function(target){
		var ftextarea = new FTextArea();
		ftextarea.base = this.base.cloneNode(target);
		return ftextarea;
	}

	// Las 3 siguientes funciones son para controlar el maxlength de los FTextArea
	function onfocusTextArea(input, identLabelSize, alertCut){
		input.cutText = true;
		controlaMaxLengthTextArea(input.field.objParent.parentNode.id, identLabelSize, alertCut);
	}

	function controlaMaxLengthTextArea(ident, identLabelSize, alertCut){
			var td = document.getElementById(ident);
			var input = td.lastChild.lastChild;
			var int_value, out_value;
			if (input.field.getValue().length > input.field.maxLength) {
				if (alertCut == 'S' && controlAlertCut == 0) {
					controlAlertCut = 1;
					alert(getMessage("msg14")+" "+input.field.maxLength);
					input.focus();
				}
				in_value = input.field.getValue();
				out_value = in_value.substring(0,input.field.maxLength);
				input.field.setValue(out_value);
			}
			controlAlertCut = 0;
			
			if(input.cutText) setTimeout("controlaMaxLengthTextArea('"+ident+"','"+identLabelSize+"','"+alertCut+"');",100);

			if (identLabelSize != null)
				document.getElementById(identLabelSize).innerHTML = "&nbsp;&nbsp;<label style='border: 0px none;'><b>" + (input.field.maxLength - input.field.getValue().length) + "</b></label><br/>";
	}

	function para(input){
		input.cutText = false;
	}


	/*************************************/
	//		CLASE FCATEGORY				 //
	/*************************************/
	function FCategory(target, resXPath){
		this.type = "FSTARS";
		this.resXPath = resXPath;
		this.value = null;
		this.create(target);
	}
	FCategory.prototype.getType = function(){return this.type;}
	FCategory.prototype.addEvent = function(eventName, action){addEvent(this.objParent, eventName, action);}
	FCategory.prototype.getObj = function(){return this.objParent;}
	FCategory.prototype.getValue = function(){return this.value;}
	FCategory.prototype.getResXpath = function(){return this.resXPath;}
	FCategory.prototype.init = function(){this.objParent.innerHTML = "";}
	FCategory.prototype.setValue = function(value){
		this.value = value;
		this.init();
		if (this.value != null && this.value != "") for (var i = 0; i < value; i++) this.addStar();
	}
	FCategory.prototype.setValueXML = function(xmlDoc){this.setValue(getNodeValue(xmlDoc, this.resXPath));}
	FCategory.prototype.setResXpath = function(resXPath){this.resXPath = resXPath;}
	FCategory.prototype.addStar = function() {
		this.objParent.innerHTML += "<img src=\"" + getResources() + "/images/dossier/star.gif\" />";
	}
	FCategory.prototype.create = function(target) {
		this.objParent = document.createElement("div");
		this.setTarget(target);
	}
	FCategory.prototype.setTarget = function(target) {if (target != null) target.appendChild(this.objParent);}
	FCategory.prototype.cloneNode = function(target){
		var fcategory = new FCategory(target, this.resXPath);
		fcategory.value = this.value;
		return fcategory;
	}

	//**************************//
	// CLASE FSELECT			//
	//**************************//
	function FSelect(target, lov, resValueXpath, resTextXpath, textBlank){

		this.type = "FSELECT";
		this.value = "";
		this.oldValue = this.value;
		this.deployed = false;
		this.options = new Array();
		this.textSearch = "";
		this.optionsel = null;
		this.mandatory = false;
		this.readonly = false;
		this.firstValue = false;
		this.resTextXpath = resTextXpath;
		this.resXPath = resValueXpath;
		this.reqXPath = resValueXpath;
		this.changed = false;

		this.affectTo = new Array();
		this.affectByParam = new Array();
		this.affectBy = new Array();
		this.paramsAffect = new Params();
		this.affectAlways = true;

		this.lov = lov;
		this.params = new Params();
		this.params.putByName("lov", this.lov);

		this.loaded = false;
		this.textBlank = (textBlank != null) ? textBlank : "&nbsp;";

		this.onLoaded = null;
		this.align = "left";
		this.optionwidth = null;
		this.addHeight = null;
		
		if (target != "OO") this.create(target);
	}
	FSelect.prototype.setFirstValue = function(firstValue){this.firstValue = firstValue;}
	FSelect.prototype.setWidth = function(widthAux){
		this.input.style.width = (widthAux == null) ? "auto" : widthAux + "px";
		this.text.style.width = (widthAux == null) ? "auto" : (widthAux - 15) + "px";
		this.width = widthAux;
	}
	FSelect.prototype.setWidthPercent = function(width){
		/*
		if (this.obj.parentNode != null){

			var w = this.obj.parentNode.offsetWidth;
			if (!isNaN(w) && !isNaN(width)){
				this.setWidth((parseInt(w) * (parseInt(width)/100)))
			}
		}
		*/
	}
	FSelect.prototype.addEvent = function(eventName, action){
		if (eventName == "onchange") {
			var onchg = this.onchange;
			this.onchange = function(){if (onchg != null) onchg(); eval(action);};
		} else {
			addEvent(this.input, eventName, action);
		}
	}
 	FSelect.prototype.getParam = function(name){return this.params.getParamValue(name);}
	FSelect.prototype.setTextBlank = function(textBlank){this.textBlank = textBlank;}
	FSelect.prototype.setOnLoaded = function(onLoaded){this.onLoaded = onLoaded;}
	FSelect.prototype.getObj = function(){return this.input;}
	FSelect.prototype.getType = function getType(){return this.type;}
	FSelect.prototype.init = function(){if (this.options.length > 0) this.setValue(this.options[0].value, this.options[0].innerHTML);  else this.setValue('', this.textBlank); }
	FSelect.prototype.getResXpath = function(){return this.resXPath;}
	FSelect.prototype.getReqXpath = function(){return this.reqXPath;}
	FSelect.prototype.getResTextXpath = function(){return this.resTextXpath;}
	FSelect.prototype.setResTextXpath = function(resTextXpath){this.resTextXpath = resTextXpath;}
	FSelect.prototype.setResXpath = function(resXPath){this.resXPath = resXPath;}
	FSelect.prototype.setReqXpath = function(reqXPath){this.reqXPath = reqXPath;}
	FSelect.prototype.putAffectTo = function(field){this.affectTo.push(field);}
	FSelect.prototype.putAffectBy = function(field, param, always){this.affectBy.push(field);this.affectByParam.push(param); if (always != null) this.affectAlways = always; this.changeAffectBy();}
	FSelect.prototype.addParam = function(name, value){this.params.putByName(name, value);}
	FSelect.prototype.delParam = function(name){this.params.remByName(name);}
	FSelect.prototype.getLov = function(){return this.lov;}
	FSelect.prototype.setLov = function(lov){this.lov = lov; this.params.putByName("lov", this.lov);}
	FSelect.prototype.setLoaded = function(loaded){this.loaded = loaded;}
	FSelect.prototype.isLoaded = function(){return this.loaded;}
	FSelect.prototype.getNumOptions = function(){return ((this.options != null)? this.options.length : 0);}
	FSelect.prototype.createOption = function(value, text){
		var option = document.createElement("div");
		option.className = "seloptnormal";
		option.innerHTML = (text.length == 0) ? "&nbsp;" : text;
		option.value = value;
		var fselect = this;
		option.onmouseover = function(){fselect.optionMouseOver(option);};
		option.onmouseout = function(){fselect.optionMouseOut(option);};
		option.onclick = function(){fselect.selectOption(this); fselect.undeploy(); fselect.input.focus();};
		this.list.appendChild(option);
		this.options.push(option);

		if (option.clientWidth > this.optionwidth) this.optionwidth = option.clientWidth;

		return option;
	}
	FSelect.prototype.optionMouseOver = function(option){if (option != this.optionsel) option.className = "seloptover"; }
	FSelect.prototype.optionMouseOut = function(option){if (option != this.optionsel) option.className = "seloptnormal";}
	FSelect.prototype.changeOptionSel = function(option){
		if (option != null) {
			if (this.optionsel != null) this.optionsel.className = "seloptnormal";
			option.className = "seloptsel";
			this.optionsel = option;
			this.scrollDiv(option);
		}
	}
	FSelect.prototype.selectOption = function(option, checkChange){
		this.changeOptionSel(option);
		this.setValue(option.value, option.innerHTML, checkChange);
	}
	FSelect.prototype.scrollDiv = function(option){this.list.scrollTop = option.offsetTop;}
	FSelect.prototype.onkeydown = function(e, pKeyCode) {
		if (!this.readonly) {
			var keyCode = (pKeyCode != null) ? pKeyCode : getKeyCode(getEvent(e));
			if (!this.loaded && keyCode != KEY_TAB) {
				this.currentKey = keyCode;
				this.clickDeploy();
				return;
			}
			if (keyCode == KEY_CURSOR_DOWN || keyCode == KEY_CURSOR_UP || keyCode == KEY_ENTER || keyCode == KEY_SPACE) {
				for (var j = 0; j < this.options.length; j++) {
					if (this.options[j] == this.optionsel) {
						if (keyCode == KEY_ENTER) {
							this.selectOption(this.options[j]);
							this.undeploy();
							this.input.focus();
							return;
						}
						if (keyCode == KEY_SPACE) {
							this.clickDeploy();
							return;
						}
						var existNP = (keyCode == KEY_CURSOR_UP) ? (j - 1 >= 0) : (j + 1 != this.options.length);
						var np = (keyCode == KEY_CURSOR_UP) ? (j - 1) : (j + 1);
						if (existNP) {
							this.selectOption(this.options[np], true);
							return;
						} else {
							return;
						}
					}
				}
				if (this.options.length > 0) this.selectOption(this.options[0]);
			} else {
				clearTimeout(this.clock2);
				var key = String.fromCharCode(keyCode);
				this.textSearch += key;
				var t1 = this.textSearch.toUpperCase();
				bucle: for (var j = 0; j < this.options.length; j++) {
					var t2 = (t1.length <= this.options[j].innerHTML.length) ? this.options[j].innerHTML.substring(0, t1.length).toUpperCase() : null;
					if (t1 == t2) { this.selectOption(this.options[j], true); break bucle; }
				}
				var fselect = this;
				this.clock2 = setTimeout(function(){fselect.textSearch = ""; clearTimeout(fselect.clock2);}, 1000);
			}
		}
	}
	FSelect.prototype.createBlankOption = function(){if (this.textBlank != null) this.createOption("", this.textBlank);}
	FSelect.prototype.checkOnChange = function(){
		if (this.oldValue != this.value) {
			this.oldValue = this.value;
			this.change();
			this.setChanged(true);
			if (this.onchange != null) this.onchange();
		}
	}
	FSelect.prototype.getValue = function(){return this.value;}
	FSelect.prototype.setValue = function(value, text, checkChange){
		this.value = value;
		var t = null;
		for (var i = 0; i < this.options.length; i++) {
			if (this.options[i].value == value && this.options[i].value.length == value.length){
				t = this.options[i].innerHTML;
			}
		}
		if (t == null) t = text;
		if (t == null) t = value;

		this.setText(t);

		if (checkChange == null) this.checkOnChange();
	}
	FSelect.prototype.getText = function(){return this.text.innerHTML;}
	FSelect.prototype.setText = function(text){
		this.text.innerHTML = (text == null || text.length == 0) ? "&nbsp;" : text;
		if (text != null && text.length != 0 && text != "&nbsp;") this.input.title = text; else this.input.title = "";
	}
	FSelect.prototype.setValueXML = function(xmlDoc){
		var text = getNodeValue(xmlDoc, this.getResTextXpath());
		var value = getNodeValue(xmlDoc, this.getResXpath());
		this.setValue(value, text);
	}
	FSelect.prototype.addToXML = function(reqXMLDoc){addToXML(this, reqXMLDoc);}
	FSelect.prototype.change = function(){for (var i = 0; i < this.affectTo.length; i++) this.affectTo[i].changeAffectBy();}
	FSelect.prototype.setParamsAffectBy = function(field, value){this.paramsAffect = new Params();this.paramsAffect.put(field, value);}
	FSelect.prototype.initAffectBy = function(){
		this.affectTo = new Array();
		this.affectBy = new Array();
	}
	FSelect.prototype.changeAffectBy = function(){
		this.paramsAffect = new Params();
		var noValue = false;
		for (var i = 0; i < this.affectBy.length; i++) {
			var field = this.affectByParam[i];
			var value = this.affectBy[i].getValue();
			if (value == "") noValue = true;
			this.paramsAffect.put(field, value);
		}
		this.setReadOnly((noValue && this.affectAlways));
		this.init();
		this.setLoaded(false);
		this.change();
	}
	FSelect.prototype.clickDeploy = function(){
		if (!this.readonly) {
			if (!this.deployed && !this.loaded && (this.lov != null)) this.throwReq(true);
			else if (this.deployed) this.undeploy();
			else this.deploy();
		}
	}
	FSelect.prototype.throwReq = function(deploylist){
		this.setImage(true);
		var paramsReq = new Params();
		paramsReq.append(this.params);
		paramsReq.append(this.paramsAffect);
		if (this.value != null && this.value.length > 0)
			paramsReq.put("value", this.value);
		var req = null;
		if (window.XMLHttpRequest) req = new XMLHttpRequest();
		else if (window.ActiveXObject) req = new ActiveXObject("Msxml2.XMLHTTP");
		var field = this;
		req.onreadystatechange = function(){
			if (req.readyState == 4) {
				if (req.status == 200) {
					var xmlDoc = req.responseXML;
					field.onResponse(xmlDoc, deploylist);
				}
			}
		}
		url = getMngWindow().getWindow("COM_LOV").getServletUrl() + paramsReq.toString();
		req.open("POST", url, true);
		req.setRequestHeader("content-type", "text/xml");
		req.send(null);
	}
	FSelect.prototype.onResponse = function(xmlDoc, deploylist){
		this.fillContent(xmlDoc);
		if (this.currentKey != null) {
			this.onkeydown(null, this.currentKey);
			this.currentKey == null;
		} else {
			if (deploylist) this.deploy();
		}
		this.setImage();
	}
	FSelect.prototype.clearContent = function(){
		this.list.innerHTML = "";
		this.options = new Array();
		if (!this.firstValue) this.createBlankOption();
	}
	FSelect.prototype.fillContent = function(xmlDoc){
		var aValues = getNodesValues(xmlDoc, buildXPath(new Array(Generic.XML_ROOT_P, Generic.XML_ROOT, Generic.XML_ID)));
		var aTexts = getNodesValues(xmlDoc, buildXPath(new Array(Generic.XML_ROOT_P, Generic.XML_ROOT, Generic.XML_NOMBRE)));
		this.fillContentFromArrays(aValues, aTexts);
	}
	FSelect.prototype.fillContentFromArrays = function(aValues, aTexts){
		this.clearContent();
		var soption = null;
		for (var j = 0; j < aTexts.length; j++) {
			var option = this.createOption(aValues[j], aTexts[j]);
			if (option.value == this.value) soption = option;
		}
		this.loaded = true;
		if (this.onLoaded != null) this.onLoaded();
		if (soption != null)
			this.setValue(soption.value, soption.innerHTML); 
		else
			if(this.firstValue && this.options != null && this.options.length > 0) this.setValue(this.options[0].value, this.options[0].innerHTML);
	}
	FSelect.prototype.hasValue = function(value){
		for(var i = 0; i < this.options.length; i++) if(this.options[i].value == value) return true;
		return false;
	}
	FSelect.prototype.isEmpty = function(){return ((this.value == null || this.value == ""));}
	FSelect.prototype.checkMandatory = function(){if (this.isMandatory() && this.value.length == 0) return false; else return true;}
	FSelect.prototype.isMandatory = function(){return this.mandatory;}
	FSelect.prototype.setMandatory = function(mandatory){
		this.mandatory = mandatory;
		this.refreshStyle();
	}
	FSelect.prototype.isReadOnly = function(){return this.readonly;}
	FSelect.prototype.setReadOnly = function(readonly){
		this.readonly = readonly;
		this.refreshStyle();
	}
	FSelect.prototype.setChanged = function(changed){this.changed = changed;}
	FSelect.prototype.isChanged = function(){return this.changed;}
	FSelect.prototype.hide = function(){return this.obj.style.display = "none";}
	FSelect.prototype.show = function(){return this.obj.style.display = "";}
	FSelect.prototype.setTarget = function(target){if (target != null) target.appendChild(this.obj);}
	FSelect.prototype.setImage = function(loading) {
		if (loading) this.image.src = getResources() + "/images/selectp.gif";
		else this.image.src = getResources() + "/images/select.gif";
	}
	FSelect.prototype.deploy = function(){

		this.list.style.top = "";
		this.list.style.width = "auto";
		this.list.style.height = "auto";
		this.list.style.display = "block";
		this.list.style.visibility = "";
		this.list.style.paddingLeft = "2px";
		this.list.style.paddingRight = "2px";
		this.deployed = true;

		if (this.list.clientWidth <= this.input.clientWidth) this.list.style.width = this.input.clientWidth + "px";
		else if (this.list.clientWidth < this.optionwidth)	 this.list.style.width = this.optionwidth + "px";

		var windowHeight = null;
		try {
			if(win != null && win.getIFrame() != null) windowHeight = win.getIFrame().clientHeight;
			else windowHeight = (isIE) ? document.body.clientHeight : window.innerHeight;
		} catch (ex) {
			windowHeight = (isIE) ? document.body.clientHeight : window.innerHeight;
		}
		
		if(this.addHeight != null) windowHeight = windowHeight + parseInt(this.addHeight);
		
		var bodyTop = (window.pageYOffset)? window.pageYOffset:Math.max(document.body.scrollTop, document.documentElement.scrollTop);
		
		var listTop = this.list.offsetTop - bodyTop;
		var inputTop = this.list.offsetTop - this.input.clientHeight;
		var distMaxDown = windowHeight - listTop - 10;

		if (this.list.clientHeight <= distMaxDown) {this.list.focus(); this.selectOptionSelected(); return;}

		var distMaxUp = inputTop - bodyTop - 10;
		var distMax = (distMaxDown < distMaxUp) ? distMaxUp : distMaxDown;

		if (this.list.clientHeight >= distMax) this.list.style.height = distMax + "px";
		if (this.list.clientHeight > 180) this.list.style.height = "180px";
		if (distMaxDown < distMaxUp) this.list.style.top = inputTop - this.list.clientHeight - 5 + "px";

		this.list.focus();
		this.selectOptionSelected();
	}
	FSelect.prototype.selectOptionSelected = function(){
		blucle : for (var j = 0; j < this.options.length; j++) if (this.options[j].value == this.value) {this.changeOptionSel(this.options[j]); break blucle};
	}
	
	FSelect.prototype.getIndexSelectedOption = function(){
		blucle : for (var j = 0; j < this.options.length; j++) if (this.options[j].value == this.value) {return j;};
	}
	
	FSelect.prototype.undeploy = function(){
		this.list.style.visibility = "hidden";
		this.list.style.display = "none";
		var fselect = this;
		this.clock = setTimeout(function(){fselect.deployed = false; clearTimeout(fselect.clock);}, 100);
	}
	FSelect.prototype.refreshStyle = function(isFocus){
		var cName;
		if (this.readonly) cName = "selinputro";
		else if (isFocus) cName = "selinputf";
		else cName = "selinput";
		this.input.className = cName;
		this.objMandatory.style.visibility = (this.mandatory? "" : "hidden");
	}
	FSelect.prototype.setAlign = function(align){
		this.align = align;
	}
	FSelect.prototype.create = function(target){

		this.obj = document.createElement("table");
		this.obj.cellPadding = "0";
		this.obj.cellSpacing = "0";
		this.obj.style.textAlign = "left";

		var tbody = document.createElement("tbody");
		this.obj.appendChild(tbody);

		var tr = document.createElement("tr");
		tbody.appendChild(tr);

		var td = document.createElement("td");
		tr.appendChild(td);

		this.objMandatory = document.createElement("span");
		this.objMandatory.className = "mandatory";
		this.objMandatory.innerHTML = "*";
		td.appendChild(this.objMandatory);

		var td = document.createElement("td");
		tr.appendChild(td);

		this.input = document.createElement("table");
		this.input.cellPadding = "0";
		this.input.cellSpacing = "0";
		this.input.tabIndex = "0";
		this.input.fselect = this;
		td.appendChild(this.input);

		var fselect = this;
		this.input.onclick = function(){this.fselect.clickDeploy()};
		addEvent(this.input, "onblur", "this.fselect.refreshStyle(); this.fselect.checkOnChange();");
		addEvent(this.input, "onkeydown", "this.fselect.onkeydown(event);");
		addEvent(this.input, "onfocus", "this.fselect.refreshStyle(true);");

		var tbody2 = document.createElement("tbody");
		this.input.appendChild(tbody2);

		var tr2 = document.createElement("tr");
		tbody2.appendChild(tr2);

		var td2 = document.createElement("td");
		tr2.appendChild(td2);

		this.text = document.createElement("div");
		this.text.style.overflow = "hidden";
		this.text.style.whiteSpace = "nowrap";
		this.text.style.textIndent = "2px";
		td2.appendChild(this.text);

		var td2 = document.createElement("td");
		td2.align = "right";
		tr2.appendChild(td2);

		this.image = document.createElement("img");
		this.image.style.verticalAlign = "middle";
		td2.appendChild(this.image);

		this.setImage();

		this.refreshStyle();

		if (isIE) this.obj.appendChild(document.createElement("br"));

		var tr2 = document.createElement("tr");
		tbody.appendChild(tr2);

		var td2 = document.createElement("td");
		tr2.appendChild(td2);

		var td2 = document.createElement("td");
		tr2.appendChild(td2);

		this.list = document.createElement("div");
		this.list.className = "sellist";
		this.list.style.display = "none";
		this.list.tabIndex = "0";
		this.list.fselect = this;
		this.list.style.overflowY = "auto";
		this.list.style.overflowX = "hidden";
		td2.appendChild(this.list);

		addEvent(this.list, "onkeydown", "this.fselect.onkeydown(event);");
		addEvent(this.list, "onblur", "this.fselect.undeploy(); this.fselect.checkOnChange();");

		if (this.textBlank != null) this.setText(this.textBlank);

		this.optionwidth = 150;
		this.setWidth(150);

		this.setTarget(target);
	}
	FSelect.prototype.cloneNode = function(target){

		var fselect = new FSelect(target, this.lov, this.resXPath, this.resTextXpath, this.textBlank);
		fselect.value = this.value;
		fselect.oldValue = this.oldValue;
		fselect.mandatory = this.mandatory;
		fselect.firstValue = this.firstValue;
		fselect.readonly = this.readonly;
		fselect.reqXPath = this.reqXPath;
		fselect.changed = this.changed;
		fselect.paramsAffect = this.paramsAffect.cloneNode();
		fselect.params = this.params.cloneNode();
		fselect.loaded = this.loaded;
		fselect.onLoaded = this.onLoaded;
		fselect.onchange = this.onchange;
		fselect.setWidth(this.width);
		fselect.refreshStyle();

		for (var j = 0; j < this.options.length; j++) {
			var option = fselect.createOption(this.options[j].value, this.options[j].innerHTML);
			if (this.options[j] == this.optionsel) fselect.optionsel = option;
		}

		if(fselect.firstValue && fselect.options != null && fselect.options.length > 0) fselect.setValue(fselect.options[0].value, fselect.options[0].innerHTML);

		return fselect;
	}

	//**************************//
	// CLASE FSELNUM			//
	//**************************//
	function FSelNum(target, resXPath, first, last, pass, textBlank, minNumbers, concatText){

		this.type = "FSELNUM";
		this.resXPath = resXPath;
		this.resTextXpath = resXPath;
		this.reqXPath = resXPath;
		this.minNumbers = minNumbers;
		this.concatText = concatText;
		this.textBlank = textBlank;
		this.create(target);

		var width = null;
		if (last > 0 && last <= 99) width = 40;
		else if (last > 99 && last <= 999) width = 60;
		else if (last > 999) width = 70;
		
		if(this.concatText != null) 
			width = parseInt(width) + 40;
		
		this.setWidth(width);

		this.setRange(first, last, pass, concatText);
	}
	FSelNum.prototype = new FSelect("OO");
	FSelNum.prototype.getValueAsInt = function(){return parseInt(this.getValue(), 10);}
	FSelNum.prototype.setRange = function(first, last, pass, concatText){

		if(concatText != null)
			this.concatText = concatText

		this.first = first;
		this.last = last;
		this.pass = pass;

		var value = this.getValueAsInt();
		var aValues = new Array();
		var aTexts = new Array();
		for (var i = this.first; i <= this.last; i += this.pass) {
			
			var textAux = (((this.concatText != null)? this.concatText + " ":"") + this.getMinNumberValue(i));
			
			aValues.push(this.getMinNumberValue(i)); 
			aTexts.push(textAux);
		}
		this.fillContentFromArrays(aValues, aTexts);
		this.init();

		if (!isNaN(value)){
			 if (value < last) this.setValue(value); else this.setValue(last);
		}
	}
	FSelNum.prototype.getMinNumberValue = function(value) {
		if ((this.minNumbers != null) && (!isNaN(value)) && (new String(value)).length < this.minNumbers) {
			var aux = "";
			for (var i = 0; i < (this.minNumbers - 1); i++) aux += "0";
			return aux + value;
		} else {
			return value;
		}
	}
	FSelNum.prototype.setValueXML = function(xmlDoc){
		var text = getNodeValue(xmlDoc, this.getResTextXpath());
		var value = getNodeValue(xmlDoc, this.getResXpath());
		
		if((text == null || text == "" || value == text) && this.concatText != null)
			text = this.concatText + " " + value;
		
		this.setValue(value, text);
	}
	FSelNum.prototype.cloneNode = function(target){

		var fselnum = new FSelNum(target, this.resXPath, this.first, this.last, this.pass, this.textBlank, this.minNumbers, this.concatText);
		fselnum.value = this.value;
		fselnum.oldValue = this.oldValue;
		fselnum.mandatory = this.mandatory;
		fselnum.readonly = this.readonly;
		fselnum.reqXPath = this.reqXPath;
		fselnum.changed = this.changed;
		fselnum.paramsAffect = this.paramsAffect.cloneNode();
		fselnum.params = this.params.cloneNode();
		fselnum.loaded = this.loaded;
		fselnum.onLoaded = this.onLoaded;
		fselnum.onchange = this.onchange;
		fselnum.concatText = this.concatText;
		fselnum.setText(((this.concatText != null)? this.concatText + " ":"") + this.value);
		fselnum.refreshStyle();
		return fselnum;
	}

	//**************************//
	// CLASE FSELDATE			//
	//**************************//
	function FSelDate(target, resXPath, first, last, textBlank){

		this.type = "FSELDATE";
		this.formatDate = getUserConfig().getFormatDate();
		this.resXPath = resXPath;
		this.resTextXpath = resXPath;
		this.reqXPath = resXPath;
		this.textBlank = textBlank;
		this.create(target);

		this.setWidth(85);
		this.setRange(first, last);
	}
	FSelDate.prototype = new FSelect("OO");
	FSelDate.prototype.getValueAsDate = function(){return strToDate(this.getValue());}
	FSelDate.prototype.setRange = function(first, last){
		this.first = strToDate(first);
		this.first = new Date(this.first.getFullYear(), this.first.getMonth(), this.first.getDate());

		this.last = strToDate(last);
		this.last = new Date(this.last.getFullYear(), this.last.getMonth(), this.last.getDate());

		var value = first;
		var aValues = new Array();
		var aTexts = new Array();

		var current = this.first;
		while (current.getTime() <= this.last.getTime()){
			aValues.push(dateToStr(current));
			aTexts.push(dateToStr(current));
			current = addDays(current, 1);
		}

		this.fillContentFromArrays(aValues, aTexts);
		this.init();
	}
	FSelDate.prototype.cloneNode = function(target){

		var fseldate = new FSelDate(target, this.resXPath, this.first, this.last, this.textBlank);
		fseldate.value = this.value;
		fseldate.oldValue = this.oldValue;
		fseldate.mandatory = this.mandatory;
		fseldate.readonly = this.readonly;
		fseldate.reqXPath = this.reqXPath;
		fseldate.changed = this.changed;
		fseldate.paramsAffect = this.paramsAffect.cloneNode();
		fseldate.params = this.params.cloneNode();
		fseldate.loaded = this.loaded;
		fseldate.onLoaded = this.onLoaded;
		fseldate.onchange = this.onchange;
		fseldate.setText(this.value);
		fseldate.refreshStyle();
		return fseldate;
	}

	//**************************//
	// CLASE FMULSEL			//
	//**************************//
	function FMulSel(target, lov, resXPath, horizontal, onclick){

		this.type = "FMULSEL";
		this.lov = lov;
		this.resXPath = resXPath;
		this.reqXPath = resXPath;
		this.mandatory = false;
		this.readOnly = false;
		this.changed = false;
		this.params = new Params();
		if(this.lov != null) this.params.put("lov", this.lov);
		this.options = new Array();
		this.onLoaded = null;
		this.horizontal = horizontal;
		this.onclick = onclick;
		this.isOnPetition = false;
		this.obj = null;

		this.create(target);
	}
	FMulSel.prototype.getType = function(){return this.type;}
	FMulSel.prototype.setOnLoaded = function(onLoaded){this.onLoaded = onLoaded;}
	FMulSel.prototype.addEvent = function(eventName, action){addEvent(this.obj, eventName, action);} // TODO
	FMulSel.prototype.setWidth = function(width){
		if (width == null) this.obj.style.width = "auto";
		else this.obj.style.width = width + "px";
	}
	FMulSel.prototype.setSize = function(size){this.obj.style.height = size * 15 + "px";}
	FMulSel.prototype.init = function(){
		for (var i = 0; i < this.options.length; i++) this.options[i].init();
		this.change();
	}
	FMulSel.prototype.getObj = function(){return this.obj;}
	FMulSel.prototype.getResXpath = function(){return this.resXPath;}
	FMulSel.prototype.setResXpath = function(resXPath){this.resXPath = resXPath;}
	FMulSel.prototype.getReqXpath = function(){return this.reqXPath;}
	FMulSel.prototype.setReqXpath = function(reqXPath){this.reqXPath = reqXPath;}
	FMulSel.prototype.addParam = function(name, value){this.params.putByName(name, value);}
	FMulSel.prototype.delParam = function(name){this.params.remByName(name);}
	FMulSel.prototype.getLov = function(){return this.lov;}
	FMulSel.prototype.setLov = function(lov){
		this.lov = lov;
		this.params.put("lov", this.lov)
	}
	FMulSel.prototype.getValue = function(){
		var result = new Array();
		for (var i = 0; i < this.options.length; i++) {if (this.options[i].isChecked()) result.push(this.options[i].getValue());}
		return result;
	}
	FMulSel.prototype.getATextValues = function(){
		var result = new Array();
		for (var i = 0; i < this.options.length; i++) {if (this.options[i].isChecked()) result.push(this.options[i].getText());}
		return result;
	}
	FMulSel.prototype.setValueXML = function(xmlDoc){
		this.init();
		var aValues = getNodesValues(xmlDoc, this.getResXpath());
		for (var i = 0; i < this.options.length; i++) {
			for (var x = 0; x < aValues.length; x++) {
				if (this.options[i].value == aValues[x]) this.options[i].checked(true);
			}
		}
		this.change();
	}
	FMulSel.prototype.setValue = function(aValues){
			for (var i = 0; i < this.options.length; i++) {
				for (var x = 0; x < aValues.length; x++) {
					if (this.options[i].value == aValues[x]) this.options[i].checked(true);
				}
			}
			this.change();
	}
	FMulSel.prototype.addToXML = function(reqXMLDoc){addToXML(this, reqXMLDoc);}
	FMulSel.prototype.throwReq = function(){
		this.isOnPetition = true;
		var paramsReq = new Params();
		paramsReq.append(this.params);
		throwRequestLov(this, paramsReq);
	}
	FMulSel.prototype.onResponse = function(xmlDoc){
		this.fillContent(xmlDoc);
		if (this.onLoaded != null) this.onLoaded();
	}
	FMulSel.prototype.clear = function(xmlDoc){this.getObj().innerHTML = "";}
	FMulSel.prototype.fillContent = function(xmlDoc){
		var aValues = getNodesValues(xmlDoc, buildXPath(new Array(Generic.XML_ROOT_P, Generic.XML_ROOT, Generic.XML_ID)));
		var aTexts = getNodesValues(xmlDoc, buildXPath(new Array(Generic.XML_ROOT_P, Generic.XML_ROOT, Generic.XML_NOMBRE)));
		this.clear();
		this.fillContentFromArrays(aValues, aTexts);
	}
	FMulSel.prototype.fillContentFromArrays = function(aValues, aTexts){
		this.options = new Array();
		for (var i = 0; i < aTexts.length; i++) {
			var doption = document.createElement("div");
			if (this.horizontal){
				 ((isIE)? doption.style.styleFloat = "left" : doption.style.cssFloat = "left");
			}
			var option = new FCheckBox(doption, aTexts[i], aValues[i], null);
			option.getObj().fmulsel = this;
			option.addEvent("onchange", "this.fmulsel.change();")

			if (this.onclick != null) {
				var dAction = document.createElement("label");
				dAction.innerHTML = "<a class='fieldcc' onclick='"+ this.onclick + "("+ aValues[i] +");'>"+ aTexts[i] +"</a>";
				option.objParent.appendChild(dAction);
				option.setText("");
			}

			this.getObj().appendChild(doption);
			this.options.push(option);
		}
		this.obj.style.padding = "5px";
		this.init();
		this.isOnPetition = false;
	}
	FMulSel.prototype.change = function(){this.setChanged(true);}
	FMulSel.prototype.checkMandatory = function(){
		return !(this.isMandatory() && (this.getValue().length == 0));
	}
	FMulSel.prototype.isMandatory = function(){return this.mandatory;}
	FMulSel.prototype.setMandatory = function(mandatory){this.mandatory = mandatory; this.refreshStyle();}
	FMulSel.prototype.isReadOnly = function(){return this.readOnly;}
	FMulSel.prototype.setReadOnly = function(readOnly){
		this.readOnly = readOnly;
		for (var i = 0; i < this.options.length; i++) this.options[i].setReadOnly(this.readOnly);
		this.refreshStyle();
	}
	FMulSel.prototype.setChanged = function(changed){this.changed = changed;}
	FMulSel.prototype.isChanged = function(){return this.changed;}
	FMulSel.prototype.hide = function(){return this.objParent.style.display = "none";}
	FMulSel.prototype.show = function(){return this.objParent.style.display = "";}
	FMulSel.prototype.refreshStyle = function(isFocus){
		this.obj.className = (this.readonly? "fmulselro" : (isFocus? "fmulself" : "fmulsel"));
		this.objMandatory.style.visibility = (this.mandatory? "" : "hidden");
	}
	FMulSel.prototype.create = function(target){
		this.objParent = document.createElement("table");
		this.objParent.cellPadding = "0";
		this.objParent.cellSpacing = "0";

		var tbody = document.createElement("tbody");
		this.objParent.appendChild(tbody);

		var tr = document.createElement("tr");
		tbody.appendChild(tr);

		var td = document.createElement("td");
		td.style.verticalAlign = "middle";
		tr.appendChild(td);

		this.objMandatory = document.createElement("span");
		this.objMandatory.className = "mandatory";
		this.objMandatory.innerHTML = "*";
		td.appendChild(this.objMandatory);

		var td = document.createElement("td");
		tr.appendChild(td);

		this.obj = document.createElement("div");
		this.obj.fmulsel = this;
		addEvent(this.obj, "onblur", "this.fmulsel.refreshStyle();");
		addEvent(this.obj, "onfocus", "this.fmulsel.refreshStyle(true);");
		td.appendChild(this.obj);

		this.setTarget(target);
		this.setSize(5);
		this.refreshStyle();

		if (this.lov != null) this.throwReq();
	}
	FMulSel.prototype.setTarget = function(target){if (target != null) target.appendChild(this.objParent);}


	//**************************//
	// CLASE FXSELECT	  	    //
	//**************************//
	function FXSelect(target, lov, resValueXpath, resTextXpath, textBlank){

		this.type = "FXSELECT";
		this.base = new Field(resValueXpath);
		this.resTextXpath = resTextXpath;
		this.firstValue = null;
		this.affectTo = new Array();
		this.affectByParam = new Array();
		this.affectBy = new Array();
		this.paramsAffect = new Params();

		this.lov = lov;
		this.params = new Params();
		this.params.putByName("lov", this.lov);

		this.loaded = false;
		this.textBlank = (textBlank != null) ? textBlank : "";

		this.onLoaded;

		this.create(target);
	}
	FXSelect.prototype.setFirstValue = function(firstValue){this.firstValue = firstValue;}
	FXSelect.prototype.setWidth = function(width){this.base.setWidth(width);}
	FXSelect.prototype.addEvent = function(eventName, action){this.base.addEvent(eventName, action);}
	FXSelect.prototype.setTextBlank = function(textBlank){this.textBlank = textBlank;}
	FXSelect.prototype.setOnLoaded = function(onLoaded){this.onLoaded = onLoaded;}
	FXSelect.prototype.getObj = function(){return this.base.getObj();}
	FXSelect.prototype.getType = function getType(){return this.type;}
	FXSelect.prototype.init = function(){this.setValue("", "");}
	FXSelect.prototype.getResXpath = function(){return this.base.getResXpath();}
	FXSelect.prototype.setResXpath = function(resXpath){this.base.setResXpath(resXpath);}
	FXSelect.prototype.getResTextXpath = function(){return this.resTextXpath;}
	FXSelect.prototype.setResTextXpath = function(resTextXpath){this.resTextXpath = resTextXpath;}
	FXSelect.prototype.getReqXpath = function(){return this.base.getReqXpath();}
	FXSelect.prototype.setReqXpath = function(reqXPath){this.base.setReqXpath(reqXPath);}
	FXSelect.prototype.putAffectTo = function(field){this.affectTo.push(field);}
	FXSelect.prototype.putAffectBy = function(field, param){this.affectBy.push(field);this.affectByParam.push(param);}
	FXSelect.prototype.addParam = function(name, value){this.params.putByName(name, value);}
	FXSelect.prototype.delParam = function(name){this.params.remByName(name);}
	FXSelect.prototype.getParam = function(name){return this.params.getParamValue(name);}
	FXSelect.prototype.getLov = function(){return this.lov;}
	FXSelect.prototype.setLov = function(lov){this.lov = lov;}
	FXSelect.prototype.setLoaded = function(loaded){this.loaded = loaded;}
	FXSelect.prototype.isLoaded = function(){return this.loaded;}
	FXSelect.prototype.createGroup = function(text){
		var optGroup = document.createElement("optgroup");
		optGroup.label = text;
		return optGroup;
	}
	FXSelect.prototype.createOption = function(value, text, rParent, optGroup){
		var option = document.createElement("option");
		option.value = value;
		option.innerHTML = text;
		if (optGroup != null){
			optGroup.appendChild(option);
			this.getObj().appendChild(optGroup);
		} else {
			this.getObj().appendChild(option);
		}
		return option;
	}
	FXSelect.prototype.createBlankOption = function(){if (this.textBlank != null) this.createOption("", this.textBlank);}
	FXSelect.prototype.getValue = function(){return this.base.getValue();}
	FXSelect.prototype.getText = function(){
		var options = this.getObj().options;
		for (var i = 0; i < options.length; i++){
			if (options[i].selected) return options[i].text;
		}
	}
	FXSelect.prototype.setValue = function(value, text){
		this.setChanged(true);
		var options = this.getObj().options;
		for (var i = 0; i < options.length; i++){
			if (value == options[i].value){
				options[i].selected = true;
				this.change();
				return;
			}
		}
		var option = this.createOption(value, text);
		option.selected = true;
		this.change();
	}
	FXSelect.prototype.setValueXML = function(xmlDoc){
		var text = getNodeValue(xmlDoc, this.getResTextXpath());
		var value = getNodeValue(xmlDoc, this.getResXpath());
		this.setValue(value, text);
	}
	FXSelect.prototype.addToXML = function(reqXMLDoc){addToXML(this, reqXMLDoc);}
	FXSelect.prototype.change = function(){
		for (var i = 0; i < this.affectTo.length; i++) {
			this.affectTo[i].changeAffectBy();
		}
	}
	FXSelect.prototype.setParamsAffectBy = function(field, value){
		this.paramsAffect = new Params();
		this.paramsAffect.put(field, value);
	}
	FXSelect.prototype.changeAffectBy = function(){
		this.paramsAffect = new Params();
		var noValue = false;
		for(var i = 0; i < this.affectBy.length; i++){
			var field = this.affectByParam[i];
			var value = this.affectBy[i].getValue();
			if(this.affectBy[i].getType() == "FXMULSEL"){
				if(value.length == 0) noValue = true;
				this.paramsAffect.putValues(field, value);
			} else {
				if(value == "") noValue = true;
				this.paramsAffect.put(field, value);
			}
		}
		this.setReadOnly(noValue);
		this.init();
		this.loaded = false;
		this.change();
	}
	FXSelect.prototype.clickDeploy = function(){if(!this.loaded) this.throwReq();}
	FXSelect.prototype.throwReq = function(){
		var paramsReq = new Params();
		paramsReq.append(this.params);
		paramsReq.append(this.paramsAffect);
		if (this.getValue() != null) paramsReq.put("value", this.getValue());
		throwRequestLov(this, paramsReq);
	}
	FXSelect.prototype.onResponse = function(xmlDoc){this.fillContent(xmlDoc);}
	FXSelect.prototype.clearContent = function(){
		this.getObj().innerHTML = "";
		this.createBlankOption();
	}
	FXSelect.prototype.fillContent = function(xmlDoc){
		var aValues = getNodesValues(xmlDoc, buildXPath(new Array(Generic.XML_ROOT_P, Generic.XML_ROOT, Generic.XML_ID)));
		var aTexts = getNodesValues(xmlDoc, buildXPath(new Array(Generic.XML_ROOT_P, Generic.XML_ROOT, Generic.XML_NOMBRE)));
		var aParent = getNodesValues(xmlDoc, buildXPath(new Array(Generic.XML_ROOT_P, Generic.XML_ROOT, Generic.XML_DESCRIPCION)));
		this.fillContentFromArrays(aValues, aTexts, aParent);
	}
	FXSelect.prototype.fillContentFromArrays = function(aValues, aTexts, aParent){
		var svalue = this.getValue();
		this.clearContent();
		var sonValue = new Array();
		var sonText = new Array();
		var sonParent = new Array();
		var parentValue = new Array();
		var parentText = new Array();
		var parentParent = new Array();
		var listValue = new Array();
		var listText = new Array();
		var listParent = new Array();
		for (var j = 0; j < aTexts.length; j++) {
			if (aParent[j] == ""){
				parentValue.push(aValues[j]) ;
				parentText.push(aTexts[j]);
				parentParent.push(aParent[j]);
			} else {
				sonValue.push(aValues[j]) ;
				sonText.push(aTexts[j]);
				sonParent.push(aParent[j]);
			}
		}

		for (var j = 0; j < parentText.length; j++){
			var count = listValue.length;
			if (sonText.length != 0) {
				listValue.push(parentValue[j]);
				listText.push(parentText[j]);
				listParent.push("Padre");
				for(var i = 0; i < sonText.length; i++){
					if (parentValue[j] == sonParent[i]){
						listValue.push(sonValue[i]);
						listText.push(sonText[i]);
						listParent.push(sonParent[i]);
					}
				}
			} else {
				listValue.push(parentValue[j]);
				listText.push(parentText[j]);
				listParent.push(parentParent[j]);
			}
		}

		var optGroup = null;
		var option = null;
		for (var j = 0; j < listText.length; j++) {
			if (listParent[j] == "Padre"){
				optGroup = this.createGroup(listText[j]);
			}
			if (listParent[j] != "Padre"){
				option = this.createOption(listValue[j], listText[j], listParent[j], optGroup);
			} else {
				if (listParent[j] == "Padre" && listParent[j + 1] == "Padre"){
					option = this.createOption(listValue[j], listText[j], listParent[j]);
				}
			}
			if (option != null && svalue == option.value) {
				option.selected = true;
			}
		}

		this.loaded = true;
		if(this.onLoaded != null) this.onLoaded();
		if(svalue == null && this.firstValue && this.getObj().options != null && this.getObj().options.length > 1) this.setValue(this.getObj().options[1].value);
	}
	FXSelect.prototype.checkMandatory = function(){return this.base.checkMandatory();}
	FXSelect.prototype.isMandatory = function(){return this.base.isMandatory();}
	FXSelect.prototype.setMandatory = function(mandatory){this.base.setMandatory(mandatory);}
	FXSelect.prototype.isReadOnly = function(){return this.base.getReadOnly();}
	FXSelect.prototype.setReadOnly = function(readOnly){this.base.setReadOnly(readOnly);this.getObj().disabled = readOnly;}
	FXSelect.prototype.setChanged = function(changed){this.base.setChanged(changed);}
	FXSelect.prototype.isChanged = function(){return this.base.isChanged();}
	FXSelect.prototype.hide = function(){return this.base.hide();}
	FXSelect.prototype.show = function(){return this.base.show();}
	FXSelect.prototype.create = function(target){
		this.base.create(target, true);
		this.getObj().fselect = this;
		this.createBlankOption();

		addEvent(this.getObj(), "onchange", "this.fselect.change();");
		addEvent(this.getObj(), "onclick", "this.fselect.clickDeploy();");
		addEvent(this.getObj(), "onkeydown", "this.fselect.clickDeploy();");
	}
	FXSelect.prototype.cloneNode = function(target){
		var fselect = new FXSelect();
		fselect.base = this.base.cloneNode(target);
		fselect.getObj().fselect = fselect;
		fselect.textBlank = this.textBlank;
		fselect.resTextXpath = this.resTextXpath;
		fselect.paramsAffect = this.paramsAffect.cloneNode();
		fselect.lov = this.lov;
		fselect.params = this.params.cloneNode();
		fselect.loaded = this.loaded;
		fselect.onLoaded = this.onLoaded;
		return fselect;
	}
	FXSelect.prototype.getATextValues = function(withDefault){
		var result = new Array();
		var options = this.getObj().options;
		var initPos = (withDefault)?0:1;
		for(var i = initPos ; i < options.length; i++){result.push(options[i].value);}
		return result;
	}

	//**************************//
	// CLASE FXSELNUM			//
	//**************************//
	function FXSelNum(target, resXPath, first, last, pass, textBlank, minNumbers){
		this.type = "FXSELNUM";
		this.base = new Field(resXPath);
		this.textBlank = textBlank;
		this.create(last, target);
		this.minNumbers = minNumbers;
		this.setRange(first, last, pass);
	}
	FXSelNum.prototype.setWidth = function(width){this.base.setWidth(width);}
	FXSelNum.prototype.getObj = function(){return this.base.getObj();}
	FXSelNum.prototype.addEvent = function(eventName, action){this.base.addEvent(eventName, action);}
	FXSelNum.prototype.getType = function getType(){return this.type;}
	FXSelNum.prototype.init = function(){if(this.base.getObj().options.length > 0) this.base.getObj().options[0].selected = true;}
	FXSelNum.prototype.getResXpath = function(){return this.base.getResXpath();}
	FXSelNum.prototype.setResXpath = function(resXPath){this.base.setResXpath(resXPath);}
	FXSelNum.prototype.getReqXpath = function(){return this.base.getReqXpath();}
	FXSelNum.prototype.setReqXpath = function(reqXPath){this.base.setReqXpath(reqXPath);}
	FXSelNum.prototype.getValue = function(){return this.base.getValue();}
	FXSelNum.prototype.getValueAsInt = function(){return parseInt(this.getValue(), 10);}
	FXSelNum.prototype.setRange = function(first, last, pass){
		this.first = first;
		this.last = last;
		this.pass = pass;
		var aValues = new Array();
		var aTexts = new Array();
		if(this.textBlank != null) {aValues.push(""); aTexts.push(this.textBlank);}
		for(var i = this.first; i <= this.last; i += this.pass){aValues.push(i); aTexts.push(i);}
		this.fillContentFromArrays(aValues, aTexts);
	}
	FXSelNum.prototype.setValue = function(value){
		this.setChanged(true);
		var options = this.getObj().options;
		for(var i = 0; i < options.length; i++){
			if(options[i].value == value){
				options[i].selected = true;
				return;
			}
		}
	}
	FXSelNum.prototype.setValueXML = function(xmlDoc){
		var value = getNodeValue(xmlDoc, this.getResXpath());
		this.setValue(value);
	}
	FXSelNum.prototype.getMinNumberValue = function(value) {
		if ((this.minNumbers != null) && (!isNaN(value)) && (new String(value)).length < this.minNumbers) {
			var aux = "";
			for (var i = 0; i < (this.minNumbers - 1); i++) aux += "0";
			return aux + value;
		} else {
			return value;
		}
	}
	FXSelNum.prototype.createOption = function(value, text){
		value = this.getMinNumberValue(value);
		text = this.getMinNumberValue(text);
		var option = document.createElement("option");
		option.value = value;
		option.innerHTML = text;
		this.getObj().appendChild(option);
		return option;
	}
	FXSelNum.prototype.addToXML = function(reqXMLDoc){addToXML(this, reqXMLDoc);}
	FXSelNum.prototype.clearContent = function(){this.getObj().innerHTML = "";}
	FXSelNum.prototype.fillContentFromArrays = function(aValues, aTexts){
		this.clearContent();
		for (var i = 0; i < aValues.length; i++){
			this.createOption(aValues[i], aTexts[i]);
		}
	}
	FXSelNum.prototype.checkMandatory = function(){return this.base.checkMandatory();}
	FXSelNum.prototype.isMandatory = function(){return this.base.isMandatory();}
	FXSelNum.prototype.setMandatory = function(mandatory){this.base.setMandatory(mandatory);}
	FXSelNum.prototype.isReadOnly = function(){return this.base.isReadOnly();}
	FXSelNum.prototype.setReadOnly = function(readOnly){this.base.setReadOnly(readOnly);this.getObj().disabled = readOnly;}
	FXSelNum.prototype.setChanged = function(changed){this.base.setChanged(changed);}
	FXSelNum.prototype.isChanged = function(){return this.base.isChanged();}
	FXSelNum.prototype.hide = function(){return this.base.hide();}
	FXSelNum.prototype.show = function(){return this.base.show();}
	FXSelNum.prototype.create = function(last, target){
		this.base.create(target, true);
		var width = null;
		if (last > 0 && last <= 99) width = 40;
		else if (last > 99 && last <= 999) width = 60;
		else if (last > 999) width = 70;
		this.base.setWidth(width);
	}
	FXSelNum.prototype.cloneNode = function(target){
		var fselnum = new FXSelNum();
		fselnum.base = this.base.cloneNode(target);
		fselnum.textBlank = this.textBlank;
		return fselnum;
	}

	//**************************//
	// CLASE FXMULSEL			//
	//**************************//
	function FXMulSel(target, lov, resXPath){

		this.type = "FXMULSEL";
		this.base = new Field(resXPath);

		this.lov = lov;
		this.params = new Params();
		this.params.put("lov", this.lov);
		this.paramsAffect = new Params();
		this.affectByParam = new Array();
		this.affectTo = new Array();
		this.affectBy = new Array();

		this.onLoaded = null;

		this.create(target);
	}
	FXMulSel.prototype.getType = function(){return this.type;}
	FXMulSel.prototype.setOnLoaded = function(onLoaded){this.onLoaded = onLoaded;}
	FXMulSel.prototype.addEvent = function(eventName, action){this.base.addEvent(eventName, action);}
	FXMulSel.prototype.setWidth = function(width){this.base.setWidth(width);}
	FXMulSel.prototype.setSize = function(size){this.getObj().size = size;}
	FXMulSel.prototype.init = function(){
		this.getObj().selectedIndex = -1;
		this.change();
	}
	FXMulSel.prototype.getObj = function(){return this.base.getObj();}
	FXMulSel.prototype.getResXpath = function(){return this.base.getResXpath();}
	FXMulSel.prototype.setResXpath = function(resXPath){this.base.setResXpath(resXPath);}
	FXMulSel.prototype.getReqXpath = function(){return this.base.getReqXpath();}
	FXMulSel.prototype.setReqXpath = function(reqXPath){this.base.setReqXpath(reqXPath);}
	FXMulSel.prototype.addParam = function(name, value){this.params.putByName(name, value);}
	FXMulSel.prototype.delParam = function(name){this.params.remByName(name);}
	FXMulSel.prototype.getParam = function(name){return this.params.getParamValue(name);}
	FXMulSel.prototype.putAffectTo = function(field){this.affectTo.push(field);}
	FXMulSel.prototype.putAffectBy = function(field, param){this.affectBy.push(field);this.affectByParam.push(param);}
	FXMulSel.prototype.getLov = function(){return this.lov;}
	FXMulSel.prototype.setLov = function(lov){this.lov = lov;}
	FXMulSel.prototype.getValue = function(){
		var result = new Array();
		var options = this.getObj().options;
		for(var i = 0; i < options.length; i++){if(options[i].selected) result.push(options[i].value);}
		return result;
	}
	FXMulSel.prototype.getATextValues = function(){
		var result = new Array();
		var options = this.getObj().options;
		for(var i = 0; i < options.length; i++){if (options[i].selected) result.push(options[i].text);}
		return result;
	}
	FXMulSel.prototype.setValueXML = function(xmlDoc){
		this.init();
		var aValues = getNodesValues(xmlDoc, this.getResXpath());
		var options = this.getObj().options;
		for(var i = 0; i < options.length; i++){
			for (var x = 0; x < aValues.length; x++){
				if (options[i].value == aValues[x]) {
					if (isIE) options[i].setAttribute("selected", "selected");
					else options[i].selected = true;
				}
			}
		}
		this.change();
	}
	FXMulSel.prototype.addToXML = function(reqXMLDoc){addToXML(this, reqXMLDoc);}
	FXMulSel.prototype.throwReq = function(){
		var paramsReq = new Params();
		paramsReq.append(this.params);
		paramsReq.append(this.paramsAffect);
		throwRequestLov(this, paramsReq);
	}
	FXMulSel.prototype.onResponse = function(xmlDoc){
		this.fillContent(xmlDoc);
		if (this.onLoaded != null) this.onLoaded();
	}
	FXMulSel.prototype.clear = function(xmlDoc){this.getObj().innerHTML = "";}
	FXMulSel.prototype.fillContent = function(xmlDoc){
		var aValues = getNodesValues(xmlDoc, buildXPath(new Array(Generic.XML_ROOT_P, Generic.XML_ROOT, Generic.XML_ID)));
		var aTexts = getNodesValues(xmlDoc, buildXPath(new Array(Generic.XML_ROOT_P, Generic.XML_ROOT, Generic.XML_NOMBRE)));
		this.clear();
		this.fillContentFromArrays(aValues, aTexts);
	}
	FXMulSel.prototype.fillContentFromArrays = function(aValues, aTexts){
		for(var i = 0; i < aTexts.length; i++){
			var option = document.createElement("option");
			option.value = aValues[i];
			option.innerHTML = aTexts[i];
			if (isIE) option.defaultSelected = false;
			this.getObj().appendChild(option);
		}
	}
	FXMulSel.prototype.change = function(){for(var i = 0; i < this.affectTo.length; i++){this.affectTo[i].changeAffectBy();}}
	FXMulSel.prototype.changeAffectBy = function(){
		this.paramsAffect = new Params();
		var noValue = false;
		for(var i = 0; i < this.affectBy.length; i++){
			var field = this.affectByParam[i];
			var value = this.affectBy[i].getValue();
			if(this.affectBy[i].getType() == "FXMULSEL"){
				if(value.length == 0) noValue = true;
				this.paramsAffect.putValues(field, value);
			} else {
				if(value == "") noValue = true;
				this.paramsAffect.put(field, value);
			}
		}
		if(noValue) this.clear();
		else this.throwReq();
		this.change();
	}
	FXMulSel.prototype.checkMandatory = function(){
		if(this.isMandatory() && (this.getValue().length == 0)) return false;
		else return true;
	}
	FXMulSel.prototype.isMandatory = function(){return this.base.isMandatory();}
	FXMulSel.prototype.setMandatory = function(mandatory){this.base.setMandatory(mandatory);}
	FXMulSel.prototype.isReadOnly = function(){return this.base.isReadOnly();}
	FXMulSel.prototype.setReadOnly = function(readOnly){this.base.setReadOnly(readOnly);this.getObj().disabled = readOnly;}
	FXMulSel.prototype.setChanged = function(changed){this.base.setChanged(changed);}
	FXMulSel.prototype.isChanged = function(){return this.base.isChanged();}
	FXMulSel.prototype.hide = function(){return this.base.hide();}
	FXMulSel.prototype.show = function(){return this.base.show();}
	FXMulSel.prototype.create = function(target){
		this.base.create(target, true, true);
		this.base.getObj().fmulsel = this;

		addEvent(this.base.getObj(), "onchange", "this.fmulsel.change();");

		this.getObj().title = getMessage("msg03");
		this.getObj().style.minWidth = "150px";

		if(this.lov != null) this.throwReq();
	}
	FXMulSel.prototype.cloneNode = function(target){
		var fmulsel = new FXMulSel();
		fmulsel.base = this.base.cloneNode(target);
		fmulsel.base.obj.fmulsel = fmulsel;
		fmulsel.paramsAffect = this.paramsAffect.cloneNode();
		fmulsel.lov = this.lov;
		fmulsel.params = this.params.cloneNode();
		return fmulsel;
	}


	//**************************//
	// CLASE FSEARCHER			//
	//**************************//
	function FSearcher(target, lov, resValueXpath, resTextXpath){

		this.type = "FSEARCHER";
		this.base = new Field(resValueXpath);

		this.resTextXpath = resTextXpath;
		this.lov = lov;
		this.lovWindow = null;

		this.params = new Params();
		this.params.put("lov", this.lov);
		this.affectTo = new Array();
		this.affectBy = new Array();
		this.affectByParam = new Array();
		this.paramsAffect = new Params();
		this.actionOnSelectOption = null;
		this.actionOnClickOption = null;

		this.value = "";

		this.create(target);
	}
	FSearcher.prototype.getObj = function (){return this.base.getObj();}
	FSearcher.prototype.addEvent = function(eventName, action){this.base.addEvent(eventName, action);}
	FSearcher.prototype.setWidth = function(width){this.base.setWidth(width);}
	FSearcher.prototype.setWidthPercent = function(width){this.base.setWidthPercent(width);}
	FSearcher.prototype.getType = function (){return this.type;}
	FSearcher.prototype.init = function(){this.setValue("", "");}
	FSearcher.prototype.getResXpath = function(){return this.base.getResXpath();}
	FSearcher.prototype.setResXpath = function(resXpath){this.base.setResXpath(resXpath);}
	FSearcher.prototype.getResTextXpath = function(){return this.resTextXpath;}
	FSearcher.prototype.setResTextXpath = function(resTextXpath){this.resTextXpath = resTextXpath;}
	FSearcher.prototype.getReqXpath = function(){return this.base.getReqXpath();}
	FSearcher.prototype.setReqXpath = function(reqXPath){this.base.setReqXpath(reqXPath);}
	FSearcher.prototype.putAffectTo = function(field){this.affectTo.push(field);}
	FSearcher.prototype.putAffectBy = function(field, name){this.affectBy.push(field);this.affectByParam.push(name);}
	FSearcher.prototype.addParam = function(name, value){this.params.putByName(name, value);}
	FSearcher.prototype.delParam = function(name){this.params.remByName(name);}
	FSearcher.prototype.getParams = function(){ return this.params; }
	FSearcher.prototype.getLov = function(){return this.lov;}
	FSearcher.prototype.setLov = function(lov){this.lov = lov; this.params.remByName("lov"); this.params.put("lov", this.lov);}
 	FSearcher.prototype.setLovWindow = function(lovWindow){this.lovWindow = lovWindow;}
	FSearcher.prototype.getText = function(){return this.getObj().value;}
	FSearcher.prototype.getValue = function(){return this.value;}
	FSearcher.prototype.setValue = function(value, text){
		this.value = value;
		this.getObj().value = text;
		if (text != null) this.getObj().title = text;
		this.setChanged(true);
		this.change();
		if (this.actionOnSelectOption != null) this.actionOnSelectOption();
	}
	FSearcher.prototype.getActionOnSelectOption = function (){return this.actionOnSelectOption;}
	FSearcher.prototype.setActionOnSelectOption = function (action){this.actionOnSelectOption = action;}
	FSearcher.prototype.getActionOnClickOption = function (){return this.actionOnClickOption;}
	FSearcher.prototype.setActionOnClickOption = function (action){this.actionOnClickOption = action;}
	FSearcher.prototype.change = function(){for(var i = 0; i < this.affectTo.length; i++){this.affectTo[i].changeAffectBy();}}
	FSearcher.prototype.changeAffectBy = function(){
		this.getObj().readOnly = true;
		this.paramsAffect = new Params();
		var noValue = false;
		for (var i = 0; i < this.affectBy.length; i++) {
			var field = this.affectByParam[i];
			var value = this.affectBy[i].getValue();
			if (value == "") noValue = true;
			this.paramsAffect.put(field, value);
		}
		if (noValue) this.setReadOnly(true);
		else this.setReadOnly(false);
		this.init();
		this.getObj().readOnly = true;
	}
	FSearcher.prototype.setValueXML = function(xmlDoc){
		var text = getNodeValue(xmlDoc, this.resTextXpath);
		var value = getNodeValue(xmlDoc, this.getResXpath());
		this.setValue(value, text);
	}
	FSearcher.prototype.addToXML = function(reqXMLDoc){addToXML(this, reqXMLDoc);}
	FSearcher.prototype.isEmpty = function(){return this.base.isEmpty();}
	FSearcher.prototype.checkMandatory = function(){return this.base.checkMandatory();}
	FSearcher.prototype.isMandatory = function(){return this.base.isMandatory();}
	FSearcher.prototype.setMandatory = function(mandatory){this.base.setMandatory(mandatory);}
	FSearcher.prototype.isReadOnly = function(){return this.base.isReadOnly();}
	FSearcher.prototype.setReadOnly = function(readOnly){this.base.setReadOnly(readOnly);}
	FSearcher.prototype.setChanged = function(changed){this.base.setChanged(changed);}
	FSearcher.prototype.isChanged = function(){return this.base.isChanged();}
	FSearcher.prototype.hide = function(){return this.base.hide();}
	FSearcher.prototype.show = function(){return this.base.show();}
	FSearcher.prototype.openLov = function(){
		var params = new Params();
		params.put("field", this);
		params.append(this.params);
		params.append(this.paramsAffect);
		if(this.lovWindow == null) getMngWindow().showWindow("COM_LOV", params);
		else getMngWindow().showWindow(this.lovWindow, params);
	}
	FSearcher.prototype.clickLov = function(){if (!this.base.isReadOnly()) this.openLov();}
	FSearcher.prototype.clickClear = function(){if (!this.base.isReadOnly()){ this.init(); 	if (this.actionOnSelectOption != null) this.actionOnSelectOption(); }}
	FSearcher.prototype.keyDown = function(e){if (getKeyCode(e) == KEY_ENTER) this.clickLov();}
	FSearcher.prototype.create = function(target){

		this.base.create(target);

		this.getObj().readOnly = true;
		this.getObj().style.cursor = "pointer";
		this.getObj().style.backgroundImage = "url('" + getResources() + "/images/shrZoom.png')";
		this.getObj().style.backgroundRepeat = "no-repeat";
		this.getObj().style.paddingRight = "18px";
		this.getObj().style.backgroundPosition = "right";

		var img = document.createElement("img");
		img.src = getResources() + "/images/shrClear.png";
		img.style.marginLeft = "5px";
		img.style.cursor = "pointer";
		img.searcher = this;

		this.base.setObjRight(img);

		this.getObj().fsearcher = this;

		addEvent(img, "onclick", "this.searcher.clickClear();");
		addEvent(this.getObj(), "onclick", "this.fsearcher.clickLov();");
		addEvent(this.getObj(), "onkeydown", "this.fsearcher.keyDown(event);");
	}
	FSearcher.prototype.cloneNode = function(target){
		var fsearcher = new FSearcher();
		fsearcher.base = this.base.cloneNode(target);
		fsearcher.base.obj.fsearcher = fsearcher;
		fsearcher.resTextXpath = this.resTextXpath;
		fsearcher.paramsAffect = this.paramsAffect.cloneNode();
		fsearcher.lov = this.lov;
		fsearcher.params = this.params.cloneNode();
		fsearcher.value = this.value;
		fsearcher.base.objRight.searcher = fsearcher;
		return fsearcher;
	}

	
	
	//**************************//
	// CLASE FLIST			//
	//**************************//
	function FList(target, lov, resValueXpath, resTextXpath, columnsNumber){

		this.type = "FLIST";
		this.base = new Field(resValueXpath);

		this.resTextXpath = resTextXpath;
		this.lov = lov;
		this.lovWindow = null;

		this.params = new Params();
		this.params.put("lov", this.lov);
		this.affectTo = new Array();
		this.affectBy = new Array();
		this.affectByParam = new Array();
		this.paramsAffect = new Params();
		this.actionOnSelectOption = null;
		this.actionOnClickOption = null;

		this.value = "";
		this.columnsNumber = (columnsNumber != null)?columnsNumber:4;

		this.create(target);
	}
	FList.prototype.getObj = function (){return this.base.getObj();}
	FList.prototype.addEvent = function(eventName, action){this.base.addEvent(eventName, action);}
	FList.prototype.setWidth = function(width){this.base.setWidth(width);}
	FList.prototype.setWidthPercent = function(width){this.base.setWidthPercent(width);}
	FList.prototype.getType = function (){return this.type;}
	FList.prototype.getColumnsNumber = function (){return this.columnsNumber;}
	FList.prototype.setColumnsNumber = function (columnsNumber){this.columnsNumber = columnsNumber;}
	FList.prototype.init = function(){this.setValue("", "");}
	FList.prototype.getResXpath = function(){return this.base.getResXpath();}
	FList.prototype.setResXpath = function(resXpath){this.base.setResXpath(resXpath);}
	FList.prototype.getResTextXpath = function(){return this.resTextXpath;}
	FList.prototype.setResTextXpath = function(resTextXpath){this.resTextXpath = resTextXpath;}
	FList.prototype.getReqXpath = function(){return this.base.getReqXpath();}
	FList.prototype.setReqXpath = function(reqXPath){this.base.setReqXpath(reqXPath);}
	FList.prototype.putAffectTo = function(field){this.affectTo.push(field);}
	FList.prototype.putAffectBy = function(field, name){this.affectBy.push(field);this.affectByParam.push(name);}
	FList.prototype.addParam = function(name, value){this.params.putByName(name, value);}
	FList.prototype.delParam = function(name){this.params.remByName(name);}
	FList.prototype.getParams = function(){ return this.params; }
	FList.prototype.getLov = function(){return this.lov;}
	FList.prototype.setLov = function(lov){this.lov = lov; this.params.remByName("lov"); this.params.put("lov", this.lov);}
 	FList.prototype.setLovWindow = function(lovWindow){this.lovWindow = lovWindow;}
	FList.prototype.getText = function(){return this.getObj().value;}
	FList.prototype.getValue = function(){return this.value;}
	FList.prototype.setValue = function(value, text){
		this.value = value;
		this.getObj().value = text;
		if (text != null) this.getObj().title = text;
		this.setChanged(true);
		this.change();
		if (this.actionOnSelectOption != null) this.actionOnSelectOption();
	}
	FList.prototype.getActionOnSelectOption = function (){return this.actionOnSelectOption;}
	FList.prototype.setActionOnSelectOption = function (action){this.actionOnSelectOption = action;}
	FList.prototype.getActionOnClickOption = function (){return this.actionOnClickOption;}
	FList.prototype.setActionOnClickOption = function (action){this.actionOnClickOption = action;}
	FList.prototype.change = function(){for(var i = 0; i < this.affectTo.length; i++){this.affectTo[i].changeAffectBy();}}
	FList.prototype.changeAffectBy = function(){
		this.paramsAffect = new Params();
		var noValue = false;
		for (var i = 0; i < this.affectBy.length; i++) {
			var field = this.affectByParam[i];
			var value = this.affectBy[i].getValue();
			if (value == "") noValue = true;
			this.paramsAffect.put(field, value);
		}
		if (noValue) this.setReadOnly(true);
		else this.setReadOnly(false);
		this.init();
	}
	FList.prototype.setValueXML = function(xmlDoc){
		var text = getNodeValue(xmlDoc, this.resTextXpath);
		var value = getNodeValue(xmlDoc, this.getResXpath());
		this.setValue(value, text);
	}
	FList.prototype.addToXML = function(reqXMLDoc){addToXML(this, reqXMLDoc);}
	FList.prototype.isEmpty = function(){return this.base.isEmpty();}
	FList.prototype.checkMandatory = function(){return this.base.checkMandatory();}
	FList.prototype.isMandatory = function(){return this.base.isMandatory();}
	FList.prototype.setMandatory = function(mandatory){this.base.setMandatory(mandatory);}
	FList.prototype.isReadOnly = function(){return this.base.isReadOnly();}
	FList.prototype.setReadOnly = function(readOnly){this.base.setReadOnly(readOnly);}
	FList.prototype.setChanged = function(changed){this.base.setChanged(changed);}
	FList.prototype.isChanged = function(){return this.base.isChanged();}
	FList.prototype.hide = function(){return this.base.hide();}
	FList.prototype.show = function(){return this.base.show();}
	FList.prototype.openLov = function(){
		var params = new Params();
		params.put("field", this);
		params.append(this.params);
		params.append(this.paramsAffect);
		if(this.lovWindow == null) getMngWindow().showWindow("COM_LIST", params);
		else getMngWindow().showWindow(this.lovWindow, params);
	}
	FList.prototype.clickLov = function(){if (!this.base.isReadOnly()) this.openLov();}
	FList.prototype.clickClear = function(){if (!this.base.isReadOnly()){ this.init(); 	if (this.actionOnSelectOption != null) this.actionOnSelectOption(); }}
	FList.prototype.keyDown = function(e){if (getKeyCode(e) == KEY_ENTER) this.clickLov();}
	FList.prototype.create = function(target){

		this.base.create(target);

		this.getObj().readOnly = true;
		this.getObj().style.cursor = "pointer";
		this.getObj().style.backgroundImage = "url('" + getResources() + "/images/shrZoom.png')";
		this.getObj().style.backgroundRepeat = "no-repeat";
		this.getObj().style.paddingRight = "18px";
		this.getObj().style.backgroundPosition = "right";

		var img = document.createElement("img");
		img.src = getResources() + "/images/shrClear.png";
		img.style.marginLeft = "5px";
		img.style.cursor = "pointer";
		img.list = this;

		this.base.setObjRight(img);

		this.getObj().flist = this;

		addEvent(img, "onclick", "this.list.clickClear();");
		addEvent(this.getObj(), "onclick", "this.flist.clickLov();");
		addEvent(this.getObj(), "onkeydown", "this.flist.keyDown(event);");
	}
	FList.prototype.cloneNode = function(target){
		var flist = new FList();
		flist.base = this.base.cloneNode(target);
		flist.base.obj.flist = flist;
		flist.resTextXpath = this.resTextXpath;
		flist.paramsAffect = this.paramsAffect.cloneNode();
		flist.lov = this.lov;
		flist.params = this.params.cloneNode();
		flist.value = this.value;
		flist.base.objRight.list = flist;
		return flist;
	}

	//**************************//
	// CLASE OVERDIV			//
	//**************************//
	function OverDiv(target, html, width) {
		this.DEFAULT_WIDTH = 150;
		this.obj = document.createElement("div");
		this.obj.className = "info";
		this.obj.style.position = "absolute";
		this.obj.style.marginTop = "5px";
		//this.setWidth(width);
		this.hide();
		this.setTarget(target);
		this.setValue(html);
	}
	OverDiv.prototype.setTarget = function(target){
		if (target != null) {
			target.objOverDiv = this;
			insertAfter(this.obj, target);
			addEvent(target, "onmouseover", "this.objOverDiv.show();");
			addEvent(target, "onmouseout", "this.objOverDiv.hide();");
		}
	}
	OverDiv.prototype.setValue = function(html){if (html != null) this.obj.innerHTML = html;}
	OverDiv.prototype.setWidth = function(width){
		var w = (width != null) ? width : this.DEFAULT_WIDTH;
		this.obj.style.width = w + "px";
	}
	OverDiv.prototype.show = function(){this.obj.style.display = "";}
	OverDiv.prototype.hide = function(){this.obj.style.display = "none";}

	function addEvent(obj, eventName, code) {
		if (isIE) {
			var mifunction = function(event) {
				try {
					var objsrc = (event.srcElement) ? event.srcElement : event.target;
					code = code.replace(/this/i, "objsrc");
					eval(code);
				} catch(ex) {}
			}
			obj.attachEvent(eventName, mifunction);
		} else {
			var antCode = obj.getAttribute(eventName);
			var newCode = (antCode != null) ? antCode + code : code;
			obj.setAttribute(eventName, newCode);
		}
	}

	//**************************//
	// CLASE TOOLBAR			//
	//**************************//
	function ToolBar(target){

		this.buttons = new Array();
		this.contButtons = new Array();

		this.texts = new Array();
		this.alts = new Array();
		this.actions = new Array();

		this.objContent = null;

		this.create(target);
	}
	ToolBar.prototype.create = function(target){

		var table = document.createElement("table");
		table.className = "toolbar";
		table.cellPadding = "0px";

		var tbody = document.createElement("tbody");
		table.appendChild(tbody);

		var tr = document.createElement("tr");
		this.objContent = tr;
		tbody.appendChild(tr);

		target.appendChild(table);

	}
	ToolBar.prototype.addButton = function(idButton, button, display){

		var td = document.createElement("td");
		td.style.paddingRight = "4px";
		if (display != null) td.style.display = ((display)? "" : "none");
		this.objContent.appendChild(td);

		button.setTarget(td);

		this.buttons[idButton] = button;
		this.texts[idButton] = button.getText();
		this.alts[idButton] = button.getAlt();
		this.actions[idButton] = button.getAction();
		this.contButtons[idButton] = td;

	}
	ToolBar.prototype.hideButton = function(idButton){
		if(this.contButtons[idButton] != null)	this.contButtons[idButton].style.display = "none";
	}
	ToolBar.prototype.showButton = function(idButton){
		if(this.contButtons[idButton] != null){
			this.contButtons[idButton].style.display = "";
			this.buttons[idButton].show();
		}
	}
	ToolBar.prototype.showButtons = function(aButtons){
		for(var i = 0; i < aButtons.length; i++){
			this.contButtons[aButtons[i]].style.display = "";
			this.buttons[aButtons[i]].show();
		}
	}
	ToolBar.prototype.getButton = function(idButton){return this.buttons[idButton];}
	ToolBar.prototype.init = function(){

		for(var i in this.buttons){
			if (this.buttons[i] != null) this.buttons[i].hide();
			this.contButtons[i].style.display = "none";
			this.buttons[i].setText(this.texts[i]);
			this.buttons[i].setAction(this.actions[i]);
			this.buttons[i].setAlt(this.alts[i]);
		}
	}
	ToolBar.prototype.setReadOnly = function(readonly){
		for(var i in this.buttons) this.buttons[i].setEnable(!readonly);
	}
	ToolBar.prototype.hide = function(){ if (this.target != null) this.target.style.display = "none"; }
	ToolBar.prototype.show = function(){ if (this.target != null) this.target.style.display = ""; }

	
	//**************************//
	// CLASE TOOLBAR2			//
	//**************************//
	function ToolBar2(target){

		this.buttons = new Array();
		this.contButtons = new Array();

		this.texts = new Array();
		this.alts = new Array();
		this.actions = new Array();

		this.objContent = null;

		this.create(target);
	}
	ToolBar2.prototype.create = function(target){
		this.objContent = target;
	}
	ToolBar2.prototype.addButton = function(idButton, button, display){

		var li = document.createElement("li");
		if (display != null) li.style.display = ((display)? "" : "none");
		this.objContent.appendChild(li);

		button.setTarget(li);

		this.buttons[idButton] = button;
		this.texts[idButton] = button.getText();
		this.alts[idButton] = button.getAlt();
		this.actions[idButton] = button.getAction();
		this.contButtons[idButton] = li;

	}
	ToolBar2.prototype.hideButton = function(idButton){
		if(this.contButtons[idButton] != null)	this.contButtons[idButton].style.display = "none";
	}
	ToolBar2.prototype.showButton = function(idButton){
		if(this.contButtons[idButton] != null){
			this.contButtons[idButton].style.display = "";
			this.buttons[idButton].show();
		}
	}
	ToolBar2.prototype.showButtons = function(aButtons){
		for(var i = 0; i < aButtons.length; i++){
			this.contButtons[aButtons[i]].style.display = "";
			this.buttons[aButtons[i]].show();
		}
	}
	ToolBar2.prototype.getButton = function(idButton){return this.buttons[idButton];}
	ToolBar2.prototype.init = function(){

		for(var i in this.buttons){
			if (this.buttons[i] != null) this.buttons[i].hide();
			this.contButtons[i].style.display = "none";
			this.buttons[i].setText(this.texts[i]);
			this.buttons[i].setAction(this.actions[i]);
			this.buttons[i].setAlt(this.alts[i]);
		}
	}
	ToolBar2.prototype.setReadOnly = function(readonly){
		for(var i in this.buttons) this.buttons[i].setEnable(!readonly);
	}
	ToolBar2.prototype.hide = function(){ if (this.target != null) this.target.style.display = "none"; }
	ToolBar2.prototype.show = function(){ if (this.target != null) this.target.style.display = ""; }
	
	
	
	//**************************//
	// CLASE BUTTON				//
	//**************************//
	function Button(target, text, urlImg, alt, action, isHide){

		this.type = "FBUTTON";

		this.text = text;
		this.urlImg = urlImg;
		this.alt = alt;
		this.action = action;

		this.objButton = null;
		this.objText = null;
		this.objImage = null;
		this.param = null;

		this.enable = true;
		this.isHide = (isHide == null) ? false : isHide;

		this.create(target);
	}
	Button.prototype.getType = function(){return this.type;}
	Button.prototype.getIsHide = function(){return this.isHide;}
	Button.prototype.create = function(target){

		if (isIE) {
			this.objButton = document.createElement("<button type=\"button\" />");
		} else {
			this.objButton = document.createElement("button");
			this.objButton.type = "button";
		}
		this.objButton.style.margin = (isIE? "1px":"0px");			
		this.objButton.style.padding = "0px";			

		var button = this;
		this.objButton.onclick = function () {button.click();}
		this.objButton.onmouseover = function () {button.refreshStyles(true);}
		this.objButton.onmouseout = function () {button.refreshStyles(false);}

		var table = document.createElement("table");
		table.border = 0;
		table.cellPadding = 0;
		table.cellSpacing = 0;
		table.style.borderSpacing = 0;
		this.objButton.appendChild(table);

		var tbody = document.createElement("tbody");
		table.appendChild(tbody);

		var tr = document.createElement("tr");
		tbody.appendChild(tr);

		this.objCenter = document.createElement("td");
		this.objCenter.style.margin = "0px";
		this.objCenter.style.padding = "0px";
		tr.appendChild(this.objCenter);

		if (this.text != null) {
			this.objText = document.createElement("span");
			this.objText.style.margin = "0px";			
			this.objText.style.padding = "2px";			
			this.objCenter.appendChild(this.objText);
		}

		if (this.urlImg != null) {
			this.objImage = document.createElement("img");
			this.objImage.style.verticalAlign = "middle";
			this.objImage.style.margin = "1px";
			this.objImage.style.padding = "0px";			
			if (this.text != null) this.objImage.style.marginLeft = "2px";
			this.objCenter.appendChild(this.objImage);
		}

		this.setText(this.text);
		this.setImg(this.urlImg);

		this.setTarget(target);
		this.setAlt(this.alt);
	}
	Button.prototype.setTarget = function(target) {if (target != null) target.appendChild(this.objButton);}
	Button.prototype.getText = function(){return this.text;}
	Button.prototype.getAlt = function(){return this.alt;}
	Button.prototype.getImg = function(){return this.urlImg;}
	Button.prototype.getAction = function(){return this.action;}
	Button.prototype.getObj = function(){return this.objButton;}
	Button.prototype.setText = function(text){
		if (this.objText == null) return;
		this.text = text;
		this.objText.innerHTML = (this.text != null) ? this.text : "";
		this.refreshStyles();
	}
	Button.prototype.setImg = function(urlImg) {
		if (!this.isHide) {
			if (this.objImage == null) return;
			this.urlImg = urlImg;
			this.objImage.src = this.urlImg;
			this.refreshStyles();
		}
	}
	Button.prototype.setAlt = function(alt){
		this.alt = alt;
		this.objButton.title = ((this.alt != null)? this.alt : "");
	}
	Button.prototype.setAction = function(action){this.action = action;}
	Button.prototype.setEnable = function(enable){
		this.enable = enable;
		this.objButton.disabled = !this.enable;
		this.refreshStyles(false);
	}
	Button.prototype.setVisible = function(visible){
		this.objButton.style.visibility = (visible? "visible" : "hidden");
		this.refreshStyles(false);
	}	
	Button.prototype.setParam = function(param){this.param = param;}
	Button.prototype.click = function(){
		if (this.enable && (getTop().nPetProcess == 0 || getTop().nPetProcess == null)) this.action(this.param);
	}
	Button.prototype.show = function() {
		if (this.isHide) {
			this.isHide = false;
			this.setImg(this.urlImg);
		}
		this.objButton.style.display = "";
	}
	Button.prototype.hide = function(){this.isHide = true; this.objButton.style.display = "none";}
	Button.prototype.refreshStyles = function(isFocus){
		if (!this.enable) this.objButton.className = "buttond";
		else if (isFocus) this.objButton.className = "buttonf";
		else this.objButton.className = "button";
	}
	Button.prototype.cloneNode = function(target){
		var fbutton = new Button(target, this.text, this.urlImg, this.alt, this.action);
		return fbutton;
	}
	Button.prototype.setWidth = function(width){if (width != null) this.objButton.style.width = width + "px";}
	Button.prototype.setWidthPercent = function(width){if (width != null) this.objButton.style.width = width + "%";}
	Button.prototype.setWidthTable = function(width){if (width != null) this.objButton.firstChild.style.width = width + "px";}
	Button.prototype.clearMode = function(){ this.objButton.style.backgroundColor = "transparent"; this.objButton.style.borderWidth = "0px";}
	
	
	//**************************//
	// CLASE BUTTON2			//
	//**************************//
	function Button2(target, text, urlImg, alt, action, isHide){

		this.type = "FBUTTON";

		this.text = text;
		this.urlImg = urlImg;
		this.alt = alt;
		this.action = action;

		this.objButton = null;
		this.objText = null;
		this.objImage = null;
		this.param = null;

		this.enable = true;
		this.isHide = (isHide == null) ? false : isHide;

		this.create(target);
	}
	Button2.prototype.getType = function(){return this.type;}
	Button2.prototype.getIsHide = function(){return this.isHide;}
	Button2.prototype.create = function(target){

		if (isIE) {
			this.objButton = document.createElement("<button type=\"button\" />");
		} else {
			this.objButton = document.createElement("button");
			this.objButton.type = "button";
		}
		this.objButton.style.margin = (isIE? "1px":"0px");			
		this.objButton.style.padding = "0px";			

		var button = this;
		this.objButton.onclick = function () {button.click();}
		this.objButton.onmouseover = function () {button.refreshStyles(true);}
		this.objButton.onmouseout = function () {button.refreshStyles(false);}

		if (this.text != null) {
			this.objText = document.createElement("span");
			this.objText.style.margin = "0px";			
			this.objText.style.padding = "2px";			
			this.objButton.appendChild(this.objText);
		}

		if (this.urlImg != null) {
			this.objImage = document.createElement("img");
			this.objImage.style.verticalAlign = "middle";
			this.objImage.style.margin = "1px";
			this.objImage.style.padding = "0px";			
			if (this.text != null) this.objImage.style.marginLeft = "2px";
			this.objButton.appendChild(this.objImage);
		}

		this.setText(this.text);
		this.setImg(this.urlImg);

		this.setTarget(target);
		this.setAlt(this.alt);
	}
	Button2.prototype.setTarget = function(target) {if (target != null) target.appendChild(this.objButton);}
	Button2.prototype.getText = function(){return this.text;}
	Button2.prototype.getAlt = function(){return this.alt;}
	Button2.prototype.getImg = function(){return this.urlImg;}
	Button2.prototype.getAction = function(){return this.action;}
	Button2.prototype.getObj = function(){return this.objButton;}
	Button2.prototype.setText = function(text){
		if (this.objText == null) return;
		this.text = text;
		this.objText.innerHTML = (this.text != null) ? this.text : "";
		this.refreshStyles();
	}
	Button2.prototype.setImg = function(urlImg) {
		if (!this.isHide) {
			if (this.objImage == null) return;
			this.urlImg = urlImg;
			this.objImage.src = this.urlImg;
			this.refreshStyles();
		}
	}
	Button2.prototype.setAlt = function(alt){
		this.alt = alt;
		this.objButton.title = ((this.alt != null)? this.alt : "");
	}
	Button2.prototype.setAction = function(action){this.action = action;}
	Button2.prototype.setEnable = function(enable){
		this.enable = enable;
		this.objButton.disabled = !this.enable;
		this.refreshStyles(false);
	}
	Button2.prototype.setVisible = function(visible){
		this.objButton.style.visibility = (visible? "visible" : "hidden");
		this.refreshStyles(false);
	}	
	Button2.prototype.setParam = function(param){this.param = param;}
	Button2.prototype.click = function(){
		if (this.enable && (getTop().nPetProcess == 0 || getTop().nPetProcess == null)) this.action(this.param);
	}
	Button2.prototype.show = function() {
		if (this.isHide) {
			this.isHide = false;
			this.setImg(this.urlImg);
		}
		this.objButton.style.display = "";
	}
	Button2.prototype.hide = function(){this.isHide = true; this.objButton.style.display = "none";}
	Button2.prototype.refreshStyles = function(isFocus){
		if (!this.enable) this.objButton.className = "buttond";
		else if (isFocus) this.objButton.className = "buttonf";
		else this.objButton.className = "button";
	}
	Button2.prototype.cloneNode = function(target){
		var fbutton = new Button2(target, this.text, this.urlImg, this.alt, this.action);
		return fbutton;
	}
	Button2.prototype.setWidth = function(width){if (width != null) this.objButton.style.width = width + "px";}
	Button2.prototype.setWidthPercent = function(width){if (width != null) this.objButton.style.width = width + "%";}
	Button2.prototype.setWidthTable = function(width){if (width != null) this.objButton.firstChild.style.width = width + "px";}
	
	