function comprobar_vendedor(vendedor)
{
	//alert (document.anuncio.vendedor.value);
	if(vendedor=="")
	{
		//alert (document.anuncio.vendedor.value);
		return false;
	}
	else
    {
		return true;
	}
		
}

function comprobar_telefono(telefono)
{
	
if(telefono.value.length < 9 || isNaN(telefono.value))
	{
     return false;
	}
 else 
	{
	 return true;
	}
}



function comprobar_enlace(enlace)
{//document.anuncio.enlace.value.indexOf("http://")!=0

	if(document.anuncio.enlace.value.indexOf("http://")!=0)
	
		{
			return (false);
		}
    else
	{
			return (true);
	}


}



function comprobar_mail(valor)
{
	
  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor))
	{
    //alert("La dirección de email " + valor + " es correcta.") 
    return (true)
	} 
	else
	{
    return (false);
	}
}
function lanza(formulario)
{
	//alert(formulario);
 if(comprobar_mail(formulario.mail.value)==false)
	{
		alert("La dirección de email es incorrecta.");
		formulario.mail.select();
		formulario.mail.style.background="#99CCFF";
	}
 else if(comprobar_telefono(formulario.telefono)==false)
	{
		alert("debe introducir el teléfono correctamente");
		formulario.telefono.select();
		formulario.telefono.style.background="#99CCFF";
	
	}
else if(comprobar_vendedor(formulario.nombre.value)== false)
	{
		alert("debe introducir algun nombre");
		formulario.nombre.select();
		formulario.nombre.style.background="#99CCFF";
	
	}
else if(comprobar_vendedor(formulario.ciudad.value)== false)
	{
		alert("debe introducir alguna ciudad");
		formulario.ciudad.select();
		formulario.ciudad.style.background="#99CCFF";
	
	}
else if(comprobar_vendedor(formulario.direccion.value)== false)
	{
		alert("debe introducir alguna direccion");
		formulario.direccion.select();
		formulario.direccion.style.background="#99CCFF";
	
	}
else if(comprobar_vendedor(formulario.provincia.value)== false)
	{
		alert("debe introducir alguna provincia");
		formulario.provincia.select();
		formulario.provincia.style.background="#99CCFF";
	
	}
else if(comprobar_vendedor(formulario.cp.value)== false)
	{
		alert("debe introducir algun codigo postal");
		formulario.cp.select();
		formulario.cp.style.background="#99CCFF";
	
	}
 else
	{
	 formulario.submit();
	}
}

function check_form_distribuidores(formulario)
{
	returnForm = true;
 if(comprobar_mail(formulario.mail2.value)==false)
	{
		alert("La dirección de email es incorrecta.");
		formulario.mail2.select();
		formulario.mail2.style.background="#99CCFF";
		returnForm = false;
	}
 else if(comprobar_telefono(formulario.telefono2)==false)
	{
		alert("debe introducir el teléfono correctamente");
		formulario.telefono2.select();
		formulario.telefono2.style.background="#99CCFF";
		returnForm = false;
	}
else if(comprobar_vendedor(formulario.nombre2.value)== false)
	{
		alert("debe introducir algun nombre");
		formulario.nombre2.select();
		formulario.nombre2.style.background="#99CCFF";
		returnForm = false;
	}
else if(comprobar_vendedor(formulario.ciudad2.value)== false)
	{
		alert("debe introducir alguna ciudad");
		formulario.ciudad2.select();
		formulario.ciudad2.style.background="#99CCFF";
		returnForm = false;
	}
else if(comprobar_vendedor(formulario.direccion2.value)== false)
	{
		alert("debe introducir alguna direccion");
		formulario.direccion2.select();
		formulario.direccion2.style.background="#99CCFF";
		returnForm = false;
	}
else if(comprobar_vendedor(formulario.provincia2.value)== false)
	{
		alert("debe introducir alguna provincia");
		formulario.provincia2.select();
		formulario.provincia2.style.background="#99CCFF";
		returnForm = false;
	}
else if(comprobar_vendedor(formulario.cp2.value)== false)
	{
		alert("debe introducir algun codigo postal");
		formulario.cp2.select();
		formulario.cp2.style.background="#99CCFF";
		returnForm = false;
	}
	return returnForm;
}
