	<!--
	// ==============================================================================
	// FUNCIONES EXPORTADAS
	// ==============================================================================
	// function FUNCIONES_AcortarFecha(strFECHA)
	// function resaltarItemMenu(src, color)
	// function normalItemMenu(src, blnForce, color)
	// function MarcarItemMenu(src)
	// function GotoURL(strURL, strParametros, destino)
	// function GotoURLVentanaCompleta(strURL, strParametros, destino)
	// function isEmailAddr(email)
	// function DoShowTooltip(layer, strCadena)
	// function VaciarListBox(control)
	// function QuitarValorListBox(Control)
	// function QuitarValorListBoxPorValor(Control, ID)
	// function AgregarValorListbox(control, ID, VALOR, blnPermitirRepeticion, blnAvisoDuplicado)
	// function DameControl(formulario, strNombreControl)
	// function FormatNumber(VALOR)
	// function damenumeroJScript(strNumero)
	// function round(num, dec, blnPuntosMil)
	// function puntosMil(cadena)
	// function replace(strCadena, strBuscada, strReemplazada)
	// function SeleccionPorValor(control, VALOR, ForceCheck)
	// function SeleccionPorValorV2(control, VALOR, ForceCheck)
	// function ObtenerObjetoPorValor(control, valor)
	// function SeleccionarTodo(control)
	// function SeleccionarNinguno(control)
	// function InvertirSeleccion(control)
	// function CancelarSeleccion(control)
	// function RetornaSeleccionados(control, separador)
	// function ContarSeleccionados(control)
	// function SeleccionAleatoria(control)
	// function AbrirVentana(strURL, strParametros, W, H)
	// function isEmailAddr(email)
	// function ObtenerTextoCombo(nombrecombo)

	// Copyright Best Business Service 2004.
	// Rev: 20021028
	// Add: 20021120
	// Add: 20021121
	// Add: 20021202
	// Add: 20040514

		function FUNCIONES_ResaltarBotonNaranja(strID, strPathDominio, blnEstadoTrueFalse)
		{
			if (blnEstadoTrueFalse)
			{
				document.getElementById("BTNLEFT" + strID.toString()).src= strPathDominio + "images/version7.1/botonnaranjaizquierda2.gif";
				document.getElementById("BTNCENTER" + strID.toString()).style.backgroundImage = "url('" + strPathDominio + "images/version7.1/botonnaranjacentro2.gif')";
				document.getElementById("BTNRIGHT" + strID.toString()).src= strPathDominio + "images/version7.1/botonnaranjaderecha2.gif";
			}
			else
			{
				document.getElementById("BTNLEFT" + strID.toString()).src= strPathDominio + "images/version7.1/botonnaranjaizquierda.gif";
				document.getElementById("BTNCENTER" + strID.toString()).style.backgroundImage = "url('" + strPathDominio + "images/version7.1/botonnaranjacentro.gif')";
				document.getElementById("BTNRIGHT" + strID.toString()).src= strPathDominio + "images/version7.1/botonnaranjaderecha.gif";
			}
		}


		function FUNCIONES_DateDiffDias(_FECHAINI, _FECHAFIN)
		{
			// The number of milliseconds in one day
			var ONE_DAY = 1000 * 60 * 60 * 24;

			// Convert both dates to milliseconds
			var date1_ms = _FECHAINI.getTime();
			var date2_ms = _FECHAFIN.getTime();

			// Calculate the difference in milliseconds
			var difference_ms = Math.abs(date1_ms - date2_ms);

			// Convert back to days and return
			return Math.round(difference_ms/ONE_DAY);
		}

		function FUNCIONES_FechaCMP2Object(FECHACMP)
		{
			_ano = Number(FECHACMP.substr(0,4));
			_mes = Number(FECHACMP.substr(4,2));
			_dia = Number(FECHACMP.substr(6,2));

			// Esto es porque Javascript los meses empiezan desde cero
			_mes = parseInt(_mes) - 1;		

			return(new Date(_ano,_mes,_dia));
		}

		function FUNCIONES_FechaObject2CMP(_objFecha)
		{
			_ano = _objFecha.getFullYear().toString();
			_mes = _objFecha.getMonth().toString();
			_dia = _objFecha.getDate().toString();

			// Esto es porque Javascript los meses empiezan desde cero
			_mes = parseInt(_mes) + 1;
			_mes = _mes.toString();

			if (_mes.length==1) _mes = "0" + _mes;
			if (_dia.length==1) _dia = "0" + _dia;

			return( _ano + _mes + _dia );

		}

		function FUNCIONES_FechaCMP2Cadena(FECHACMP)
		{
			// Formato entrada: aaaammdd
			// Formato salida: dd/mm/aaaa
			return( FECHACMP.substr(6,2) + "/" + FECHACMP.substr(4,2) + "/" + FECHACMP.substr(0,4))

		}

		function FUNCIONES_AcortarFecha(strFECHA)
		{
			// Formato entrada: dd/mm/aaaa
			// Formato salida:  dd/mm/aa
			return( strFECHA.substr(0,6) + strFECHA.substr(8,2) )
		}


		var OLD_ColorItemMenu="";
		var OLD_CFontItemMenu="";
		var ItemSeleccionado="";
		var OLD_BordeItem;
		function resaltarItemMenu(src, color){
			if (ItemSeleccionado!=src)
			{
				if (color==null) color="#cccccc"
				OLD_ColorItemMenu=src.style.background;
				OLD_CFontItemMenu=src.style.color;
				OLD_BordeItem=src.style.border;
				src.style.background=color;
				src.style.color="000080";
				src.style.border="1px solid #000000";
			}
		}

		function normalItemMenu(src, blnForce, color){
			if (blnForce==null) blnForce=false
			if (src!=""){
				if (ItemSeleccionado!=src){
					if (color==null) color="#f9f9ff";
					src.style.color=OLD_CFontItemMenu;
					src.style.background=OLD_ColorItemMenu;
					//src.style.border="1px solid " + color;
					src.style.border=OLD_BordeItem;
				}
			}
		}

		var OLD_ColorElementoMarcado;
		var OLD_ColorTextoElementoMarcado;
		var OLD_BordeMarcado;
		function MarcarItemMenu(src){
			if (ItemSeleccionado!=src){
				if (ItemSeleccionado!=""){
					ItemSeleccionado.style.color=OLD_CFontItemMenu;
					ItemSeleccionado.style.background=OLD_ColorElementoMarcado;
					ItemSeleccionado.style.border=OLD_BordeItem;
				}
				OLD_ColorElementoMarcado=OLD_ColorItemMenu;
				OLD_ColorTextoElementoMarcado=OLD_CFontItemMenu;
				OLD_BordeMarcado = OLD_BordeItem;
				src.style.border="1px solid #0000ff";
				ItemSeleccionado=src;
			}
		}



		function GotoURL(strURL, strParametros, destino){
			if (destino==null)
			{
				W=screen.width - 10;
				H=screen.Height - 110;
				if (strParametros == null) strParametros='width=' + W + ',height=' + H + ',scrollbars=1,resizable=1,toolbar=1,status=1,menubar=0, top=0, left=0, alwaysRaised=yes';
				window.open(strURL,'',strParametros);
			}
			else
			{
				try
				{
					BESLOADING_Mostrar();
				}
				catch(err){}
				destino.location.replace(strURL);
			}
		}
		
		function GotoURLVentanaCompleta(strURL, strParametros, destino){
			if (destino==null)
			{
				//W=screen.width - 10;
				//H=screen.Height - 110;
				//if (strParametros == null) strParametros='width=' + W + ',height=' + H + ',scrollbars=1,resizable=1,toolbar=1,status=1,menubar=0, top=0, left=0, alwaysRaised=yes';
				//window.open(strURL,'',strParametros);
				window.open(strURL);
			}
			else
			{
				try
				{
					BESLOADING_Mostrar();
				}
				catch(err){}
				destino.location.replace(strURL);
			}
		}		

	        function isEmailAddr(email)
	        {
	                var result = false;
	                var theStr = new String(email);
	                var index = theStr.indexOf("@");

	                if (index > 0)
	                {
	                    var pindex = theStr.indexOf(".",index);

	                    if ((pindex > index+1) && (theStr.length > pindex+1))
		                result = true;
	                }

	                return result;
	        }


		function DoShowTooltip(layer, strCadena){
			if (strCadena!="" && strCadena!=null)
			{
				if (layer.style.display!="")
				{
					document.all[layer.id].innerHTML=strCadena;
					layer.style.display="";
				}
				x = event.x + document.body.scrollLeft;
				y = event.y + document.body.scrollTop;

				// Si se sale fuera de la pantalla por la derecha...
				// Ojo que el ancho del layer está definido en el DIV!!!
				if ((document.body.clientWidth - x) < parseInt(layer.style.width))
				{
					layer.style.top = y;
					layer.style.left = document.body.clientWidth - parseInt(layer.style.width) - 10
				}
				else
				{
					layer.style.top = y;
					layer.style.left = x + 10;
				}
			}
		}

		function VaciarListBox(control){
			if (typeof(control)=="object") control = (control.name)
			for (intIndice=document["frmDatos"][control].length-1; intIndice >=0; intIndice--){
				document["frmDatos"][control][intIndice]=null;
			}
		}

		function QuitarValorListBox(control){

			if (typeof(control)=="object") control = (control.name)

			for (intIndice=document["frmDatos"][control].length-1; intIndice >=0; intIndice--){
				if (document["frmDatos"][control][intIndice].selected){
					document["frmDatos"][control][intIndice]=null;
				}
			}
			intIndice = document["frmDatos"][control].length;
			if (intIndice > 0) document["frmDatos"][control][intIndice-1].selected=true
		}

		function QuitarValorListBoxPorValor(control, ID){
			if (typeof(control)=="object") control = (control.name)
			for (intIndiceAVL=0; intIndiceAVL < document["frmDatos"][control].length; intIndiceAVL++){
				IDACTUAL= document["frmDatos"][control][intIndiceAVL].value;
				if (IDACTUAL==ID){
					document["frmDatos"][control][intIndiceAVL]=null;
				}
			}
		}

		function AgregarValorListbox(control, ID, VALOR, blnPermitirRepeticion, blnAvisoDuplicado){
			if (typeof(control)=="object") control = (control.name)
			blnAgregar=true;
			if (!blnPermitirRepeticion)
			{
				blnExiste=false;
				for (intIndiceAVL=0; intIndiceAVL < document["frmDatos"][control].length; intIndiceAVL++){
					IDACTUAL = document["frmDatos"][control][intIndiceAVL].value;
					if (!blnExiste) blnExiste=(IDACTUAL==ID)
					if (blnExiste){
						if (blnAvisoDuplicado!=null && blnAvisoDuplicado==true)
						{
							alert("El elemento '" + VALOR + "' ya existe en la lista.\nNo se permite agregar elementos repetidos.");
						}
						blnAgregar=false;
						break;
					}
				}
			}

			if (blnAgregar){
				ELEMENTO = new Option(VALOR, ID, false, false);
				intTotal = document["frmDatos"][control].length;
				document["frmDatos"][control][intTotal] = ELEMENTO;
				return(true);
			}
			else
				return(false);
		}

		// ----------------------------------------------------------------
		// RETORNA EL CONTROL (OBJETO) A PARTIR DEL NOMBRE (STRING)
		// ----------------------------------------------------------------
		function DameControl(formulario, strNombreControl){
			return(document.getElementById(strNombreControl))
		}




		function damenumeroJScript(strNumero){
			// ----------------------------------------------------------
			// ENTRA UN NUMERO FORMATEADO 1.234,56 y sale 1234.56
			// RETORNA UN NUMERO EVALUABLE MATEMATICAMENTE POR JAVASCRIPT
			// ----------------------------------------------------------
			strNumero = strNumero.toString();
			strNumero = replace(strNumero,"\\.","");
			strNumero = replace(strNumero,",",".");
			return(Number(strNumero));
		}



		function round(strNumero, decimales, blnPuntosMil){
			if (decimales==null) valor=(Math.round(strNumero))
			if (decimales==1)  valor=(Math.round(strNumero * 10)/10)
			if (decimales==2)  valor=(Math.round(strNumero * 100)/100)
			if (decimales==3)  valor=(Math.round(strNumero * 1000)/1000)
			if (decimales==4)  valor=(Math.round(strNumero * 10000)/10000)
			if (decimales==5)  valor=(Math.round(strNumero * 100000)/100000)
			if (decimales==6)  valor=(Math.round(strNumero * 1000000)/1000000)
			if (decimales==7)  valor=(Math.round(strNumero * 10000000)/10000000)
			if (decimales==8)  valor=(Math.round(strNumero * 100000000)/100000000)
			if (decimales==9)  valor=(Math.round(strNumero * 1000000000)/1000000000)
			if (decimales==10) valor=(Math.round(strNumero * 10000000000)/10000000000)

			if (blnPuntosMil)
				return(formatNumber(valor,"#.###,####"));
			else{
				valor = valor.toString();
				valor = replace(valor,"\\.",",");
				return(valor);
			}
		}



		// -----------------------------------------------------------------------------
		// FUNCIÓN QUE PONE LOS PUNTOS SOBRE UNIDADES MIL, LA ENTRADA HA DE SER UN VALOR
		// NUMERICO VALIDO DE JAVASCRIPT (12345.67) Y LA SALIDA ES (12.345,67)
		// -----------------------------------------------------------------------------
		   // CONSTANTS
		  var separator = ",";  // use comma as 000's separator
		  var decpoint = ".";  // use period as decimal point
		  var percent = "%";
		  var currency = "$";  // use dollar sign for currency

		  function formatNumber(number, format, print) {  // use: formatNumber(number, "format")
		    if (print) document.write("formatNumber(" + number + ", \"" + format + "\")<br>");

		    if (number - 0 != number) return null;  // if number is NaN return null
		    var useSeparator = format.indexOf(separator) != -1;  // use separators in number
		    var usePercent = format.indexOf(percent) != -1;  // convert output to percentage
		    var useCurrency = format.indexOf(currency) != -1;  // use currency format
		    var isNegative = (number < 0);
		    number = Math.abs (number);
		    if (usePercent) number *= 100;
		    format = strip(format, separator + percent + currency);  // remove key characters
		    number = "" + number;  // convert number input to string

		     // split input value into LHS and RHS using decpoint as divider
		    var dec = number.indexOf(decpoint) != -1;
		    var nleftEnd = (dec) ? number.substring(0, number.indexOf(".")) : number;
		    var nrightEnd = (dec) ? number.substring(number.indexOf(".") + 1) : "";

		     // split format string into LHS and RHS using decpoint as divider
		    dec = format.indexOf(decpoint) != -1;
		    var sleftEnd = (dec) ? format.substring(0, format.indexOf(".")) : format;
		    var srightEnd = (dec) ? format.substring(format.indexOf(".") + 1) : "";

		     // adjust decimal places by cropping or adding zeros to LHS of number
		    if (srightEnd.length < nrightEnd.length) {
		      var nextChar = nrightEnd.charAt(srightEnd.length) - 0;
		      nrightEnd = nrightEnd.substring(0, srightEnd.length);
		      if (nextChar >= 5) nrightEnd = "" + ((nrightEnd - 0) + 1);  // round up

		 // patch provided by Patti Marcoux 1999/08/06
		      while (srightEnd.length > nrightEnd.length) {
		        nrightEnd = "0" + nrightEnd;
		      }

		      if (srightEnd.length < nrightEnd.length) {
		        nrightEnd = nrightEnd.substring(1);
		        nleftEnd = (nleftEnd - 0) + 1;
		      }
		    } else {
		      for (var i=nrightEnd.length; srightEnd.length > nrightEnd.length; i++) {
		        if (srightEnd.charAt(i) == "0") nrightEnd += "0";  // append zero to RHS of number
		        else break;
		      }
		    }

		     // adjust leading zeros
		    sleftEnd = strip(sleftEnd, "#");  // remove hashes from LHS of format
		    while (sleftEnd.length > nleftEnd.length) {
		      nleftEnd = "0" + nleftEnd;  // prepend zero to LHS of number
		    }

		    if (useSeparator) nleftEnd = separate(nleftEnd, separator);  // add separator
		    var output = nleftEnd + ((nrightEnd != "") ? "." + nrightEnd : "");  // combine parts
		    output = ((useCurrency) ? currency : "") + output + ((usePercent) ? percent : "");
		    if (isNegative) {
		      // patch suggested by Tom Denn 25/4/2001
		      output = (useCurrency) ? "(" + output + ")" : "-" + output;
		    }
		    output=replace(output,",","|")
		    output=replace(output,"\\.",",")
		    output=replace(output,"\\|",".")
		    return output;
		  }

		  function strip(input, chars) {  // strip all characters in 'chars' from input
		    var output = "";  // initialise output string
		    for (var i=0; i < input.length; i++)
		      if (chars.indexOf(input.charAt(i)) == -1)
		        output += input.charAt(i);
		    return output;
		  }

		  function separate(input, separator) {  // format input using 'separator' to mark 000's
		    input = "" + input;
		    var output = "";  // initialise output string
		    for (var i=0; i < input.length; i++) {
		      if (i != 0 && (input.length - i) % 3 == 0) output += separator;
		      output += input.charAt(i);
		    }
		    return output;
		  }





		// ------------------------------
		// FUNCIÓN REPLACE ESTILO VSCRIPT
		// ------------------------------
		function replace(strCadena, strBuscada, strReemplazada){
			strBusca = new RegExp (strBuscada,"gi");
			strResultado=strCadena.replace(strBusca,strReemplazada);
			return(strResultado);
		}



		// -------------------------------------------
		// SELECCION POR VALOR
		// -------------------------------------------
		function SeleccionPorValor(control, VALOR, forcecheck)
		{
			if (forcecheck==null) forcecheck=false
			if (control != null){
				if (typeof(control)=="object"){
					if (control.length==null)
						control = (control.name)
					else
						control = (control[0].name)
				}
				if (document["frmDatos"][control])
				{
					intTope = document["frmDatos"][control].length - 1;
					if (isNaN(intTope))
					{
						if (forcecheck)
						{
							if (document["frmDatos"][control].value==VALOR) document["frmDatos"][control].checked = true
						}
						else
						{
							if (document["frmDatos"][control].value==VALOR) document["frmDatos"][control].checked = ! document["frmDatos"][control].checked;
						}
					}
					else
					{
						for (intIndiceSeleccionPorValor=0; intIndiceSeleccionPorValor <=intTope; intIndiceSeleccionPorValor++)
						{
							if (forcecheck)
							{
								if (document["frmDatos"][control][intIndiceSeleccionPorValor].value==VALOR) document["frmDatos"][control][intIndiceSeleccionPorValor].checked = true
							}
							else
							{
								if (document["frmDatos"][control][intIndiceSeleccionPorValor].value==VALOR) document["frmDatos"][control][intIndiceSeleccionPorValor].checked = ! document["frmDatos"][control][intIndiceSeleccionPorValor].checked ;
							}
						}
					}
				}
			}
		}

		// -------------------------------------------
		// DESELECCION POR VALOR
		// -------------------------------------------
		function DeseleccionPorValor(control, VALOR, forcecheck)
		{
			if (forcecheck==null) forcecheck=false
			if (control != null){
				if (typeof(control)=="object"){
					if (control.length==null)
						control = (control.name)
					else
						control = (control[0].name)
				}
				if (document["frmDatos"][control])
				{
					intTope = document["frmDatos"][control].length - 1;
					if (isNaN(intTope)){
						if (forcecheck)
						{
							if (document["frmDatos"][control].value==VALOR) document["frmDatos"][control].checked = false
						}
						else
						{
							if (document["frmDatos"][control].value==VALOR) document["frmDatos"][control].checked = ! document["frmDatos"][control].checked;
						}
					}
					else
					{
						for (intIndiceSeleccionPorValor=0; intIndiceSeleccionPorValor <=intTope; intIndiceSeleccionPorValor++){
							if (forcecheck)
							{
								if (document["frmDatos"][control][intIndiceSeleccionPorValor].value==VALOR) document["frmDatos"][control][intIndiceSeleccionPorValor].checked = false
							}
							else
							{
								if (document["frmDatos"][control][intIndiceSeleccionPorValor].value==VALOR) document["frmDatos"][control][intIndiceSeleccionPorValor].checked = ! document["frmDatos"][control][intIndiceSeleccionPorValor].checked ;
							}
						}
					}
				}
			}
		}

		// -------------------------------------------
		// SELECCION POR TAG
		// -------------------------------------------
		function SeleccionPorTag(control, VALOR, forcecheck)
		{
			if (forcecheck==null) forcecheck=false
			if (control != null){
				if (typeof(control)=="object"){
					if (control.length==null)
						control = (control.name)
					else
						control = (control[0].name)
				}
				if (document["frmDatos"][control])
				{
					intTope = document["frmDatos"][control].length - 1;
					if (isNaN(intTope))
					{
						if (forcecheck)
						{
							if (document["frmDatos"][control].tag==VALOR) document["frmDatos"][control].checked = true
						}
						else
						{
							if (document["frmDatos"][control].tag==VALOR) document["frmDatos"][control].checked = ! document["frmDatos"][control].checked;
						}
					}
					else
					{
						for (intIndiceSeleccionPorValor=0; intIndiceSeleccionPorValor <=intTope; intIndiceSeleccionPorValor++)
						{
							if (forcecheck)
							{
								if (document["frmDatos"][control][intIndiceSeleccionPorValor].tag==VALOR) document["frmDatos"][control][intIndiceSeleccionPorValor].checked = true
							}
							else
							{
								if (document["frmDatos"][control][intIndiceSeleccionPorValor].tag==VALOR) document["frmDatos"][control][intIndiceSeleccionPorValor].checked = ! document["frmDatos"][control][intIndiceSeleccionPorValor].checked ;
							}
						}
					}
				}
			}
		}

		// -------------------------------------------
		// DESELECCION POR TAG
		// -------------------------------------------
		function DeseleccionPorTag(control, VALOR, forcecheck)
		{
			if (forcecheck==null) forcecheck=false
			if (control != null){
				if (typeof(control)=="object"){
					if (control.length==null)
						control = (control.name)
					else
						control = (control[0].name)
				}
				if (document["frmDatos"][control])
				{
					intTope = document["frmDatos"][control].length - 1;
					if (isNaN(intTope)){
						if (forcecheck)
						{
							if (document["frmDatos"][control].tag==VALOR) document["frmDatos"][control].checked = false
						}
						else
						{
							if (document["frmDatos"][control].tag==VALOR) document["frmDatos"][control].checked = ! document["frmDatos"][control].checked;
						}
					}
					else
					{
						for (intIndiceSeleccionPorValor=0; intIndiceSeleccionPorValor <=intTope; intIndiceSeleccionPorValor++){
							if (forcecheck)
							{
								if (document["frmDatos"][control][intIndiceSeleccionPorValor].tag==VALOR) document["frmDatos"][control][intIndiceSeleccionPorValor].checked = false
							}
							else
							{
								if (document["frmDatos"][control][intIndiceSeleccionPorValor].tag==VALOR) document["frmDatos"][control][intIndiceSeleccionPorValor].checked = ! document["frmDatos"][control][intIndiceSeleccionPorValor].checked ;
							}
						}
					}
				}
			}
		}

		function ObtenerObjetoPorValor(control, valor)
		{
			if (control != null)
			{
				if (typeof(control)=="object")
				{
					if (control.length==null)
						control = (control.name)
					else
						control = (control[0].name)
				}

				intTope = document["frmDatos"][control].length - 1;
				if (isNaN(intTope)){
					return(document["frmDatos"][control])
				}else{
					for (intIndiceSeleccionPorValor=0; intIndiceSeleccionPorValor <=intTope; intIndiceSeleccionPorValor++){
						if (document["frmDatos"][control][intIndiceSeleccionPorValor].value==valor)  return (document["frmDatos"][control][intIndiceSeleccionPorValor])
					}
				}
			}

		}

		// -------------------------------------------
		// CHEQUEA TODOS LOS ELEMENTOS DE "CONTROL"
		// -------------------------------------------
		function SeleccionarTodo(control)
		{
			if (typeof(control)=="object")
			{
				if (control.length==null)
					control = (control.name)
				else
					control = (control[0].name)
			}

			if (control != "")
			{
				if (document["frmDatos"][control])
				{
					intTope = document["frmDatos"][control].length - 1;

					if (isNaN(intTope))
					{
						if (! document["frmDatos"][control].disabled) document["frmDatos"][control].checked = true;
					}
					else
					{
						for (intIndiceSeleccionarTodo=0; intIndiceSeleccionarTodo <=intTope; intIndiceSeleccionarTodo++)
						{
							if (! document["frmDatos"][control][intIndiceSeleccionarTodo].disabled)
							{
								document["frmDatos"][control][intIndiceSeleccionarTodo].checked = true;
							}
						}
					}
				}
			}
		}


		// -------------------------------------------
		// DESCHEQUEA TODOS LOS ELEMENTOS DE "CONTROL"
		// -------------------------------------------
		function SeleccionarNinguno(control){
			if (typeof(control)=="object"){
				if (control.length==null)
					control = (control.name)
				else
					control = (control[0].name)
			}

			if (control != "")
			{
				if (document["frmDatos"][control])
				{
					intTope = document["frmDatos"][control].length - 1;
					if (isNaN(intTope)){
						document["frmDatos"][control].checked = false;
					}
					else
					{
						for (intIndiceSeleccionarNinguno=0; intIndiceSeleccionarNinguno <=intTope; intIndiceSeleccionarNinguno++){
							document["frmDatos"][control][intIndiceSeleccionarNinguno].checked = false;
						}
					}
				}
			}
		}

		// -------------------------------------------
		// DESHABILITA TODOS LOS ELEMENTOS DE "CONTROL"
		// -------------------------------------------
		function DeshabilitarTodos(control)
		{
			if (typeof(control)=="object")
			{
				if (control.length==null)
					control = (control.name)
				else
					control = (control[0].name)
			}

			if (control != "")
			{
				if (document["frmDatos"][control])
				{
					intTope = document["frmDatos"][control].length - 1;
					
					if (isNaN(intTope))
					{
						document["frmDatos"][control].disabled = true;
					}
					else
					{
						for (intIndiceSeleccionarNinguno=0; intIndiceSeleccionarNinguno <=intTope; intIndiceSeleccionarNinguno++)
						{
							document["frmDatos"][control][intIndiceSeleccionarNinguno].disabled = true;
						}
					}
				}
			}
		}

		// -------------------------------------------
		// HABILITAR POR VALOR
		// -------------------------------------------
		function HabilitarPorValor(control, VALOR)
		{
			if (control != null)
			{
				if (typeof(control)=="object")
				{
					if (control.length==null)
						control = (control.name);
					else
						control = (control[0].name);
				}
				
				if (document["frmDatos"][control])
				{
					intTope = document["frmDatos"][control].length - 1;

					if (isNaN(intTope))
					{
						if (document["frmDatos"][control].value==VALOR) 
							document["frmDatos"][control].disabled = false;
					}
					else
					{
						for (intIndiceSeleccionPorValor=0; intIndiceSeleccionPorValor <=intTope; intIndiceSeleccionPorValor++)
						{
							if (document["frmDatos"][control][intIndiceSeleccionPorValor].value==VALOR) 
								document["frmDatos"][control][intIndiceSeleccionPorValor].disabled = false;
						}
					}
				}
			}
		}

		// -------------------------------------------
		// DESHABILITAR POR VALOR
		// -------------------------------------------
		function DeshabilitarPorValor(control, VALOR)
		{
			if (control != null)
			{
				if (typeof(control)=="object")
				{
					if (control.length==null)
						control = (control.name);
					else
						control = (control[0].name);
				}
				
				if (document["frmDatos"][control])
				{
					intTope = document["frmDatos"][control].length - 1;

					if (isNaN(intTope))
					{
						if (document["frmDatos"][control].value==VALOR) 
							document["frmDatos"][control].disabled = true;
					}
					else
					{
						for (intIndiceSeleccionPorValor=0; intIndiceSeleccionPorValor <=intTope; intIndiceSeleccionPorValor++)
						{
							if (document["frmDatos"][control][intIndiceSeleccionPorValor].value==VALOR) 
								document["frmDatos"][control][intIndiceSeleccionPorValor].disabled = true;
						}
					}
				}
			}
		}

		// -------------------------------------------------
		// INVIERTE EL CHEQUEO DE LOS ELEMENTOS DE "CONTROL"
		// -------------------------------------------------
		function InvertirSeleccion(control){
			if (typeof(control)=="object"){
				if (control.length==null)
					control = (control.name)
				else
					control = (control[0].name)
			}
			if (control != ""){
				intTope = document["frmDatos"][control].length - 1;
				if (isNaN(intTope)){
					document["frmDatos"][control].checked = ! document["frmDatos"][control].checked;
				}
				else
				{
					for (intIndiceInvertirSeleccion=0; intIndiceInvertirSeleccion <=intTope; intIndiceInvertirSeleccion++){
						document["frmDatos"][control][intIndiceInvertirSeleccion].checked = ! document["frmDatos"][control][intIndiceInvertirSeleccion].checked;
					}
				}
			}
		}


		// -------------------------------------------------
		// DESCHEQUEA TODOS LOS ELEMENTOS DE "CONTROL"
		// -------------------------------------------------
		function CancelarSeleccion(control){
			SeleccionarNinguno(control)
		}



		// -----------------------------------------------------------------------------------
		// RETORNA EN FORMA DE LISTA SEPARADA POR COMAS LOS ELEMENTOS SELECCIONADOS (EL VALUE)
		// -----------------------------------------------------------------------------------
		function RetornaSeleccionados(control, separador){
			if (separador==null) separador=",";
			LSTIDResultante="";
			if (typeof(control)=="object"){
				if (control.length==null)
					control = (control.name)
				else
					control = (control[0].name)
			}

			//if (document["frmDatos"][control] != null){
			if (document.getElementsByName(control) != null){
				//intTope = document["frmDatos"][control].length - 1;
				intTope = document.getElementsByName(control).length - 1;
				if (isNaN(intTope)){
					//if (document["frmDatos"][control].checked == true) LSTIDResultante = document["frmDatos"][control].value;
					if (document.getElementsByName(control).checked == true) LSTIDResultante = document.getElementsByName(control).value;
				}
				else
				{
					for (intIndiceRetornarSeleccionados=0; intIndiceRetornarSeleccionados <=intTope; intIndiceRetornarSeleccionados++){
						//if (document["frmDatos"][control][intIndiceRetornarSeleccionados].checked == true){
						if (document.getElementsByName(control)[intIndiceRetornarSeleccionados].checked == true){
							if (LSTIDResultante=="")
								//LSTIDResultante = document["frmDatos"][control][intIndiceRetornarSeleccionados].value;
								LSTIDResultante = document.getElementsByName(control)[intIndiceRetornarSeleccionados].value;
							else
								//LSTIDResultante = LSTIDResultante + separador + document["frmDatos"][control][intIndiceRetornarSeleccionados].value
								LSTIDResultante = LSTIDResultante + separador + document.getElementsByName(control)[intIndiceRetornarSeleccionados].value
						}
					}
				}
			}
			return(LSTIDResultante);
		}


		// -------------------------------------------------
		// RETORNA EL VALOR DE TAG DE LOS ELEMENTOS SELECCIONADOS (CHECKS O RADIOS)
		// -------------------------------------------------
		function RetornaSeleccionadosTag(control, separador){
			if (separador==null) separador=",";
			LSTIDResultante="";
			if (typeof(control)=="object"){
				if (control.length==null)
					control = (control.name)
				else
					control = (control[0].name)
			}

			if (document["frmDatos"][control] != null){
				intTope = document["frmDatos"][control].length - 1;
				if (isNaN(intTope)){
					if (document["frmDatos"][control].checked == true) LSTIDResultante = document["frmDatos"][control].tag;
				}
				else
				{
					for (intIndiceRetornarSeleccionadosTag=0; intIndiceRetornarSeleccionadosTag <=intTope; intIndiceRetornarSeleccionadosTag++){
						if (document["frmDatos"][control][intIndiceRetornarSeleccionadosTag].checked == true){
							if (LSTIDResultante=="")
								LSTIDResultante = document["frmDatos"][control][intIndiceRetornarSeleccionadosTag].tag;
							else
								LSTIDResultante = LSTIDResultante + separador + document["frmDatos"][control][intIndiceRetornarSeleccionadosTag].tag
						}
					}
				}
			}
			return(LSTIDResultante);
		}


		// -------------------------------------------
		// CUENTA EL NUMERO DE ELEMENTOS SELECCIONADOS
		// -------------------------------------------
		function ContarSeleccionados(control){
			intContados=0;
			if (typeof(control)=="object"){
				if (control.length==null)
					control = (control.name)
				else
					control = (control[0].name)
			}


			if (document["frmDatos"][control] != null){
				intTope = document["frmDatos"][control].length - 1;
				if (isNaN(intTope)){
					if (document["frmDatos"][control].checked == true) intContados=1;
				}else{
					for (intIndiceContarSeleccionados=0; intIndiceContarSeleccionados <=intTope; intIndiceContarSeleccionados++){
						if (document["frmDatos"][control][intIndiceContarSeleccionados].checked == true) intContados=intContados+1;
					}
				}
			}
			return(intContados);
		}


		// RETORNA N ELEMENTOS SELECCIONADOS
		function SeleccionAleatoria(control){

			if (control!=null)
			{
				MAXPREGUNTAS = control.length;
				if (MAXPREGUNTAS==null) MAXPREGUNTAS=1;
				strCUANTOS=prompt("¿Cuantos quieres seleccionar aleatoriamente?\nRecuerda que solo hay " + MAXPREGUNTAS + " elementos disponibles en total.","");
				if (strCUANTOS!="" & strCUANTOS!=null && strCUANTOS!=0){
					if (parseInt(strCUANTOS) <= parseInt(MAXPREGUNTAS)){

						while (ContarSeleccionados(control) < strCUANTOS)
						{
							intNumero=Math.random();
							intContador=(intNumero * (MAXPREGUNTAS-1));
							intTope=control.length - 1;
							if (isNaN(intTope)){
								control.checked = true;
							}
							else
							{
								control(intContador).checked=true;
							}

						}

						alert("Se ha seleccionado: " + ContarSeleccionados(control) + " elementos.")
					}
					else
						alert("Valor incorrecto.")
				}
			}
		}

		// CHEQUEA UN ELEMENTO DEL CONTROL "control", blnforce indica si fuerza a estar chequeado
		function CheckItem(control, valor, blnForce){
			if (control!=null)
			{
				if (control.length != null)
				{
					for (intIndiceCheckItem=0; intIndiceCheckItem <= control.length-1; intIndiceCheckItem++)
					{
						if (control[intIndiceCheckItem].value == valor)
						{
							if (blnForce)
							{
								control[intIndiceCheckItem].checked=true;
							}
							else
							{
								control[intIndiceCheckItem].checked = (!control[intIndiceCheckItem].checked);
							}
							break;
						}
					}
				}
				else
				{
					if (blnForce)
					{
						control.checked = true;
					}
					else
					{
						control.checked = (!control.checked);
					}
				}
			}
		}




		// -------------------------------------------
		// Abre ls URL con ventana tipo ZOOM
		// -------------------------------------------
		function AbrirVentana(strURL, strParametros, W, H)
		{
			popup = window.open('/Dummie.htm','',strParametros);
			zoom(strURL, popup, W, H)
		}

		function zoom(strURL, popup, W, H){
			CX = (screen.availwidth/2) - (W/2);
			CY = (screen.availHeight/2) - (H/2);
			popup.moveTo(CX,CY);
			popup.resizeTo(W, H);
			popup.location.replace(strURL)
			WActual=100;
			HActual=100;
		}


		// COMPRUEBA QUE SEA VALIDO UN EMAIL DADO
	        function isEmailAddr(email)
	        {
	                var result = false;
	                var theStr = new String(email);
	                var index = theStr.indexOf("@");

	                if (index > 0)
	                {
	                    var pindex = theStr.indexOf(".",index);

	                    if ((pindex > index+1) && (theStr.length > pindex+1))
		                result = true;
	                }

	                return result;
	        }

                // This script and many more are available free online at
                // The JavaScript Source!! http://javascript.internet.com

                function textCounter(field, countfield, maxlimit)
                {
                        if (field.value.length > maxlimit)      // if too long...trim it!
                                field.value = field.value.substring(0, maxlimit);
                        else                                    // otherwise, update 'characters left' counter
                                countfield.value = maxlimit - field.value.length;
                }

		// RETORNA EL TEXTO DEL COMBO INDICADO SEGUN SELECCION ACTUAL
		function ObtenerTextoCombo(nombrecombo){
			if(document.getElementById(nombrecombo).selectedIndex != -1){
				return(document.getElementById(nombrecombo).item(document.getElementById(nombrecombo).selectedIndex).text);
			}
		}

		// EXTENSIONES AL OBJETO STRING DE JAVASCRIPT PARA DOTARLO DE LOS METODOS trim, leftTrim, rightTrim
		// Give string object the trim method.
		String.prototype.trim = function(){
			return( this.replace(new RegExp("^([\\s]+)|([\\s]+)$", "gm"), "") );
		}

		// Give string object the left trim method.
		String.prototype.leftTrim = function(){
			return( this.replace(new RegExp("^[\\s]+", "gm"), "") );
		}

		// Give string object the right trim method.
		String.prototype.rightTrim = function(){
			return( this.replace(new RegExp("[\\s]+$", "gm"), "") );
		}
		
	function FUNCIONES_PosicionEnArray(ValorBuscar, ArrayBuscado)
	{
		var intReturn = -1;
		if (ArrayBuscado.constructor == Array)
		{
			iTotal = ArrayBuscado.length;
			for (iCount = 0; iCount < iTotal; iCount++)
			{
				if (ArrayBuscado[iCount] == ValorBuscar)
				{
					intReturn = iCount;
					break;
				}
				else
				{
					intReturn = -1;
				}
			}
		}
		else
		{
			window.alert("Se debe especificar el array en el que buscar.");
			blnReturn = false;
		}
		return intReturn;
	}

	//-->