function change_select()
	{
	if(document.getElementById("conocio_select").value=='20')
		{
		document.getElementById("conocio_otros").readOnly = false;
		document.getElementById("conocio_otros").style.backgroundColor = 'dfeaf7';
		}
	else
		{
		document.getElementById("conocio_otros").readOnly = true;
		document.getElementById("conocio_otros").style.backgroundColor = 'ccdcf4';
		document.getElementById("conocio_otros").value = '';
		}
	}
function setColor(el,color,bg)
{
  if (el.style) el.style.color = color;
  if (el.style) el.style.background = bg;
}
function validar_pais()
{
	var bgDesactivo = "#CCDDF2";
	var bgActivo = "#DFEAF7";
	var color_activo = "#0033CC";
	var color_desactivo = "#FFFFFF";

	var color_activo2		= "#0033CC";
	var bgActivo2			= "#eeeec0";
	var bgDesactivo2		= "#aaaa60";
	var color_desactivo2	= "#0033CC";


	if(document.getElementById("pais").value=="E")
	{
		document.getElementById("provincia").disabled=false;
		setColor(document.getElementById("provincia"), color_activo2, bgActivo2);
		document.getElementById("otra_provincia").disabled=true;
		setColor(document.getElementById("otra_provincia"), color_desactivo2, bgDesactivo2);
		document.getElementById("cp").disabled=false;
		setColor(document.getElementById("cp"), color_activo2, bgActivo2);
		ocument.getElementById("cp").value=document.getElementById("provincia").value;
	}
	else
	{
		document.getElementById("provincia").disabled=true;
		setColor(document.getElementById("provincia"), color_desactivo2, bgDesactivo2);
		document.getElementById("otra_provincia").disabled=false;
		setColor(document.getElementById("otra_provincia"), color_activo2, bgActivo2);
		document.getElementById("cp")='';
		document.getElementById("cp").disabled=false;
		//setColor(document.formu.cp, color_desactivo, bgDesactivo);
		//document.formu.cp.value="Solo España";
	}
}
function validar_cp()
{
	document.getElementById("cp").value=document.getElementById("provincia").value;
}

function valida_dir(){
//Función que detecta si se han seleccionado campos relativos a la dirección postal.
//Esto obligará a activar las validaciones necesarias para rellenar bien los campos.

	var direccion = false;
	var otra_provincia, loc, dir, cp = '';

	otra_provincia = document.getElementById("otra_provincia").value;
	loc = document.getElementById("loc").value;
	dir = document.getElementById("dir").value;
	cp = document.getElementById("cp").value;

	if (otra_provincia + loc + dir != ''){
	 direccion = true;
	}
	if (cp != '28'){
	 direccion = true;
	}

	return direccion;
}


function validar_sol_doc(f)
	{

	var nombre=document.getElementById("nombre_s");
	var email=document.getElementById("email_s");
	var documento=document.getElementById("documento_s");
	var subject=document.getElementById("subject_s");
	var departamento=document.getElementById("departamento_s");
	var concopia=document.getElementById("concopia_s");


	var valido=0;
	var texto="";

	if(nombre.value==""){

		valido=1;
		texto=texto+"-. El nombre no puede estar vacio.\n";
	}

if(documento){
if (documento.value=="" ){

		valido=1;
		texto=texto+"-. Tiene que introducir algun documento.\n";
	}

}
else{
valido=1;
		texto=texto+"-. Tiene que introducir algun documento.\n";
}



	if (email)
		 {



			if(email.value=="")
			{
				texto=texto + "-. Debe Rellenar el E-MAIL.\n";
				valido=1;
			}

			if(email.value!="")
			{
				var re  = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
				if (!re.test(email.value))
				{
				valido=1;
				texto=texto + "-. Debe corregir el E-MAIL.\n";
				}
			}
		  }



	if(valido==1)
	{
		alert('Debe Corregir los siguientes errores:\n\n' + texto);
		return false;
	}
	else{
	if(concopia.checked){
			copia=true;
		}
		else{
			copia=false;
		}
		xajax_envio_mails(nombre.value,email.value,documento.value,subject.value,copia,departamento.value);
		return true;

	}
	}
function validar_sugerencias(f)
	{

	var nombre=document.getElementById("nombre_su");
	var email=document.getElementById("email_su");
	var documento=document.getElementById("documento_su");
	var subject=document.getElementById("subject_su");
	var concopia=document.getElementById("concopia_su");


	var valido=0;
	var texto="";

	if(nombre.value==""){

		valido=1;
		texto=texto+"-. El nombre no puede estar vacio.\n";
	}

if(documento){
if (documento.value=="" ){

		valido=1;
		texto=texto+"-. Tiene que introducir algun documento.\n";
	}

}
else{
valido=1;
		texto=texto+"-. Tiene que introducir algun documento.\n";
}



	if (email)
		 {



			if(email.value=="")
			{
				texto=texto + "-. Debe Rellenar el E-MAIL.\n";
				valido=1;
			}

			if(email.value!="")
			{
				var re  = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
				if (!re.test(email.value))
				{
				valido=1;
				texto=texto + "-. Debe corregir el E-MAIL.\n";
				}
			}
		  }



	if(valido==1)
	{
		alert('Debe Corregir los siguientes errores:\n\n' + texto);
		return false;
	}
	else{
		if(concopia.checked){
			copia=true;
		}
		else{
			copia=false;
		}
		xajax_envio_mails(nombre.value,email.value,documento.value,subject.value,copia,null);
		return true;

	}
	}
function validar_pregunta(f)
	{

	var nombre=document.getElementById("nombre_p");
	var email=document.getElementById("email_p");
	var documento=document.getElementById("documento_p");
	var subject=document.getElementById("subject_p");
	var concopia=document.getElementById("concopia_p");


	var valido=0;
	var texto="";

	if(nombre.value==""){

		valido=1;
		texto=texto+"-. El nombre no puede estar vacio.\n";
	}

if(documento){
if (documento.value=="" ){

		valido=1;
		texto=texto+"-. Tiene que introducir algun documento.\n";
	}

}
else{
valido=1;
		texto=texto+"-. Tiene que introducir algun documento.\n";
}



	if (email)
		 {



			if(email.value=="")
			{
				texto=texto + "-. Debe Rellenar el E-MAIL.\n";
				valido=1;
			}

			if(email.value!="")
			{
				var re  = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
				if (!re.test(email.value))
				{
				valido=1;
				texto=texto + "-. Debe corregir el E-MAIL.\n";
				}
			}
		  }



	if(valido==1)
	{
		alert('Debe Corregir los siguientes errores:\n\n' + texto);
		return false;
	}
	else{
	if(concopia.checked){
			copia=true;
		}
		else{
			copia=false;
		}
		xajax_envio_mails(nombre.value,email.value,documento.value,subject.value,copia,null);
		return false;

	}
	}