function destino(){
url = document.formulario.obj_select.options[document.formulario.obj_select.selectedIndex].value
if (url != " no") window.location = url;
}

function mostrarColor(){
	div=document.getElementById('color');
	div.style.display='visible';
	<!--div=document.getElementById('byn');
	<!--div.style.display='none';
	}
function mostrarByn(){
	div=document.getElementById('byn');
	div.style.display='visible';
	<!--div=document.getElementById('color');
	<!--div.style.display='none';}
	}
	
function validarFormulario(){
	//var empresa = document.getElementById("empresa");
	//var persona = document.getElementById("contacto");
	var email = document.getElementById("email");
	//var asunto = document.getElementById("asunto");
	var mensaje = document.getElementById("cuerpo");
	var datos = document.getElementById("politica_datos");
	var telf = document.getElementById("telefono");
	//validarEmpresa(empresa);
	//validarPersona(persona);
	//validarAsunto(asunto);
	validarEmail(email);
	validarMensaje(mensaje);
	validarProteccionDatos(datos);
	//validarTelefono(telf);
	//mensaje.value='me esta tocando los cojones este textarea'
	if (validarEmail(email)==false || validarMensaje(mensaje)==false || validarProteccionDatos(datos)==false){
		alert("debe rellenar correctamente los campos marcados en color rojo")
		return false
	}else{
		return true
	}
	}
function validarEmpresa(empresa){
	if (empresa.value.length <4) {
		empresa.style.borderColor='red';
		return false;
	}else{
		empresa.style.borderColor='green';
		return true;
	}}
function validarPersona(persona){
	if (persona.value.length<4) {
		persona.style.borderColor='red';
		return false;
	}else{
		persona.style.borderColor='green';
		return true;
	}}
function validarAsunto(asunto){
	if (asunto.value.length < 4) {
		asunto.style.borderColor='red';
		return false;
	}else{
		asunto.style.borderColor='green';
		return true;
	}}
function validarMensaje(mensaje){
	
	if ( mensaje.value.length<4) {
		mensaje.style.borderColor='red';
		return false;
	}else{
		mensaje.style.borderColor='green';
		return true;
	}
}
function validarEmail(email){
	///^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3,4})+$/
	///^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)
	///^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$/ .test(email)
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email.value) ){
	email.style.borderColor='green';
return true
} else {
	email.style.borderColor='red';
return false
}
}

function validarProteccionDatos(datos){
	if (datos.checked==false){
		datos.style.borderColor='red';
		document.getElementById("he_leido").style.borderWidth='1px'
		document.getElementById("he_leido").style.borderStyle='solid'
		document.getElementById("he_leido").style.borderColor='red'
		//document.getElementById("he_leido").style.backgroundColor='red'
		return false
	}else{
		datos.style.borderColor='green';
		document.getElementById("he_leido").style.borderWidth='1px'
		document.getElementById("he_leido").style.borderStyle='solid'
		document.getElementById("he_leido").style.borderColor='green'
		//document.getElementById("he_leido").style.backgroundColor='green'
		return true
	}
}

function validarTelefono(telf){
	if(/^\d{9}$/.test(telf.value)){
		telf.style.backgroundColor='green'
		//telf.style.borderColor='green';
		//telf.style.borderWidth='1px';
		//telf.style.borderStyle='solid';
		return true
	}else{
		telf.style.backgroundColor='red'
		//telf.style.borderColor='red';
		//telf.style.borderWidth='1px';
		//telf.style.borderStyle='solid';
		return false
	}
	}
