<!-- Te permite poner solo numeros en una caja de texro	--> 
var nav4 = window.Event ? true : false;

<!-- Te permite poner solo numeros en una caja de texto	--> 
function acceptNum(evt)
{	
	// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57	
	var key = nav4 ? evt.which : evt.keyCode;	
	return ((key <= 13) || (key >= 48 && key <= 57) || (key ==32) ||  (key == 42) ||  (key == 40) ||  (key == 41) ||  (key == 45));
}

function acceptNum2(evt)
{	
	// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57	
	var key = nav4 ? evt.which : evt.keyCode;	
	return (key <= 13 || (key >= 48 && key <= 57));
}
 
function decimal()
{
	var e_k = event.keyCode;
	if (e_k > 33 && e_k < 45 || e_k == 47 || e_k > 57)
	{
		event.returnValue = false;
	}
}

	var reDecimalPt = /^[+-]?((\d+|\d{1,3}(\.\d{3})+)(\,\d*)?|\,\d+)$/;
	var reDecimalEn = /^[+-]?((\d+|\d{1,3}(\,\d{3})+)(\.\d*)?|\.\d+)$/;
	var reDecimal = reDecimalEn;

function doDecimal(pStr)
{
	charDec = ( pStr != "En"? ",": "." );
	if (reDecimal.test(pStr))
	{
		pos = pStr.indexOf(charDec);
		decs = pos == -1? 0: pStr.length - pos - 1;
	}
	else
		if (pStr != null && pStr != "")
		{
			alert(pStr + " No es un numero decimal. utilizar punto para las décimas");
			return (false);
		}
} // doDecimal

function Ir(VER)
{
    window.document.formulario.ver_opt.value=VER;
	window.document.formulario.submit();
} 

function Validar(theForm)
{var checkStr = theForm.login.value;
  if (checkStr.length==0)
	{
    alert("Ingrese su codigo de Usuario, por favor.");
    theForm.login.focus();
    return (false);
	}	
 var checkStr = theForm.passw.value;
  if (checkStr.length==0)
	{
    alert("Ingrese su Contrasena, por favor.");
    theForm.passw.focus();
    return (false);
	}	
 return (true);
}

function Validar_RecC(theForm)
{
 var checkStr = theForm.email.value;
 	if ((checkStr.length==0) || (checkStr.replace(/ /g, '') == ''))
	{
    	alert("Ingrese el Correo o Usuario registrado, por favor.");
		theForm.email.focus();
		theForm.email.select();
	    return (false);
	}
	
	
 	
 return (true);
}

function Login()
{
	if (Validar(window.document.formulario))
	{	
		ValidarAjax()
	}
}

function Login1()
{
	if (Validar(window.document.formulario))
	{	
		ValidarAjax1()
	}
}

function Login_admin()
{
	if (Validar(window.document.formulario))
	{
		window.document.formulario.action="verifica.php";	
		window.document.formulario.submit();
	}
}

function Validar_selcurso(theForm)
{
	var checkStr2 = theForm.idcursoX;
	if (checkStr2[0].selected == true )
	{
    	alert("Seleccione un Curso, por favor.");
	    theForm.idcursoX.focus();
    	return (false);
	}	
 return (true);
}

function SelCurso()
{
	 
	if (Validar_selcurso(window.document.formulario))
	{
 		window.document.formulario.action="administration/interna2.php";	
		window.document.formulario.submit();
	}
}

function Correo(login,passw)
{
	window.open("confirmacion.php?id_pre="+ login ,"venta1","width=10,height=10,top=0,left=0",1);
}

function SelCurso1()
{
	 
	if (Validar_selcurso(window.document.formulario))
	{
 		window.document.formulario.action="../demo/administration/interna2.php";	
		window.document.formulario.submit();
	}
}

/* **********  Funcion para recuperar contraseña a traves de correo *********/
function RecC()
{
	if (Validar_RecC(window.document.formulario))
	{
		window.document.formulario.action="pswwr_e.php";	
		window.document.formulario.submit();
	}
}

function Ir_inicio_verifica(IDUSU)
{
    window.document.formulario.Usuario_session.value=IDUSU;
	window.document.formulario.action="index.php";
	window.document.formulario.submit();
}


function Validar_admin(theForm)
<!-- Validacion de Formulario INGRESO NOTICIAS -->
{
	var checkStr = theForm.loginadministrador.value;
	if (checkStr.length==0)
	{
    	alert("Ingrese su Login, por favor.");
	    theForm.loginadministrador.focus();
    	return (false);
	}	
	if (checkStr.length!=0)
	{
		if (checkStr.replace(/ /g, '') == '')
		{
			alert("No se aceptan espacios en blanco.");
			theForm.loginadministrador.focus();
			theForm.loginadministrador.select();
			return (false);
		}
	}
	
	var checkStr = theForm.claveadministrador.value;
	if (checkStr.length==0)
	{
    	alert("Ingrese su Clave, por favor.");
	    theForm.claveadministrador.focus();
    	return (false);
	}
	
	if (checkStr.length!=0)
	{
		if (checkStr.replace(/ /g, '') == '')
		{
			alert("No se aceptan espacios en blanco.");
			theForm.claveadministrador.focus();
			theForm.claveadministrador.select();
			return (false);
		}
	}
 return (true)
}

function EDITAR_ADMIN(VER,ENVIAR)
{
	if (Validar_admin(window.document.formulario))
	{
		window.document.formulario.enviar.value=ENVIAR;
		window.document.formulario.ver_opt.value=VER;
		window.document.formulario.submit();
	}
}
