function focusAdv(){
  if (document.formAdv.nameAdv.value == "") {
    document.formAdv.nameAdv.focus();
  }
}


function checkAndSend(){

  // check imagefilename
  if (document.formAdv.photo1Adv.value!=""){
    var point = document.formAdv.photo1Adv.value.lastIndexOf(".");
    var end = document.formAdv.photo1Adv.value.length;
    var extension = document.formAdv.photo1Adv.value.substring(point+1, end);
    
    if (extension == "jpg" || extension == "JPG" || extension == "jpeg" || extension == "JPEG")   
      ;
    else {
      alert("Recuerda, el archivo de foto debe ser con formato JPG o JPEG. Vuelve a intentarlo. Gracias.");
      return;
    }
  }

  // check name
  if (document.formAdv.nameAdv.value == "") {
    alert("Falta el Nombre");
    document.formAdv.nameAdv.focus();
    return;
  }
  // check email
  if (document.formAdv.emailAdv.value == "") {
    alert("Falta el EMail");
    document.formAdv.emailAdv.focus();
    return;
  }

  // check telephone
  if (document.formAdv.phoneAdv.value == "") {
    alert("Falta el Teléfono");
    document.formAdv.phoneAdv.focus();
    return;
  }

  // check title
  if (document.formAdv.titleAdv.value == "") {
    alert("Falta el Modelo");
    document.formAdv.titleAdv.focus();
    return;
  }

  // check price
  if (document.formAdv.priceAdv.value == "") {
    alert("Falta el Precio");
    document.formAdv.priceAdv.focus();
    return;
  }

  // check if price is numeric
  if(isNaN(document.formAdv.priceAdv.value) == true) {
    alert("Usa solo numeros en el cuadro del precio");
    return;
  }
 
  document.formAdv.submit();
}