	function Habilitar(b, objeto)
	{
		objeto.disabled = !b.checked;
	}

	function EsVacio(Campo, Caja, Valor)
	{
		OK = true;
		
		if (Valor == "") 
		{
			alert("No se permite dejar el campo "+Campo+" vacio");
			Caja.setfocus;
			Caja.select();
			OK = false;
		}
		else
		    OK = true;

		return OK;
	}

	function EsRadioVacio(Campo, Caja, Valor)
	{
		var Indice = 0;
		
		OK = false;
		while (Caja[Indice] != undefined)
		{
			if (Caja[Indice].checked) OK = true;
			Indice++;
		}
		
		if (OK == false) alert("Se debe marcar al menos una opción de "+Campo);
		
		return OK;

	}

	function AValor(Cadena)
	{
		var Nueva = '';
		var strCheck = '0123456789-.';
		
		for (i = 0; i <= Cadena.length; i++)
		{
			C = Cadena.charAt(i);
			if (strCheck.indexOf(C) != -1) Nueva = Nueva + C;
		}
		
		return Nueva;
	}	

	function DelimitaString(fld, Max)
	{
		var key = '';
		len = fld.length;
		
		if (len >= Max) return false;
		
		return true;
	}	
	
	function SoloDigitos(e) 
	{
		var strCheck = '0123456789';
		var whichCode = (window.Event) ? e.which : e.keyCode;
		if (whichCode == 13) return true;  // Enter
		key = String.fromCharCode(whichCode);  // Get key value from key code
		if (strCheck.indexOf(key) == -1) return false;  // Not a valid key

		return true;
	}

	function DigitosDecimales(e) 
	{
		var strCheck = '0123456789.-';
		var whichCode = (window.Event) ? e.which : e.keyCode;
		if (whichCode == 13) return true;  // Enter
		key = String.fromCharCode(whichCode);  // Get key value from key code
		if (strCheck.indexOf(key) == -1) return false;  // Not a valid key

		return true;
	}

	function Enviar(f, Boton, ID)
	{
		var Accion = document.getElementById("POOKY_ACCION");
		
		Accion.value = Boton
		f.Boton.value = Boton;
		f.id.value = ID;		

		f.submit();
	}

	function CadenaMoneda(Cadena)
	{
		return (Cadena);
	}

	function AMoneda(Cadena)
	{
		/*Original =  Cadena;
		Entera = intval( Cadena);
		Cadena = strval( Entera);
	
		Moneda = "";
		Tam = Cadena.lenght;
		i =  Tam;
		while ( i > 0)
		{
			if (( i % 3) == 0 &&  i !=  Tam)  Moneda =  Moneda + ".";
			Moneda =  Moneda +  Cadena.charAt(Tam -  i);
			i--;
		}
			
		Decimal =  Original -  Entera;
		Decimal = ceil( Decimal * 100);

		if ( Decimal > 0)
			NuevaCadena =  Moneda + "," + strval( Decimal);
		else
			 NuevaCadena =  Moneda;
		
		return ( NuevaCadena);*/
	}

	function NormalizaString(Cadena)
	{
		return Cadena.substring(0, 254);
	}

	function EsDigito(C)
	{
		if (C < "0" || C > "9") 
			return false;
		else 
		    return true;
	}

	function EsEntero(Campo, Caja, Vacio)
	{
		Cadena = Caja.value;
		if (Cadena == "" && Vacio == false) 
		{
			alert("Campo Vacio");
			Caja.focus();
			Caja.select();
			return false;
		}

		for (var i = 0; i < Cadena.length; i++) 
		{
			C = Cadena.charAt(i);
			if (!EsDigito(C)) 
			{
				if (i == 0 && (C == "+" || C == "-"))
				{
					// El primer caracter puede ser un menos
				}
				else
				{
					alert("El valor de " + Campo + " (" + Cadena + "), no es un dato adecuado, debe ser numérico.");
					Caja.focus();
					Caja.select();
					return false;
				}
	        }
	    }
	    return true;
	}

	function EsDecimal(Campo, Caja, Vacio)
	{
		Cadena = Caja.value;
		PuntoYaVisto = false;
		if (Cadena == "" && Vacio == false) 
		{
			alert("Campo Vacio");
			Caja.focus();
			Caja.select();
			return false;
		}

		for (var i = 0; i < Cadena.length; i++) 
		{
			C = Cadena.charAt(i);
			if (!EsDigito(C)) 
			{
				if (i == 0 && (C == "+" || C == "-" || C == "."))
				{
					// El primer caracter puede ser un menos
					if (C == ".") PuntoYaVisto = true;
				}
				else
				{
					if (C == "." && !PuntoYaVisto)
					{
						PuntoYaVisto = true;
					}
					else
					{
						alert("El valor de "+ Campo + " (" + Cadena + "), no es un dato adecuado, debe ser decimal.");
						Caja.focus();
						Caja.select();
						return false;
					}
				}
	        }
	    }
	    return true;
	}
