function solonumero(){
var key=window.event.keyCode;
if (key < 48 || key > 57){
window.event.keyCode=0;
}}


function sobre_texto_focus(objname, waterMarkText, style, style_n)
{
    obj = document.getElementById(objname);
    if(obj.value == waterMarkText)
    {
        obj.value="";
        obj.className = style_n
    }
}

function sobre_texto_encima(objname, waterMarkText, style, style_n)
{
    obj = document.getElementById(objname);
    if(obj.value == "")
    //if(!trim(obj.value))
    {
	    obj.value=waterMarkText;
        obj.className = style
    }
    else
    {
        obj.className = style_n
    }
}
function validar_docente(){
with(frm2){
	if (tnombre.value==""){
			alert("Ingrese sus nombres")
			tnombre.focus()
			return false;			
	}
	if (tapellido.value==""){
			alert("Ingrese sus apellidos")
			tapellido.focus()
			return false;			
	}
	if (grado.options[grado.selectedIndex].value==0){
			alert("Elija su grado")
			grado.focus()
			return false;			
	}
	if (tprof.value==""){
			alert("Ingrese su profesion")
			tprof.focus()
			return false;			
	}
	if (ttel.value==""){
			alert("Ingrese su telefono")
			ttel.focus()
			return false;			
	}
	if (!(/^[A-Za-z][A-Za-z0-9_]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/.test(tcorreo.value))){	   
			  alert("La dirección de email es incorrecta.");
			  tcorreo.focus()
			  return false;
		 }
		 frm2.action="index.php?page=insert_docente";
		 frm2.submit();
	
}}

/*************Validar PRE-INSCRIPCION************************/
function validar(frm1){
with(frm1){
	if (tnom.value=="Ejemplo: Nilo"){
			alert("Ingrese sus nombres")
			tnom.focus()
			return false;			
	}
	if (tape.value=="Ejemplo: Aspajo Perea"){
			alert("Ingrese sus Apellidos")
			tape.focus()
			return false;			
	}
	if (tedad.value=="Ejemplo: 18"){
			alert("Ingrese su Edad")
			tedad.focus()
			return false;			
	}
	if (tdir.value=="Ejemplo: Jr. Pasco 3675"){
			alert("Ingrese su dirección")
			tdir.focus()
			return false;			
	}
	if (cdistritos.options[cdistritos.selectedIndex].value==0){
			alert("Elija su distrito")
			cdistritos.focus()
			return false;			
	}
	if (ttel.value=="Ejemplo: 4046665"){
			alert("Ingrese su telefono")
			ttel.focus()
			return false;			
	}
	if (temail.value=="Ejemplo: ulasamericas@ejemplo.com"){
			alert("Ingrese su Email")
			temail.focus()
			return false;			
	}
	if (!(/^[A-Za-z][A-Za-z0-9_]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/.test(temail.value))){	   
			  alert("La dirección de email es incorrecta.");
			  temail.focus()
			  return false;
		 }

	
	if (tproc.value=="Ejemplo: Mariscal Oscar R. Benavides"){
			alert("Ingrese su colegio de procedencia")
			tproc.focus()
			return false;			
	}
	if (departamento.options[departamento.selectedIndex].value==0){
			alert("Elija su departamento del colegio")
			departamento.focus()
			return false;			
	}
	if (provincia.options[provincia.selectedIndex].value==0){
			alert("Elija su provincia del colegio")
			provincia.focus()
			return false;			
	}
	if (distritos.options[distritos.selectedIndex].value==0){
			alert("Elija su distrito del colegio")
			distritos.focus()
			return false;			
	}
	if (tipocolegio.options[tipocolegio.selectedIndex].value==0){
			alert("Elija tipo de colegio")
			tipocolegio.focus()
			return false;			
	}
	
	
	if (carrera.options[carrera.selectedIndex].value==0){
			alert("Elija la carrera")
			carrera.focus()
			return false;			
	}
		/*if (ok.checked ==false){
			alert("Debe confirmar su inscripción")
			ok.focus()
			return false;			
	}*/
	frm1.action="?page=confirmar";
	frm1.submit();
	
	
}
	
}

/*************Validar FICHA DE INSCRIPCION DIPLOMADO************************/
function validar2(formulario){
with(formulario){
	if (tpaterno.value==""){
			alert("Ingrese su apellido parteno")
			tpaterno.focus()
			return false;			
	}
	if (tmaterno.value==""){
			alert("Ingrese si apellido materno")
			tmaterno.focus()
			return false;			
	}
	if (tnombre.value==""){
			alert("Ingrese sus nombres")
			tnombre.focus()
			return false;			
	}
	if (tfechan.value==""){
			alert("Ingrese su fecha de nacimiento")
			tfechan.focus()
			return false;			
	}
	if (tlugarn.value==""){
			alert("Ingrese  lugar nacimiento")
			tlugarn.focus()
			return false;			
	}
	if (tdni.value==""){
			alert("Ingrese su DNI")
			tdni.focus()
			return false;			
	}
	if (tdomicilio.value==""){
			alert("Ingrese su domicilio")
			tdomicilio.focus()
			return false;			
	}
	if (cdistritos.options[cdistritos.selectedIndex].value==0){
			alert("Elija su distrito")
			cdistritos.focus()
			return false;			
	}
	
	if (tciudad.value==""){
			alert("Ingrese su ciudad")
			tciudad.focus()
			return false;			
	}
	
	if (ttelefono.value==""){
			alert("Ingrese su teléfono fijo")
			ttelefono.focus()
			return false;			
	}
	//**telefono pendiente**//
	
	/***********************/
	if (temail.value==""){
			alert("Ingrese su Email")
			temail.focus()
			return false;			
	}
		
	submit();
	
}
}

function validar3(formulario){
	with(formulario){
		if (tnom.value==""){
			alert("Ingrese su apellidon y  nombre completo")
			tnom.focus()
			return false;			
	    }
		if (ttel.value==""){
			alert("Ingrese su Teléfono")
			tnom.focus()
			return false;			
	    }
		if (!(/^[A-Za-z][A-Za-z0-9_]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/.test(temail.value))){	   
			  alert("La dirección de email es incorrecta.");
			  temail.focus()
			  return false;
		 }
		 
		action="index.php?page=insert_formulario_virtual";
		submit();
	}
	
	}


