function changeSelect(id){
	if(document.getElementById(id).selectedIndex < 2)
		document.getElementById(id).selectedIndex = 0;
}

function Enviar(){
	f = document.frmContacto;
	if(f.nombre.value == ""){
		alert("Por favor, introduce tu nombre!");
		f.nombre.focus();
		return;
	}
	if(f.email.value == ""){
		alert("Por favor, introduce tu e-mail!");
		f.email.focus();
		return;
	}else if(!check_email(f.email.value)){
		alert("Por favor, introduce un e-mail valido!");
		f.email.focus();
		return;
	}
	if(f.departamento.selectedIndex < 2){
		alert("Por favor, selecciona un departamento!");
		f.departamento.focus();
		return;
	}
	if(f.mensaje.value == ""){
		alert("Por favor, introduce un mensaje!");
		f.mensaje.focus();
		return;
	}
        if (f.recaptcha_response_field.value=="") {
		alert("Introduzca el codigo de seguridad");
		f.recaptcha_response_field.focus();
                return;
	}

	f.submit();
}

function check_email(e){
	ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";
	for(i=0; i < e.length ;i++){
		if(ok.indexOf(e.charAt(i))<0){ 
			return (false);
		}	
	} 
	if (document.images){
		re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
		re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
		if (!e.match(re) && e.match(re_two)){
			return (-1);		
		} 
	}
}
