function clearText(field){

    if (field.defaultValue == field.value) 
	{
		field.value = '';
		field.className = "inputbusqueda";
    }
}
function valida_envia(thisForm){
    	if ((document.thisForm.nombre.value.length==0)||(document.thisForm.correo.value.length==0)||(document.thisForm.apellido.value.length==0))
	{alert("Faltan datos...")
	
		}else	{ 
		checkemail("empleo")
		
		
	  	//alert("Se ha guardado el caso de éxito");
		if (resultado == true){
		document.thisForm.action = "guardaregistrate.php";
	    document.thisForm.submit();
		}else{
			//return 0;
			}
	}
		
	}
	
	

function valida_envia_personal(thisForm){
	
	if ((document.thisForm.nombre.value.length==0)||(document.thisForm.correo.value.length==0)||(document.thisForm.apellido.value.length==0)||(document.thisForm.grupo.value=="I"))
{alert("Hacen falta datos")

}else	{ 
		checkemail("personal")
		
		
	  	//alert("Se ha guardado el caso de éxito");
		if (resultado == true){
		document.thisForm.action = "guardaregistrate_personal.php";
	    document.thisForm.submit();
		}else{
			//return 0;
			}
	}
		
	}
	
	

var resultado
	function checkemail(origen){
    var str=document.thisForm.correo.value
    var filtro=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
    if (filtro.test(str))
        resultado=true
    else{
        alert("El correo electronico que ingresaste no es válido!")
        //resultado=false
		if(origen=="empleo")
		document.location.href="registrate_vacantes.php";
		if(origen=="personal")
		document.location.href="registrate_personal.php";
	}
}


