var isIE = document.all?true:false;
var isNS = document.layers?true:false;

function soloNumeros(e) {
 var _ret = true;

 if (isIE) { if ( ((window.event.keyCode < 44 || window.event.keyCode > 57) && (window.event.keyCode < 96 || window.event.keyCode >105)) || window.event.keyCode == 47 || window.event.keyCode == 46) { if (window.event.keyCode!=8) {window.event.keyCode = 0; _ret = false;} } }
 if (isNS) { if ( (e.which < 44 || e.which > 57) || e.which == 47 || e.which == 46) { e.which = 0; _ret = false; } }
 return (_ret); 
}

function isInteger(ObjectValue) {
	//Returns true if value is a number or is NULL
	//otherwise returns false	
	
	if (ObjectValue.length == 0) return true;
	
	//Returns true if value is an integer defined as
	//   having an optional leading + or -.
	//   otherwise containing only the characters 0-9.
	var decimal_format = ",";
	var check_char;
	
	//The first character can be + -  blank or a digit.
	check_char = ObjectValue.indexOf(decimal_format)
	//Was it a decimal?
	if (check_char < 1) return isFloat(ObjectValue); else return false;
 } 
 
function isFloat(ObjectValue) {
	// Used Internally by ValidateInt, ValidateFloat

	//Returns true if value is a number or is NULL
	//otherwise returns false	
	
	if (ObjectValue.length == 0) return true;
	
	//Returns true if value is a number defined as
	//   having an optional leading + or -.
	//   having at most 1 decimal point.
	//   otherwise containing only the characters 0-9.
	var start_format = " ,+-0123456789";
	var number_format = " ,0123456789";
	//if (AllowComma == 1) number_format=number_format + ',';
	var check_char;
	var decimal = false;
	var trailing_blank = false;
	var digits = false;
	
	//The first character can be + - .  blank or a digit.
	check_char = start_format.indexOf(ObjectValue.charAt(0))
	//Was it a decimal?
	if (check_char == 1)
		decimal = true;
	else if (check_char < 1)
		return false;
	
	//Remaining characters can be only . or a digit, but only one decimal.
	for (var i = 1; i < ObjectValue.length; i++)
	{
		check_char = number_format.indexOf(ObjectValue.charAt(i))
		if (check_char < 0)
			return false;
		else if (check_char == 1)
		{
			if (decimal)		// Second decimal.
				return false;
			else
				decimal = true;
		}
		else if (check_char == 0)
		{
			if (decimal || digits) trailing_blank = true;
			// ignore leading blanks
		}
		else if (trailing_blank)
			return false;
		else
			digits = true;
	}	
	//All tests passed, so...
	return true
 } 

function aleatorio(a,b) {
  return Math.round(Math.random()*(b-a)+a);
}
