//Evalua si una caja de texto tiene contenido, de no tener coloca el foco sobre el control.
function TextVacio(Object,msg)
{
if(Object.value=="")
{
	alert(msg);
	Focus(Object);	
	return true;
}
}
//Evalua si un DropDownlist tiene seleccionada alguna opcion. 
function DDLVacio(Object,msg)
{
if(Object.value=="-1")
{
	alert(msg);
	Focus(Object);	
	return true;
}	
}
//Evalua el numero de caracteres que pueden ingresar en una caja de texto
function TxtMayorCaracteres(Object,NoCarateres,msg)
{
if(Object.value.length > NoCarateres)
{
	alert(msg);
	Focus(Object);	
	return true;
}
}
//Evalua el numero mímino de caracteres que pueden ingresar en una caja de texto
function TxtMenorCaracteres(Object,NoCarateres,msg)
{
if(Object.value.length < NoCarateres)
{
	alert(msg);
	Focus(Object);	
	return true;
}
}
//Coloca el foco sobre el elemento indicado
function Focus(Object)
{
	Object.focus();
}

//Permite unicamente el ingreso de numeros
//function SoloNumeros(event,this)
//{
//if ((event.keyCode < 48) || (event.keyCode > 57)) 
//event.returnValue = false
//}

//Funcione que permite unicamente el ingreso de numeros 

function teclaEvento(evento)
{ 
if (evento.keyCode)
	return evento.keyCode;
else
	return evento.which;
}

function continuarEvento(evento,continuar)
{ 
if (evento.preventDefault && !continuar)
{
	evento.preventDefault();
	evento.stopPropagation();
}
return continuar;
}

function SoloNumeros(event,txtCampo)
{
var ac;
//no utilizo el name ya tengo la referencia del text
var texto = txtCampo.value;
ac = teclaEvento(event);
if(ac == event.keyCode && ((ac < 48) || (ac > 57)))
{
	event.returnValue = false
}
else if(ac != event.keyCode && ((ac >= 48) && (ac <= 57)))
{
	event.returnValue = false
}
//if ((ac < 48) || (ac > 57))// || (ac == 44) || (ac == 46) || (ac == 13) || (ac == 8) || (ac == 9))
//{
//	event.returnValue = false
//}
else 
{
	if (ac == 46) 
	{
//en fire fox no puedes cambiar el codigo de la tecla
//o no lo he visto lo que puedes hacer es cancelar el evento
//window.event.keyCode = ac - 2;
		continuarEvento(event,false)
	}
	else 
	{
		if (ac == 13)
		{
			window.lnkIntro.click();
		}
		else
		{
//window.event.keyCode = " ";
//esta funcion te garantiza que canceles el evento tanto en ie como en ff
			return continuarEvento(event,false)
		}
	}
//document.forms.item(0).item(txtCampo).value = texto;
texto = "";
}
}
// Fin Funcion

//
function CerrarPopUp(Div,Iframe)
{		
var lFondo = window.parent.document.getElementById('DivFondo');
var lIFrame = window.parent.document.getElementById("ifrInfoExterna");
lFondo.style.visibility = "hidden";
lIFrame.style.visibility = "hidden";
}	

function Ocultar(obj,msg)
{
	if (obj.style.display == "none")
	{
	alert(msg);
	return true;
	}
}

function TxtMaxCaracteres(Object,NoCarateres)
{
	
	var ac;
	ac = teclaEvento(event);
	//alert(Object);
	if(Object.value.length >= NoCarateres)
	{
		event.returnValue = false;
	}
	else
	{
		event.returnValue = true;
	}
}

