function valida(form)
{
	
	status="";
	control="";
		
	if (trim(form.men.value) == "")
		control=form.men;
	if (trim(form.ciu.value) == "")
		control=form.ciu;
	if (trim(form.dir.value) == "")
		control=form.dir;
	if (trim(form.ema.value) == "")
		control=form.ema;
	if (trim(form.nom.value) == "")
		control=form.nom;
	
	email1=form.ema.value;
	if (trim(email1) != "")
	{
		if ((email1.indexOf("@") == -1) || (email1.indexOf(".") == -1) || (email1.indexOf(" ") != -1))
		{
			alert('ERROR: Debes escribir una dirección de e-mail válida');
			staus = 'La dirección e-mail no es válida'
			form.ema.focus();
			form.ema.select();
			return false;			
		}
	}		
	
	if (control != "")
	{
		alert("ERROR: Los campos marcados con * son obligatorios...");
		status = "Este campo no puede estar en blanco";		
		control.focus();
		return false;
	} 
	
}
	
function trim(s)
{
	while (s.substring(0,1) == ' ')
		s = s.substring(1,s.length);

	while (s.substring(s.length-1,s.length) == ' ')
		s = s.substring(0,s.length-1);
	return s;
}

function confirmar( mensaje, destino)
{
	if (confirm(mensaje))
		location = destino;
}	

function validanum(evt)
{									
	evt = (evt) ? evt : event;
    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : 
        ((evt.which) ? evt.which : 0));
    if ((charCode > 47) && (charCode < 58)||(charCode==32)||(charCode==8)||(charCode==46)||(charCode==37)||(charCode==39)) 
        return true;
    else
    	return false;
}