// Esta funcion es valida solo para el grupo de ficheros de contacto


function Validar(){
    var txt = "Error en los siguientes campos: \n\n";
	msg_f = txt.length;

if (document.ValidarContacto.nombre.value == "")
	{
	 document.ValidarContacto.nombre.style.backgroundColor = "#C3C3C3"
	 txt+="\tNombre\n";
	}

if (document.ValidarContacto.departamento.selectedIndex == 0)
	{
	document.ValidarContacto.departamento.style.backgroundColor = "#C3C3C3"
	 txt+="\tDepartamento\n";
	}

if (document.ValidarContacto.empresa.value == "")
	{
	document.ValidarContacto.empresa.style.backgroundColor = "#C3C3C3"
	 txt+="\tEmpresa\n";
	}

if (document.ValidarContacto.direccion.value == "")
	{
	document.ValidarContacto.direccion.style.backgroundColor = "#C3C3C3"
	 txt+="\tDirección\n";
	}

if (document.ValidarContacto.cargo.value == "")
	{
	 document.ValidarContacto.cargo.style.backgroundColor = "#C3C3C3"
	 txt+="\tCargo\n";
	}

if (document.ValidarContacto.telefono.value == "")
	{
	 document.ValidarContacto.telefono.style.backgroundColor = "#C3C3C3"
	 txt+="\tTelefono\n";
	}

/*

if ( TestMail(document.ValidarContacto.correo.value) == false )
	{
	 document.ValidarContacto.correo.style.backgroundColor = "#C3C3C3"
	 txt+="\tE-Mail\n";
	}

if (document.ValidarContacto.fax.value == "")
	{
	 document.ValidarContacto.fax.style.backgroundColor = "#C3C3C3"
	 txt+="\tFax\n";
	}

if (document.ValidarContacto.movil.value == "")
	{
	 document.ValidarContacto.movil.style.backgroundColor = "#C3C3C3"
	 txt+="\tMóvil\n";
	}

 if (document.ValidarContacto.web.value == "")  
	{
 document.ValidarContacto.web.style.backgroundColor = "#C3C3C3"
	 txt+="\tWeb\n";
	}
	*/
	
if (document.ValidarContacto.referido.selectedIndex == 0)
	{
	 document.ValidarContacto.referido.style.backgroundColor = "#C3C3C3"
	 txt+="\tReferido\n";
	}
	
if (document.ValidarContacto.comentario.value == "")
	{
	 document.ValidarContacto.comentario.style.backgroundColor = "#C3C3C3"
	 txt+="\tComentario\n";
	}

if(document.ValidarContacto.aceptarCondiciones.checked == false )
	{
	document.ValidarContacto.aceptarCondiciones.style.backgroundColor = "#C3C3C3"
	txt+="\tAceptar Condiciones de Uso\n";
	}
	

if (msg_f != txt.length){
	alert(txt);
	return false;
	}else{
		return true;
	}
}




function TestMail(texto)
{
  var correcto=true;
  if ((texto.indexOf("@")<1) || (texto.indexOf("@")>8))
    { correcto=false; }
  if ( (texto.indexOf(".com")<0) &&  (texto.indexOf(".do")<0) && (texto.indexOf(".cu")<0) && (texto.indexOf(".cl")<0) && (texto.indexOf(".br")<0) && (texto.indexOf(".ch")<0) && (texto.indexOf(".pt")<0) && (texto.indexOf(".it")<0) && (texto.indexOf(".uk")<0) && (texto.indexOf(".mx")<0) && (texto.indexOf(".ar")<0) && (texto.indexOf(".de")<0) && (texto.indexOf(".fr")<0) && (texto.indexOf(".biz")<0) && (texto.indexOf(".info")<0) && (texto.indexOf(".net")<0) && (texto.indexOf(".es")<0)  && (texto.indexOf(".org")<0) &&  (texto.indexOf(".edu")<0) )
    { correcto=false; }
  
return correcto;
}

