function mostrar(id) {
  window.open("cargarcarrito.php?var="+id,"_blank","width=280,height=315,toolbars=no,\
  scrollbars=yes,resize=no");
}

function mostrar_c() {
  window.open("loadcarrito.php","_blank","width=550,height=250,toolbars=no,\
  scrollbars=yes,resize=no");
}

function mostrar_p() {
  window.open("loadpedido.php","_blank","width=550,height=450,toolbars=no,\
  scrollbars=yes,resize=no");
}

function valid_fm1(){
  var cntID=document.fm1.cnt_txt

  if ((cntID.value==null)||(cntID.value=="")){
    alert("Por favor, ingrese la cantidad que desea presupuestar")
    cntID.focus()
    return false
  }
  return true
}
 
function echeck(str) {
  var at="@"
  var dot="."
  var lat=str.indexOf(at)
  var lstr=str.length
  var ldot=str.indexOf(dot)
  if (str.indexOf(at)==-1){
     alert("La cuenta de email ingresada no es correcta")
     return false
  }
  if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
     alert("La cuenta de email ingresada no es correcta")
     return false
  }
  if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
      alert("La cuenta de email ingresada no es correcta")
      return false
  }
   if (str.indexOf(at,(lat+1))!=-1){
      alert("La cuenta de email ingresada no es correcta")
      return false
   }
   if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
      alert("La cuenta de email ingresada no es correcta")
      return false
   }
   if (str.indexOf(dot,(lat+2))==-1){
      alert("La cuenta de email ingresada no es correcta")
      return false
   }
   if (str.indexOf(" ")!=-1){
      alert("La cuenta de email ingresada no es correcta")
      return false
   }
   return true
}
 
function valid_fm2(){
  var apeID=document.fm2.ape_txt
  var nomID=document.fm2.nom_txt
  var locID=document.fm2.loc_txt
  var proID=document.fm2.pro_txt
  var paiID=document.fm2.pai_txt
  var emaID=document.fm2.ema_txt

  if ((apeID.value==null)||(apeID.value=="")){
    alert("Debe completar el campo APELLIDO")
    apeID.focus()
    return false
  }
  
  if ((nomID.value==null)||(nomID.value=="")){
    alert("Debe completar el campo NOMBRE")
    nomID.focus()
    return false
  }
  
  if ((locID.value==null)||(locID.value=="")){
    alert("Debe completar el campo LOCALIDAD/CIUDAD")
    locID.focus()
    return false
  }
  
  if ((proID.value==null)||(proID.value=="")){
    alert("Debe completar el campo PROVINCIA/ESTADO")
    proID.focus()
    return false
  }
  
  if ((paiID.value==null)||(paiID.value=="")){
    alert("Debe completar el campo PAIS")
    paiID.focus()
    return false
  }
  
  if ((emaID.value==null)||(emaID.value=="")){
    alert("Debe completar el campo EMAIL")
    emaID.focus()
    return false
  }
  
   if (echeck(emaID.value)==false){
    emaID.value=""
    emaID.focus()
    return false
  }
  
  return true
}

function mi_prep_cursor() {
    document.mp_img.style.cursor = 'hand';
}

function env_prep_cursor() {
    document.env_img.style.cursor = 'hand';
}

function valid_fm3(){
  var nomID=document.fm3.nom_txt
  var emaID=document.fm3.ema_txt
  var menID=document.fm3.men_txt

  if ((nomID.value==null)||(nomID.value=="")){
    alert("Debe completar el campo NOMBRE")
    nomID.focus()
    return false
  }
  
  if ((emaID.value==null)||(emaID.value=="")){
    alert("Debe completar el campo EMAIL")
    emaID.focus()
    return false
  }

   if (echeck(emaID.value)==false){
    emaID.value=""
    emaID.focus()
    return false
  }

  if ((menID.value==null)||(menID.value=="")){
    alert("Debe completar el campo MENSAJE")
    menID.focus()
    return false
  }

  return true
}

