function olvida()
  {
   
   url = "olvida.php";
   opcions = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbar=0,resizable=0";
   amplada = 470;
   opcions = opcions + ",width=" + amplada;
   alsada = 170;
   opcions = opcions + ",height=" + alsada;
   //posX = (screen.width - amplada) / 2;
   posX = 600;
   opcions = opcions + ",left=" + posX;
   //posY = (screen.height - alsada) / 2;
   posY = 50;
   opcions = opcions + ",top=" + posY;
   
   window.open(url,'Notes',opcions);
  }

 function borraranuncio(id, nom)
  {
  if (confirm("¿Estás apunto de borrar " + nom + ", estás seguro?"))
  {
  document.location="eliminaranuncio.php?id=" + id;
  }
  else {alert("Acción cancelada")}
  }
  
  
function cambialocalidad(provincia,categoria)
  {

    document.location="index.php?provincia=" + provincia + "&categoria=" + categoria;

  }
  
  
  function confirmacion()
  {
  missatge = "";
    if (this.formulari.nombre.value == "")
      {
         missatge = missatge + "Debe introducir un nombre\n";         
      }
    if (this.formulari.apellidos.value == "")
      {
         missatge = missatge + "Debe introducir sus apellidos\n";         
      }
    if (this.formulari.cif.value == "")
      {
         missatge = missatge + "Debe introducir su número de CIF/NIF\n";         
      }
    if (this.formulari.calle.value == "")
      {
         missatge = missatge + "Debe introducir su dirección\n";         
      }
    if (this.formulari.localidad.value == "")
      {
         missatge = missatge + "Debe introducir su localidad\n";         
      }
    if (this.formulari.cp.value == "")
      {
         missatge = missatge + "Debe introducir el código postal\n";         
      }
    if (this.formulari.telefono1.value == "")
      {
         missatge = missatge + "Debe introducir su teléfono\n";         
      }
    if (this.formulari.usuario.value == "")
      {
         missatge = missatge + "\nDebe introducir su nombre de usuario\n";         
      }
    if (this.formulari.clave.value == "")
      {
         missatge = missatge + "Debe introducir su password\n";         
      }
    if (this.formulari.clave.value == "")
      {
         missatge = missatge + "Debe reintroducir su password\n";         
      }
      
    if (this.formulari.clave.value != this.formulari.clave2.value)
      {
        missatge = missatge + "Las contraseñas no coinciden";
      }
      
      
    if (missatge == "")
      this.formulari.submit();
    else 
      alert(missatge);
  }
  
function confirmacionanuncio()
  {
  missatge = "";
    if (this.formulari.nombre.value == "")
      {
         missatge = missatge + "Debe introducir un nombre de establecimiento\n";         
      }
    if (this.formulari.calle.value == "")
      {
         missatge = missatge + "Debe introducir la dirección\n";         
      }
    if (this.formulari.localidad.value == "")
      {
         missatge = missatge + "Debe introducir la localidad\n";         
      }
    if (this.formulari.cp.value == "")
      {
         missatge = missatge + "Debe introducir el código postal\n";         
      }
    if (this.formulari.telefono1.value == "")
      {
         missatge = missatge + "Debe introducir un teléfono\n";         
      }


      
    if (missatge == "")
      this.formulari.submit();
    else 
      alert(missatge);
  }
  
  





function favChange(rnum) {
var supportsKeys = false
	f = document.newMsg;
	
	if (f.favs.selectedIndex >=0) {
		f.msgTo.value = f.favs.options[f.favs.selectedIndex].value
	}

	if (f.favs.selectedIndex > 0 && f.favs.selectedIndex <= rnum + 1) {
		f.msgText.focus();
	} else {
		f.msgTo.focus();
	}
}
function calcCharLeft(f) {
		lenUSig = f.lenSSig.value
		maxLength = 200 - f.lenSysSig.value - lenUSig
        if (f.msgText.value.length > maxLength) {
	        f.msgText.value = f.msgText.value.substring(0,maxLength)
		    charleft = 0
        } else {
			charleft = maxLength - f.msgText.value.length
		}

        f.msgCL.value = charleft
}

function textKey(f) {
	supportsKeys = true
	calcCharLeft(f)
}

function enviaf()
{
document.formulari.submit();
}

var popUpWin=0;
function MnuMapa_onclick(id) {
 if(popUpWin) {
     if (!popUpWin.closed) popUpWin.close();
 }
 popUpWin = open(id, 'popUpWin', 'toolbar=no,location=no,directories=no,satus=no,menubar=no,resizable=no,copyhistory=no,width=600,height=550,scrollbar=yes');
}
