//============================================================================\\
//                Objeto XTag para acceder a los controles xTag               \\
//============================================================================\\
/**
 * Objeto XTagObject
 * Encapsula un div html y permite acceder al valor de los miembros:
 * Por ejemplo:
 * <div id='proyecto'>
 *		<input type='text' name='nombre' value='proyecto1'/>
 *		<select name='estado'>
 *			<option value='01'>En proceso</option>
 *			<option value='02' selected='true'>Finalizado</option>
 *		</select>
 * </div>
 * El script seria:
 * var oXTag = new XTagObject(document.all("proyecto"));
 * alert(oXTag.getMember("nombre"));	// Escribe "proyecto1"
 * oEstado = oXTag.getMember("estado");
 * alert(oEstado['codigo'] + ":" + oEstado['descripcion']);	// Escribe "02:Finalizado"
 */
// _______________________________________________________________________\\
function XTag(oNewDiv) {
	var oDiv;			// El div que contiene todo el objeto XTag
	var name;			// El nombre del objeto
	if (oNewDiv == null) {
		alert("p01forms.js: No se puede crear el objeto XTagObject ya que el div es nulo");
		return;
	}
	this.oDiv = oNewDiv;	// Establecer el div que encapsula el objeto y sus propiedades
	this.name = oNewDiv.id;	
	
	// Definicion de metodos de la clase
	this.getElement = XTag_getElement;				// Obtiene el valor de un control de un objeto XTag
	this.getElementTag = XTag_getElementTag;		// Obtiene el TAG (no el valor) de un control de un objeto XTag
	this.getElementList = XTag_getElementList;		// Obtiene una lista de objetos (div)
}
// _______________________________________________________________________\\
function XTag_getElement(sourceTag) {
	var oCtrl = this.oDiv.all(sourceTag);	// OJO!!! puede ser un array si hay dos controles con el mismo nombre	
	if (oCtrl == null) alert("p01forms.js: No existe el control origen " + sourceTag + " en el div xtag " + this.name);
	if (oCtrl.tagName == "INPUT") {				// Se trata de un tag input type='text'
		return oCtrl.value;
	} else if (oCtrl.tagName == "TEXTAREA") {	// Se trata de un tag TextArea
		return oCtrl.value;
	} else if (oCtrl.tagName == "SELECT") {		// Se trata de un combo
	    for (var i=0; i < oCtrl.options.length; i++) {
	        if ( oCtrl.options[i].selected ) {
	        	var oArray = new Array();	// Array de dos posiciones con el codigo y el texto del combo
	        	oArray["codigo"] = oCtrl.options[i].value;
	        	oArray["descripcion"] = oCtrl.options[i].text;
	        	return oArray;
	        }
	    }
	    // No hay ningun elemento seleccionado
    	var oArray = new Array();	// Array de dos posiciones con el codigo y el texto del combo
    	oArray["codigo"] = "";
    	oArray["descripcion"] = "";
    	return oArray;
	} else if (oCtrl.tagName == "DIV") {	// Se trata de otro div (otro XTagObject)
		return oCtrl;
	}
}
// _______________________________________________________________________\\
function XTag_getElementTag(sourceTag) {
	var oCtrl = this.oDiv.all(sourceTag);
	if (oCtrl == null) alert("p01forms.js: No existe el control origen " + sourceTag + " en el div xtag " + this.name);
	return oCtrl;
}
// _______________________________________________________________________\\
function XTag_getElementList(objListID,objID) {
	var oListDiv = this.getElement(objListID);	// Obtener el padre
	if (oListDiv != null) {
		// Obtener la lista de elementos y discriminar solo los div	
		var arrayElements = oListDiv.all(objID);	// Lista con los hijos
		if (arrayElements == null) return null;
		var outArray = new Array();
		var j=0;
		if (arrayElements.length) {			
			// Es un array
			for (var i=0; i < arrayElements.length; i++) 
				if (arrayElements[i].tagName == "DIV") outArray[j++] = arrayElements[i];
		} else {
			// Solo habia un elemento
			if (arrayElements.tagName == "DIV") outArray[j] = arrayElements;
		}
		return outArray;
	}
}
// _______________________________________________________________________\\



