function CUIT( a, b, objeto ) {
	Primerguion = objeto.indexOf( "-" );
	Ultimoguion = objeto.lastIndexOf( "-" );
	Longitud    = objeto.length;

	if ( Longitud < 1 )
		return true;

	if ( Primerguion != 2 || Ultimoguion != 11 )
		return false;
	else
		return true;
}

function Sexo( a, b, objeto ) {
	if ( objeto == 'M'
		|| objeto == 'F'
		|| objeto == 'm'
		|| objeto == 'f'
		|| objeto.length < 1 )
		return true;
	else
		return false;
}

function Alfanumerico( a, b, objeto ) {
	return true;
}

function Numerico( a, b, objeto ) {
	if ( objeto.length < 1 )
		return true;

	if ( objeto >= 0 && objeto <= 99999 )
		return true;
}

function Alfabetico( a, b, objeto ) {
	if ( objeto.length < 1 )
		return true;
}

function Logica( a, b, objeto ) {
	if ( objeto == 'S'
		|| objeto == 'N'
		|| objeto == 's'
		|| objeto == 'n'
		|| objeto.length < 1 )
		return true;
	else
		return false;
}

function EMail( a, b, objeto ) {
	ArrobaPos    = objeto.indexOf( "@" );
	PuntoPos     = objeto.lastIndexOf( "." );
	OtroPuntoPos = objeto.indexOf( "." );
	Longitud     = objeto.length;

	if ( Longitud < 1 )
		return true;

	if ( ArrobaPos < 1
		|| PuntoPos < 3
		|| ( ArrobaPos + 1 ) > PuntoPos
		|| PuntoPos == Longitud - 1
		|| OtroPuntoPos < 1 )
		return false;
	else
		return true;
}

function fcheckfecha( form_object, input_object, object_value ) {
	if ( ! fcheckeurodate( object_value ) )
		return false;
	return true;
}

function fcheckeurodate( object_value, required ) {
	if(required){
		if(object_value.length==0){
			return false;
		}
	}else{
		if(object_value.length==0){
			return true;
		}
	}
	/*
	if ( object_value.length == 0 )
		return true;
	*/

	isplit = object_value.indexOf( '/' );

	if ( isplit == -1 )
		isplit = object_value.indexOf( '.' );

	if ( isplit == -1 || isplit == object_value.length )
		return false;

	sDay = object_value.substring( 0, isplit );
	monthSplit = isplit + 1;
	isplit = object_value.indexOf( '/', monthSplit );

	if ( isplit == -1 )
		isplit = object_value.indexOf( '.', monthSplit );

	if ( isplit == -1 ||  ( isplit + 1 )  == object_value.length )
		return false;

	sMonth = object_value.substring(( sDay.length + 1 ), isplit);
	sYear = object_value.substring( isplit + 1 );

	if ( ! fcheckinteger( sMonth ) ) //check month
		return false;
	else if ( ! fcheckrange( sMonth, 1, 12 ) ) // check month
		return false;
	else if ( ! fcheckinteger( sYear ) ) //check year
		return false;
	else if ( ! fcheckrange( sYear, 1, 9999 ) ) //check year
		return false;
	else if ( ! fcheckinteger( sDay ) ) //check day
		return false;
	else if ( ! fcheckday( sYear, sMonth, sDay ) ) //check day
		return false;
	else
		return true;
}

function fcheckday( checkYear, checkMonth, checkDay ) {
	maxDay = 31;
	if ( checkMonth == 4 || checkMonth == 6 || checkMonth == 9 || checkMonth == 11 )
		maxDay = 30;
	else if ( checkMonth == 2 ) {
		if ( checkYear % 4 > 0 )
			maxDay =28;
		else if ( checkYear % 100 == 0 && checkYear % 400 > 0 )
			maxDay = 28;
		else
			maxDay = 29;
	}
	return fcheckrange( checkDay, 1, maxDay ); //check day
}

function fcheckinteger( object_value ) {
	if ( object_value.length == 0 )
		return true;
	var decimal_format = ".";
	var check_char;
	check_char = object_value.indexOf( decimal_format )
	if ( check_char < 1 )
		return fchecknumber( object_value );
	else
		return false;
}

function fnumberrange( object_value, min_value, max_value ) {
	if ( min_value != null ) {
		if ( object_value < min_value )
			return false;
	}
	if ( max_value != null ) {
		if ( object_value > max_value )
			return false;
	}
	return true;
}

function fchecknumber( object_value, required ) {
var start_format=" .+-0123456789";
var number_format=" .0123456789";
var check_char;
var decimal=false;
var trailing_blank=false;
var digits=false;
object_value=object_value.replace(/^\s+/,"").replace(/\s+$/,"");
object_value=object_value.replace(/[$Â£Â¥â‚¬,~+]?/g,"");
if(required){
if(object_value.length==0){
return false;
}
}else{
if(object_value.length==0){
return true;
}
}
check_char=start_format.indexOf(object_value.charAt(0));
if(check_char==1){
decimal=true;
}else{
if(check_char<1){
return false;
}
}
for(var i=1;i<object_value.length;i++){
check_char=number_format.indexOf(object_value.charAt(i));
if(check_char<0){
return false;
}else{
if(check_char==1){
if(decimal){
return false;
}else{
decimal=true;
}
}else{
if(check_char==0){
if(decimal||digits){
trailing_blank=true;
}
}else{
if(trailing_blank){
return false;
}else{
digits=true;
}
}
}
}
}
return true;
}

function fcheckrange( object_value, min_value, max_value ) {
	if ( object_value.length == 0 )
		return true;
	if ( ! fchecknumber( object_value ) )
		return false;
	else
		return ( fnumberrange( ( eval( object_value ) ), min_value, max_value ) );
	return true;
}

function inputKeys( e, reKeys ) {
	var keynum, keychar;
	if( window.event ) // IE
	  { keynum = e.keyCode; }
	else if(e.which) // Netscape/Firefox/Opera
  { keynum = e.which; }
	keychar = String.fromCharCode(keynum);
	keycheck = /[0-9\.]/;
	return reKeys.test(keychar);
}

function validaNumero( o ) {
	num = o.value * 1;
	if ( isNaN( num ) ) {
		alert( 'Error: ' + o.value + ' no es un valor numérico.' );
		o.focus();
	}
}