//============================================================================\\
//                                Funciones genericas                         \\
//============================================================================\\
/**
 * Obtiene un objeto DIV a partir de su id
 * @param divName
 */
function getSectionById(divID) {
	var oDiv = null;
	if (ie6 || ns6) {
		oDiv = document.getElementById(divID);
	} else if (ie4) { 
		oDiv = document.all[divID];
	} else if (ns4) { 
		oDiv = document.layers[divID]; 
	}
    return oDiv
}
//___________________________________________________________________________\\
/**
 * Obtiene un objeto DIV padre del objeto que se pasa.
 * @param obj: El objeto hijo del div
 * @param divID: El id del objeto div padre
 */
function getParentSection(childObj,parentName) {
	var currObj = childObj;
    do {
        currObj = currObj.parentElement;	// Subir en la jerarquia
    } while (currObj != null && currObj.tagName != "BODY" && currObj.tagName != "DIV" && currObj.id != parentName);
    return currObj;
}
 
/**
 * Obtiene el valor de un elemento html que esta dentro de un div
 * @param section: El id del div que contiene el elemento
 * @param element: El nombre (name) del elemento dentro del div
 */
function gV(section,element) {
	if (section == null || section == "") return null;
	var oSection = null;
	if (typeof(section) == "string") { 
   		oSection = getSectionById(section);	// Objeto con la seccion
   	} else if (typeof(section) == "object") {
   		oSection = section;					// Ya se pasa el objeto seccion
   	} else {
   		alert("p01forms:gE(): La seccion no es valida");
   	}
    if (oSection.all(element) != null) {
        var str = oSection.all(element).value;
        if (str == "") return null;
        return str;
    } else {
        return null;
    }
}
//___________________________________________________________________________\\
/**
 * Obtiene un elemento html (no su valor) que esta dentro de un div
 * @param section: El id del div que contiene el elemento
 * @param element: El nombre (name) del elemento dentro del div
 */
function gE(section,element) {
	if (section == null || section == "") return null;
	var oSection = null;
	if (typeof(section) == "string") { 
   		oSection = getSectionById(section);	// Objeto con la seccion
   	} else if (typeof(section) == "object") {
   		oSection = section;					// Ya se pasa el objeto seccion
   	} else {
   		alert("p01forms:gE(): La seccion no es valida");
   	}
	if (arguments.length == 2) {	// Se pasa la seccion y elemento
		if (element == null || element == "") {
			return oSection;
		} else {
			return oSection.all(element);
		}
	} 
	return oSection;
}
//___________________________________________________________________________\\
/**
 * Obtiene el valor de un combo
 * @param section: El id del div que contiene el elemento
 * @param element: El nombre (name) del elemento dentro del div
 */
function getComboValue(section,element) {
    var objCmb = gE(section,element);
    for (var i=0; i < objCmb.options.length; i++)
        if ( objCmb.options[i].selected ) return objCmb.options[i].value;
    return null;    // No hay ningun elemento seleccionado
}
//___________________________________________________________________________\\
/**
 * Obtiene el texto de un combo
 * @param section: El id del div que contiene el elemento
 * @param element: El nombre (name) del elemento dentro del div
 */
function getComboText(section,element) {
    var objCmb = gE(section,element);
    for (var i=0; i < objCmb.options.length; i++)
        if ( objCmb.options[i].selected ) return objCmb.options[i].text;
    return null;    // No hay ningun elemento seleccionado
}
//___________________________________________________________________________\\
/**
 * Obtiene el option html seleccionado en un combo
 * @param section: El id del div que contiene el elemento
 * @param element: El nombre (name) del elemento dentro del div
 */
function getComboOption(section,element) {
    var objCmb = gE(section,element);
    for (var i=0; i < objCmb.options.length; i++)
        if ( objCmb.options[i].selected ) return objCmb.options[i];
    return null;    // No hay ningun elemento seleccionado
}
//___________________________________________________________________________\\
/**
 * Obtiene un array con las options html seleccionadas en un combo de
 * seleccion multiple
 * @param section: El id del div que contiene el elemento
 * @param element: El nombre (name) del elemento dentro del div
 */
function getListOptions(section,element) {
    var selBox = gE(section,element);
    if (selBox == null) return null;
    if (selBox.options.length == 0) return null;

    var optionsList = new Array();
    for (var i=0; i < selBox.options.length; i++) {
        if (selBox.options[i].selected) optionsList[optionsList.length] = selBox.options[i];
    }
    if (optionsList.length == 0) return null;
    return optionsList;
}
//___________________________________________________________________________\\












//============================================================================\\
//                         COMPROBAR FORMULARIOS                              \\
//      Funciones genericas de validacion de tipos de datos, fechas, etc      \\
//============================================================================\\
//___________________________________________________________________________\\
// Constantes.........
var DECIMALPOINTDELIMITER = "." ;
var WHITESPACE = " \t\n\r";


//___________________________________________________________________________\\
// Función que comprueba si una cadena es vacia
function isEmpty(s) { 
    return ((s == null) || (s.length == 0))
}
//___________________________________________________________________________\\
// Devuelve true si c está ente a..z ó A..Z
function isLetter (c) { 
    return ( ((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z")) )
}
//___________________________________________________________________________\\
// Devuelve true si c está ente 0..9
function isDigit (c) {
    return ((c >= "0") && (c <= "9"))
}
//___________________________________________________________________________\\
// Devuelve si el numero es entero
function isInteger (s) {
    var i;

    if (isEmpty(s)) {
       if (isInteger.arguments.length == 1) return false;
    } else {
        return (isInteger.arguments[1] == true);
    }
    // Escanear los caracteres hasta encontrar uno que no sea no numerico.
    for (i = 0; i < s.length; i++) {   
        var c = s.charAt(i);
        if (!isDigit(c)) return false;
    }
    return true;
}
//___________________________________________________________________________\\
// Compueba si s es un número real. 
function isFloat (s) {   
    var i;
    var seenDecimalPoint = false;

    if (isEmpty(s)) {
        if (isFloat.arguments.length == 1) {
            return false;
        } else {
            return (isFloat.arguments[1] == true);
        }
    }

    if (s == DECIMALPOINTDELIMITER) return false;

    // Escanear los caracteres hasta encontrar uno no numerico
    for (i = 0; i < s.length; i++) {   
        var c = s.charAt(i);

        if ((c == DECIMALPOINTDELIMITER) && !seenDecimalPoint) {
            seenDecimalPoint = true;
        } else if (!isDigit(c)) {
            return false;
        }
    }
    return true;		// Todos los caracteres son números
}
//___________________________________________________________________________\\
// Ver si 
function isWhitespace (s) {
    var i;
    
    if (isEmpty(s)) return true;
    // Escanear los caracteres para encontrar whitespaces
    for (i = 0; i < s.length; i++) {   
        var c = s.charAt(i);
        if (WHITESPACE.indexOf(c) == -1) return false;
    }
    return true;	// All characters are whitespace.
}
//___________________________________________________________________________\\
function isEmail (s) { 
	if (isEmpty(s)) 
	if (isEmail.arguments.length == 1) {
		return false;
	} else {
		return (isEmail.arguments[1] == true);
	}
    if (isWhitespace(s)) return false;

    // Tiene que haber al menos un caracter antes de la arroba
    // por lo tanto se empieza a mirar en la posición 1
    var i = 1;
    var sLength = s.length;
    
    // Buscar la arroba @
    while ((i < sLength) && (s.charAt(i) != "@")) i++;
    if ((i >= sLength) || (s.charAt(i) != "@")) {
        return false;
    } else {
        i += 2;
    }
    // Buscar el . separador de dominios
    while ((i < sLength) && (s.charAt(i) != ".")) i++;
    // Tiene que haber al menos un caracter después del .
    if ((i >= sLength - 1) || (s.charAt(i) != ".")) {
        return false;
    } else {
        return true;
    }
}
 
// ===================================================================
// 	FUNCIONES PARA MANEJAR FECHAS:
//		*Convertir fechas a diferentes formatos.
//		*Comparar fechas.
//		*Presentar en diferentes forematos		
// ===================================================================


// ----------------------------------------------------------
// Estas funciones utilizan las mismas cadenas de formato que 
// las de la clase java.text.SimpleDateFormat:
// 
// Field        | Full Form          | Short Form
// -------------+--------------------+-----------------------
// Year         | yyyy (4 digits)    | yy (2 digits), y (2 or 4 digits)
// Month        | MMM (name or abbr.)| MM (2 digits), M (1 or 2 digits)
// Day of Month | dd (2 digits)      | d (1 or 2 digits)
// Hour (1-12)  | hh (2 digits)      | h (1 or 2 digits)
// Hour (0-23)  | HH (2 digits)      | H (1 or 2 digits)
// Hour (0-11)  | KK (2 digits)      | K (1 or 2 digits)
// Hour (1-24)  | kk (2 digits)      | k (1 or 2 digits)
// Minute       | mm (2 digits)      | m (1 or 2 digits)
// Second       | ss (2 digits)      | s (1 or 2 digits)
// AM/PM        | a                  |
//
// OJO!! Mes = MM NO mm!!!!!
// Examples:
//  "MMM d, y" matches: January 01, 2000
//                      Dec 1, 1900
//                      Nov 20, 00
//  "M/d/yy"   matches: 01/20/00
//                      9/2/00
//  "MMM dd, yyyy hh:mm:ssa" matches: "January 01, 2000 12:30:45AM"
// ------------------------------------------------------------------

var MONTH_NAMES = new Array('January','February','March','April','May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');

function LZ(x) {return(x<0||x>9?"":"0")+x}
function _isInteger(val) {
	var digits="1234567890";
	for (var i=0; i < val.length; i++) {
		if (digits.indexOf(val.charAt(i))==-1) { return false; }
	}
	return true;
}
function _getInt(str,i,minlength,maxlength) {
	for (var x=maxlength; x>=minlength; x--) {
		var token=str.substring(i,i+x);
		if (token.length < minlength) { return null; }
		if (_isInteger(token)) { return token; }
	}
	return null;
}

/** Devuelve true si la fecha es en formato /dia/mes/año. */
function esFechaValida(inDate) {
	return (isDate(val,"dd/MM/yyyy") || isDate(val,"dd/MM/yy"));
}

// ------------------------------------------------------------------
// isDate ( date_string, format_string )
// Devuelve true si la cadena con la fecha tiene el formato indicado
// y es una fecha valida
// Es recomendable eliminar (trim) los espacios en blanco antes de llamar
// a esta funcion
// ------------------------------------------------------------------
function isDate(val,format) {
	var date = getDateFromFormat(val,format);
	if (date==0) return false;
	return true;
}

// -------------------------------------------------------------------
// compareDates(date1,date1format,date2,date2format)
// Compara dos fechas para ver cual es mayor
// Returns:
//   1 if date1 is greater than date2
//   0 if date2 is greater than date1 of if they are the same
//  -1 if either of the dates is in an invalid format
// -------------------------------------------------------------------
function compareDates(date1,dateformat1,date2,dateformat2) {
	var d1=getDateFromFormat(date1,dateformat1);
	var d2=getDateFromFormat(date2,dateformat2);
	if (d1==0 || d2==0) {
		return -1;
	} else if (d1 > d2) {
		return 1;
	}
	return 0;
}

// ------------------------------------------------------------------
// formatDate (date_object, format)
// Devuelve una fecha en el formato de salida especificado
// La cadena de formato utiliza las misma abreviaturas que getDateFromFormat()
// ------------------------------------------------------------------
function formatDate(date,format) {
	format=format+"";
	var result="";
	var i_format=0;
	var c="";
	var token="";
	var y=date.getYear()+"";
	var M=date.getMonth()+1;
	var d=date.getDate();
	var H=date.getHours();
	var m=date.getMinutes();
	var s=date.getSeconds();
	var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k;
	// Convert real date parts into formatted versions
	var value=new Object();
	if (y.length < 4) {y=""+(y-0+1900);}
	value["y"]=""+y;
	value["yyyy"]=y;
	value["yy"]=y.substring(2,4);
	value["M"]=M;
	value["MM"]=LZ(M);
	value["MMM"]=MONTH_NAMES[M-1];
	value["d"]=d;
	value["dd"]=LZ(d);
	value["H"]=H;
	value["HH"]=LZ(H);
	if (H==0) {
		value["h"]=12;
	} else if (H>12) {
		value["h"]=H-12;
	} else {
		value["h"]=H;
	}
	value["hh"]=LZ(value["h"]);
	if (H>11) {
		value["K"]=H-12;
	} else {
		value["K"]=H;
	}
	value["k"]=H+1;
	value["KK"]=LZ(value["K"]);
	value["kk"]=LZ(value["k"]);
	if (H > 11) { 
		value["a"]="PM";
	} else { 
		value["a"]="AM"; 
	}
	value["m"]=m;
	value["mm"]=LZ(m);
	value["s"]=s;
	value["ss"]=LZ(s);
	while (i_format < format.length) {
		c=format.charAt(i_format);
		token="";
		while ((format.charAt(i_format)==c) && (i_format < format.length)) {
			token += format.charAt(i_format++);
		}
		if (value[token] != null) {
			result=result + value[token];
		} else { 
			result=result + token; 
		}
	}
	return result;
}
	
// ------------------------------------------------------------------
// getDateFromFormat( date_string , format_string )
//
// Comprueba si la fecha tiene el formato especificado y devuelve
// el resultado de getTime(). Si el formato no es valido devuelve 0
// ------------------------------------------------------------------
function getDateFromFormat(val,format) {
	val=val+"";
	format=format+"";
	var i_val=0;
	var i_format=0;
	var c="";
	var token="";
	var token2="";
	var x,y;
	var now=new Date();
	var year=now.getYear();
	var month=now.getMonth()+1;
	var date=now.getDate();
	var hh=now.getHours();
	var mm=now.getMinutes();
	var ss=now.getSeconds();
	var ampm="";
	
	while (i_format < format.length) {
		// Get next token from format string
		c=format.charAt(i_format);
		token="";
		while ((format.charAt(i_format)==c) && (i_format < format.length)) {
			token += format.charAt(i_format++);
		}
		// Extract contents of value based on format token
		if (token=="yyyy" || token=="yy" || token=="y") {
			if (token=="yyyy") { x=4;y=4; }
			if (token=="yy")   { x=2;y=2; }
			if (token=="y")    { x=2;y=4; }
			year=_getInt(val,i_val,x,y);
			if (year==null) { return 0; }
			i_val += year.length;
			if (year.length==2) {
				if (year > 70) { 
					year=1900+(year-0); 
				} else { 
					year=2000+(year-0); 
				}
			}
		} else if (token=="MMM") {
			month=0;
			for (var i=0; i<MONTH_NAMES.length; i++) {
				var month_name=MONTH_NAMES[i];
				if (val.substring(i_val,i_val+month_name.length).toLowerCase()==month_name.toLowerCase()) {
					month=i+1;
					if (month>12) { month -= 12; }
					i_val += month_name.length;
					break;
				}
			}
			if ((month < 1)||(month>12)) { return 0; }
		} else if (token=="MM"||token=="M") {
			month=_getInt(val,i_val,token.length,2);
			if(month==null||(month<1)||(month>12)) { return 0; }
			i_val+=month.length;
		} else if (token=="dd"||token=="d") {
			date=_getInt(val,i_val,token.length,2);
			if(date==null||(date<1)||(date>31)) { return 0; }
			i_val+=date.length;
		} else if (token=="hh"||token=="h") {
			hh=_getInt(val,i_val,token.length,2);
			if(hh==null||(hh<1)||(hh>12)) { return 0; }
			i_val+=hh.length;
		} else if (token=="HH"||token=="H") {
			hh=_getInt(val,i_val,token.length,2);
			if(hh==null||(hh<0)||(hh>23)) { return 0; }
			i_val+=hh.length;
		} else if (token=="KK"||token=="K") {
			hh=_getInt(val,i_val,token.length,2);
			if(hh==null||(hh<0)||(hh>11)) { return 0; }
			i_val+=hh.length;
		} else if (token=="kk"||token=="k") {
			hh=_getInt(val,i_val,token.length,2);
			if(hh==null||(hh<1)||(hh>24)) { return 0; }
			i_val+=hh.length;hh--;
		} else if (token=="mm"||token=="m") {
			mm=_getInt(val,i_val,token.length,2);
			if(mm==null||(mm<0)||(mm>59)) { return 0; }
			i_val+=mm.length;
		} else if (token=="ss"||token=="s") {
			ss=_getInt(val,i_val,token.length,2);
			if(ss==null||(ss<0)||(ss>59)) { return 0; }
			i_val+=ss.length;
		} else if (token=="a") {
			if (val.substring(i_val,i_val+2).toLowerCase()=="am") { 
				ampm="AM"; 
			} else if (val.substring(i_val,i_val+2).toLowerCase()=="pm") { 
				ampm="PM"; 
			} else { 
				return 0; 
			}
			i_val+=2;
		} else {
			if (val.substring(i_val,i_val+token.length)!=token) {
				return 0;
			} else {
				i_val+=token.length;
			}
		}
	}
	// If there are any trailing characters left in the value, it doesn't match
	if (i_val != val.length) { return 0; }
	// Is date valid for month?
	if (month==2) {
		// Check for leap year
		if ( ( (year%4==0)&&(year%100 != 0) ) || (year%400==0) ) { // leap year
			if (date > 29) { return false; }
		} else { 
			if (date > 28) { return false; }
		}
	}
	if ((month==4)||(month==6)||(month==9)||(month==11)) {
		if (date > 30) { return false; }
	}
	// Correct hours value
	if (hh<12 && ampm=="PM") { 
		hh+=12;
	} else if (hh>11 && ampm=="AM") {
		hh-=12;
	}
	var newdate=new Date(year,month-1,date,hh,mm,ss);
	return newdate.getTime();
}
//___________________________________________________________________________\\
//Comprueba que s es tipo periodo y ademas , si es del tipo x-z compueba que
// que x>2000 & z<2030
function isPeriodoValido (s){
    var arrayPeriodo;
    if ( isPeriodo(s)){
     arrayPeriodo=s.split("-");
     if ( isInteger(arrayPeriodo[1]) ){
      if (arrayPeriodo[0] < arrayPeriodo[1]){
         if ((arrayPeriodo[0] < 2030)&&(arrayPeriodo[0] > 2000)){
             if ((arrayPeriodo[1] < 2030)&&(arrayPeriodo[1] > 2000)){
                return true;
             }return false;
          }else return false; 
     } else return false;
    } else { if ((arrayPeriodo[0] < 2030)&&(arrayPeriodo[0] > 2000)) return true;
           else return false;
      }
   } else return false;
}
//___________________________________________________________________________\\
//Comprueba si s es del formato numero-numero
function isPeriodo (s) {
  var i;
  var guion="-";
  var  encontradoGuion=false;
  if (isEmpty(s)) 
        if (isPeriodo.arguments.length == 1) {
            return false;
        } else {
            return (isPeriodo.arguments[1] == true);
        }

   if (s == guion) return false;

   for (i = 0; i < s.length; i++) {   
        // Check that current character is number.
        var c = s.charAt(i);

        if ((c == guion) && !encontradoGuion) {
            encontradoGuion = true;
        } else if (!isDigit(c)) {
            return false;
        }
    }

    // All characters are numbers.
    return true;
}





//============================================================================\\
//                Clases para el manejo de Reglas Rotas                    \\
//============================================================================\\
var EU = 1;
var CA = 0;

/** Clase BrokenRules */
function BrokenRules() {
// Atributos:
    var itemArray;		// Array con las reglas rotas
    this.itemArray = new Array();

// Métodos:
    this.isNull = BrokenRules_isNull; 
    this.getLength = BrokenRules_getLength; 
    this.getElementAt = BrokenRules_getElementAt;
    this.addElement = BrokenRules_addElement;
    this.removeElement = BrokenRules_removeElement;  
    this.getHTML = BrokenRules_getHTML;
}
//___________________________________________________________________________\\
function BrokenRules_getLength() {
    return this.itemArray.length;
}
function BrokenRules_getElementAt(pos) { 
    return this.itemArray[pos];
}
function BrokenRules_addElement(element) {
    this.itemArray[this.itemArray.length]=element;
}
function BrokenRules_isNull() {
    return ((this.itemArray == null)||(this.itemArray.length == 0));
}
function BrokenRules_removeElement(element) {
     var pos=0;
     var encontrado=false;
     var itemArrayNew = new Array(this.itemArray.length-1);
     for (i=0;i< this.itemArray.length;i++) {
         if ( this.itemArray[i]!= element ) {
             itemArrayNew[pos]=this.itemArray[i];
             pos++;    
         } else {
         	encontrado = true;
         }
     }
     if (encontrado == true) {
         this.itemArray=null;
         this.itemArray=itemArrayNew;
         return true;
     } else {
     	return false;
     }
}
function BrokenRules_getHTML() {
    var tablaErrores = "<table width=\"100%\" >"; 
    for (i=0;i<this.itemArray.length;i++) {
		tablaErrores += "<tr>";
		tablaErrores +=     "<td><b> Error</b></td>" ;
		tablaErrores +=     "<td></td>" ;
		tablaErrores += "</tr>";
		tablaErrores += "<tr>";
		tablaErrores +=     "<td>" + this.itemArray[i].getDescription(CA) + "</td>";
		tablaErrores +=     "<td>" + this.itemArray[i].getDescription(EU) + "</td>";
		tablaErrores += "</tr>";
    }
    tablaErrores += "</table>";
   
    return tablaErrores;   
 }
//___________________________________________________________________________\\
/** Clase BrokenRule */
function BrokenRule(inDescriptionCa,inDescriptionEu) {
//Atributos:
    this.descriptionCa = inDescriptionCa;
    this.descriptionEu = inDescriptionEu;
//Métodos:
    this.setDescription = BrokenRule_setDescription; 
    this.getDescription = BrokenRule_getDescription;
}
function BrokenRule_setDescription (idioma,description) {
	switch (idioma) {
		case EU: this.descriptionEu = description;
		case CA: this.descriptionCA = description;
	}
}  
function BrokenRule_getDescription (idioma) {
	switch (idioma) {
		case EU: return this.descriptionEu;
		case CA: return this.descriptionCa;
	}
}  




