// JavaScript Document
//http://www.quirksmode.org/js/forms.html#scheckbox

function Entrar(op){
	if(op=='FU')
     document.FU.submit();
    else
	 document.session.submit();
    
}

function Cancelar(op){
 document.getElementById("name").value="";
 document.getElementById("contrasena").value="";

}


function cambiarImagenOver(img2){
document.all.imagen.src="../../botones/not2.jpg";
}

function cambiarImagenOut(img1){
document.all.imagen.src="../botones/"+img1;
} 

function SendInfo(){
 validar=validarNoticias();
 if(validar==true){
  document.FAN.submit();
}else{}
}

function SendPro(){
validar=validarProductos();
if(validar==true){
 document.FAP.submit();
}else{
	   //alert("Debes de capturar todos los datos");
	 }

}

function SendPros(){
 document.FADP.submit();
}

function SendIn(){
 document.FAI.submit();
}

function EditIn(){
 document.FEI.submit();
}

function EditCat(){
 document.FEC.submit();
}

function EditPro(){
 if(confirm("Esta seguro de actualizar los datos de este producto?"))
  document.FEP.submit();
 else{ }
}

function EditProd(){
 if(confirm("Esta seguro de actualizar los datos de este producto?"))
  document.FEPD.submit();
 else{ }
}

function SendCat(){
 validar=validarCategoria();
 if(validar==true){
  document.FAC.submit();
 }else{}
}

function SendSubCat(accion){
	if(accion=="agregar"){
      validar=validarSubCategoria();
      if(validar==true){
	    document.FSC.submit();
	  }else{}
	}else{
	  document.FESC.submit();
	}
}

function SendCotizacion(){
 document.MP.submit();
}

function SendUpdate(){
 document.FEN.submit();
}

function BorrarNoticia(id){
	if(confirm("Esta seguro de borrar esta noticia ? "))
     	location.href="admin.php?c=N&op=BN&id="+id;
    else {}
}

function DelIndustria(id){
	if(confirm("Esta seguro de borrar esta industria ? "))
     	location.href="admin.php?c=C&op=BI&id="+id;
    else {}

}

function DelCat(id){
	if(confirm("Esta seguro de borrar esta categoria ? "))
     	location.href="admin.php?c=C&op=BC&id="+id;
    else {}

}

function DelSubCat(ida,ids){
	if(confirm("Esta seguro de borrar esta subcategoria ? "))
     	location.href="admin.php?c=C&op=BSC&ida="+ida+"&ids="+ids;
    else {}

}


function Del(sec,id){
	
  if(sec=='productos'){
    url="admin.php?c=P&op=BDP&id="+id;
    texto="Esta seguro de borrar los datos de este producto ?";
  }
  
  if(sec=='detalle'){
    url="admin.php?c=P&op=BDPD&id="+id;
    texto="Esta seguro de borrar los datos de este producto ?";
  }
  
  
  
  if(confirm(texto))
    location.href= url;
  else { }	
  
}


/* ================================ */

function Registro(){
var seccion=document.getElementById('seccion').value;

if(seccion=='esp'){
   reg=Validar();
   texto='Esta seguro de registrar sus datos';
}else{
   reg=ValidarIng();
   texto='Do you want to register your data';
  }
  if(reg){
	if(confirm(texto)){
    	document.REG.submit();
	}else {}
  }
}

function validarnum(e) {
    tecla = (document.all) ? e.keyCode : e.which;
    if (tecla==9 || tecla==0 || tecla==8) return true; //Tecla de retroceso (para poder borrar)
 
    // dejar la lnea de patron que se necesite y borrar el resto
    //patron =/[A-Za-z]/; // Solo acepta letras
    patron = /[\d-]/; // Solo acepta nmeros[/b]
    //patron = /\w/; // Acepta nmeros y letras
    //patron = /\D/; // No acepta nmeros
    //
    te = String.fromCharCode(tecla);
    return patron.test(te); 
} 

function validas(campo,id){
var cad
if(id=='Address')
  cad=" .-#1234567890";
else cad="";
 
 var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZÑ. " + "abcdefghijklmnopqrstuvwxyzñíúóá. " + "" + cad;
  var checkStr = campo;
  var allValid = true; 
  for (i = 0; i < checkStr.length; i++) {
    ch = checkStr.charAt(i); 
    for (j = 0; j < checkOK.length; j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length) { 
      allValid = false; 
      break; 
    }
  }
  if (!allValid) { 
    alert("Please write only letters in the field "+id); 
   // document.formul.id.focus(); 
    return false; 
  } 

}


function Validar() {
	
	
	//============================================================================
	//                 Validacion de los inputs text 
	//============================================================================
	
	 if (document.REG.username.value.length==0){ 
       alert("Por favor captura tu nombre de usuario") 
       document.REG.username.focus() 
       return false; 
     }  
	
	if(document.REG.username.value.length<4){
	 alert("Tu nombre de usuario debe de contener mas de 4 carateres") 
      document.REG.username.focus() 
      return false; 
    }
	
	if(document.REG.username.value.length>4){
	  var resp
	  resp = validas(document.REG.username.value,"Login"); 
	  if(resp==false){
	    document.REG.username.focus() 
		document.REG.username.value=""
		return false;
	  }
	}
	
	if (document.REG.password.value.length==0){ 
       alert("Por favor captura tu contraseña") 
       document.REG.password.focus() 
       return false; 
     }  
	
	if(document.REG.password.value.length<4){
	 alert("Tu contraseña debe de tener mas de 4 caracteres") 
      document.REG.password.focus() 
      return false; 
    }
	
	if (document.REG.password2.value.length==0){ 
       alert("Por favor confirma tu contraseña") 
       document.REG.password2.focus() 
       return false; 
     }  
	
	if(document.REG.password.value != document.REG.password2.value){
	 alert("Por favor captura la misma contraseña") 
      document.REG.password2.focus() 
	  document.REG.password2.value=""
      return false;
	}
	
	
	if (document.REG.email.value.length==0){ 
       alert("Por favor captura tu correo electrónico") 
       document.REG.email.focus() 
       return false; 
    }
	
	var valor=document.REG.email.value;
	var filter=/^[A-Za-z][A-Za-z0-9_]+.*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
 if (filter.test(valor)){
    //alert("Your e-mail is correct");
	//return (true);
	
 }else{
    alert("Por favor captura un correo electrónico válido");
    document.REG.email.value="";
    document.REG.email.focus();
    return false;
  
  }
	
 if (document.REG.name.value.length==0){ 
       alert("Por favor captura tu nombre") 
       document.REG.name.focus() 
       return false; 
    } 
	
	if(document.REG.name.value.length<4){
	 alert("Tu nombre debe de contener mas de 4 caracteres") 
      document.REG.name.focus() 
      return false; 
    }
	
	if(document.REG.name.value.length>=4){
	  var resp
	  resp = validas(document.REG.name.value,"Name"); 
	  if(resp==false){
	    document.REG.name.focus() 
		document.REG.name.value=""
		return false;
	  }
	}
	
	
	 if (document.REG.direccion.value.length==0){ 
       alert("Por favor captura tu dirección") 
       document.REG.direccion.focus() 
       return false; 
    } 
	
	if(document.REG.direccion.value.length>=4){
	  var resp
	  resp = validas(document.REG.direccion.value,"Address"); 
	  if(resp==false){
	   document.REG.direccion.focus() 
	     document.REG.direccion.value=""
		return false;
	  }
	}
  
		 
	if (document.REG.ciudad.value.length==0){ 
       alert("Por favor captura el nombre de tu ciudad") 
       document.REG.ciudad.focus() 
       return false; 
    }
	
	if(document.REG.ciudad.value.length>=4){
	  var resp
	  resp = validas(document.REG.ciudad.value,"City"); 
	  if(resp==false){
	   document.REG.ciudad.focus() 
	     document.REG.ciudad.value=""
		return false;
	  }
	}
	
	
	 if (document.REG.estado.value.length==0){ 
       alert("Por favor captura el nombre de tu estado") 
       document.REG.estado.focus() 
       return false; 
    } 
	
	if(document.REG.estado.value.length>=4){
	  var resp
	  resp = validas(document.REG.estado.value,"State"); 
	  if(resp==false){
	   document.REG.estado.focus() 
	    document.REG.estado.value=""
	   return false;
	  }
	}
	
		
	 if (document.REG.codigo_postal.value.length==0){ 
       alert("Por favor captura tu código postal") 
       document.REG.codigo_postal.focus() 
       return false; 
    } 
   var checkOK = "0123456789"; 
   var checkStr = document.REG.codigo_postal.value; 
  var allValid = true; 
  var decPoints = 0; 
  var allNum = ""; 
  for (i = 0; i < checkStr.length; i++) { 
    ch = checkStr.charAt(i); 
    for (j = 0; j < checkOK.length; j++) 
      if (ch == checkOK.charAt(j))
        break; 
    if (j == checkOK.length) { 
      allValid = false; 
      break; 
    } 
    allNum += ch; 
  } 
  if (!allValid) { 
    alert("Por favor captura solo digitos en el campo código postal");
    document.REG.codigo_postal.focus();
	document.REG.codigo_postal.value=""
	return (false); 
  } 
  	
	
	 if (document.REG.contacto.value.length==0){ 
       alert("Por favor captura los datos del contacto") 
       document.REG.contacto.focus(); 
       return false; 
    } 
	
	if(document.REG.contacto.value.length>=4){
	  var resp
	  resp = validas(document.REG.contacto.value,"Address"); 
	  if(resp==false){
	   document.REG.contacto.focus() 
	     document.REG.contacto.value=""
		return false;
	  }
	}
	
	 if (document.REG.lada.value.length==0){ 
       alert("Por favor captura la lada de tu teléfono") 
       document.REG.lada.focus() 
       return false; 
	 }
	 
	  var checkOK = "0123456789"; 
   var checkStr = document.REG.lada.value; 
  var allValid = true; 
  var decPoints = 0; 
  var allNum = ""; 
  for (i = 0; i < checkStr.length; i++) { 
    ch = checkStr.charAt(i); 
    for (j = 0; j < checkOK.length; j++) 
      if (ch == checkOK.charAt(j))
        break; 
    if (j == checkOK.length) { 
      allValid = false; 
      break; 
    } 
    allNum += ch; 
  } 
  if (!allValid) { 
    alert("Por favor captura solo digitos en el campo lada");
    document.REG.lada.focus(); 
    return (false); 
  }  
  
  if (document.REG.numero.value.length==0){ 
       alert("Por favor captura tu teléfono") 
       document.REG.numero.focus() 
       return false; 
	 }
	 
	  var checkOK = "0123456789"; 
   var checkStr = document.REG.numero.value; 

  var allValid = true; 
  var decPoints = 0; 
  var allNum = ""; 
  for (i = 0; i < checkStr.length; i++) { 
    ch = checkStr.charAt(i); 
    for (j = 0; j < checkOK.length; j++) 
      if (ch == checkOK.charAt(j))
        break; 
    if (j == checkOK.length) { 
      allValid = false; 
      break; 
    } 
    allNum += ch; 
  } 
  if (!allValid) { 
    alert("Por favor captura solo digitos en el campo teléfono");
    document.REG.numero.focus(); 
    return (false); 
  }  
 
   var options_string="";
   var radio=document.getElementById("facturacion").value; 
   
  
 
  if(radio!=options_string)
  { 
    if(document.REG.facturacion[1].checked){
  
     if (document.REG.razon_social.value.length==0){ 
        alert("Por favor captura tu razón social") 
        document.REG.razon_social.focus() 
        return false; 
	 }
	 
	 if (document.REG.rfc2.value.length==0){ 
       alert("Por favor captura tu RFC") 
       document.REG.rfc2.focus() 
       return false; 
	 }
	 
	 if (document.REG.direccion2.value.length==0){ 
       alert("Por favor captura tu dirección") 
       document.REG.direccion2.focus() 
       return false; 
	 }
  
     if(document.REG.ciudad2.value.length==0){ 
       alert("Por favor captura el nombre de tu ciudad") 
       document.REG.ciudad2.focus() 
       return false; 
	 }
	 
	 if (document.REG.estado2.value.length==0){ 
       alert("Por favor captura el nombre de tu estado") 
       document.REG.estado2.focus() 
       return false; 
	 }
	 
	 if (document.REG.codigo_postal2.value.length==0){ 
       alert("Por favor captura tu código postal") 
       document.REG.codigo_postal2.focus() 
       return false; 
	 }
  
     return true;
    }else { 
	         if(document.REG.facturacion[0].checked)
	           return true;
              else{
	                alert("Debes de elegir una opcion" + radio);
                    document.REG.facturacion[0].focus();
                    return false;
              }
	       } 
			   
  }else{
	     alert("Debes de elegir una opcion" + radio);
         document.REG.facturacion[0].focus();
         return false;
       }
 }


function ValidarIng() {
	
	
	//============================================================================
	//                 Validacion de los inputs text 
	//============================================================================
	
	 if (document.REG.username.value.length==0){ 
       alert("Please write your Login") 
       document.REG.username.focus() 
       return false; 
     }  
	
	if(document.REG.username.value.length<4){
	 alert("Your Login must have more of four characters") 
      document.REG.username.focus() 
      return false; 
    }
	
	if(document.REG.username.value.length>4){
	  var resp
	  resp = validas(document.REG.username.value,"Login"); 
	  if(resp==false){
	    document.REG.username.focus() 
		document.REG.username.value=""
		return false;
	  }
	}
	
	if (document.REG.password.value.length==0){ 
       alert("Please write your Password") 
       document.REG.password.focus() 
       return false; 
     }  
	
	if(document.REG.password.value.length<4){
	 alert("Your Password must have more of four characters") 
      document.REG.password.focus() 
      return false; 
    }
	
	if (document.REG.password2.value.length==0){ 
       alert("Please Confirm your Password") 
       document.REG.password2.focus() 
       return false; 
     }  
	
	if(document.REG.password.value != document.REG.password2.value){
	 alert("please write the same email before your wrote") 
      document.REG.password2.focus() 
	  document.REG.password2.value=""
      return false;
	}
	
	if(document.REG.password2.value.length<4){
	 alert("Your Password must have more of four characters") 
      document.REG.password2.focus() 
      return false; 
    }
	
	if (document.REG.email.value.length==0){ 
       alert("Please write your e-mail") 
       document.REG.email.focus() 
       return false; 
    }
	
	var valor=document.REG.email.value;
	var filter=/^[A-Za-z][A-Za-z0-9_]+.*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
 if (filter.test(valor)){
    //alert("Your e-mail is correct");
	//return (true);
	
 }else{
    alert("Please write valid e-mail");
    document.REG.email.value="";
    document.REG.email.focus();
    return false;
  
  }
	
 if (document.REG.name.value.length==0){ 
       alert("Please write your Name") 
       document.REG.name.focus() 
       return false; 
    } 
	
	if(document.REG.name.value.length<4){
	 alert("Your Name must have more of four characters") 
      document.REG.name.focus() 
      return false; 
    }
	
	if(document.REG.name.value.length>=4){
	  var resp
	  resp = validas(document.REG.name.value,"Name"); 
	  if(resp==false){
	    document.REG.name.focus() 
		document.REG.name.value=""
		return false;
	  }
	}
	
	
	 if (document.REG.direccion.value.length==0){ 
       alert("Please write your Adress") 
       document.REG.direccion.focus() 
       return false; 
    } 
	
	if(document.REG.direccion.value.length>=4){
	  var resp
	  resp = validas(document.REG.direccion.value,"Address"); 
	  if(resp==false){
	   document.REG.direccion.focus() 
	     document.REG.direccion.value=""
		return false;
	  }
	}
  
	
	var cad= document.REG.direccion.value;
	if(cad.substr(0,4) == "http"){
       alert("Please write your Address correctly") 
	   document.REG.direccion.focus() 
	   document.REG.direccion.value=""
       return false; 
    
	}
	 
	if (document.REG.ciudad.value.length==0){ 
       alert("Please write your City") 
       document.REG.ciudad.focus() 
       return false; 
    }
	
	if(document.REG.ciudad.value.length>=4){
	  var resp
	  resp = validas(document.REG.ciudad.value,"City"); 
	  if(resp==false){
	   document.REG.ciudad.focus() 
	     document.REG.ciudad.value=""
		return false;
	  }
	}
	
	if(document.REG.ciudad.value.substr(0,4) == "http"){
      alert("Please write your City correctly") 
	   document.REG.ciudad.focus() 
	   document.REG.ciudad.value=""
       return false; 
    
	}
	
	 if (document.REG.estado.value.length==0){ 
       alert("Please write your State") 
       document.REG.estado.focus() 
       return false; 
    } 
	
	if(document.REG.estado.value.length>=4){
	  var resp
	  resp = validas(document.REG.estado.value,"State"); 
	  if(resp==false){
	   document.REG.estado.focus() 
	    document.REG.estado.value=""
	   return false;
	  }
	}
	
	if(document.REG.estado.value.substr(0,4) == "http"){
      alert("Please write your State correctly") 
	   document.REG.estado.focus() 
	   document.REG.estado.value=""
       return false; 
    
	}
	
	 if (document.REG.codigo_postal.value.length==0){ 
       alert("Please write your Zip") 
       document.REG.codigo_postal.focus() 
       return false; 
    } 
   var checkOK = "0123456789"; 
   var checkStr = document.REG.codigo_postal.value; 
  var allValid = true; 
  var decPoints = 0; 
  var allNum = ""; 
  for (i = 0; i < checkStr.length; i++) { 
    ch = checkStr.charAt(i); 
    for (j = 0; j < checkOK.length; j++) 
      if (ch == checkOK.charAt(j))
        break; 
    if (j == checkOK.length) { 
      allValid = false; 
      break; 
    } 
    allNum += ch; 
  } 
  if (!allValid) { 
    alert("Please write only digits in field Zip");
    document.REG.codigo_postal.focus();
	document.REG.codigo_postal.value=""
	return (false); 
  } 
  	
	
	 if (document.REG.contacto.value.length==0){ 
       alert("Please write your Contact data") 
       document.REG.contacto.focus(); 
       return false; 
    } 
	
	if(document.REG.contacto.value.length>=4){
	  var resp
	  resp = validas(document.REG.contacto.value,"Address"); 
	  if(resp==false){
	   document.REG.contacto.focus() 
	     document.REG.contacto.value=""
		return false;
	  }
	}
	
	 if (document.REG.lada.value.length==0){ 
       alert("Please write your Telephone Lada") 
       document.REG.lada.focus() 
       return false; 
	 }
	 
	  var checkOK = "0123456789"; 
   var checkStr = document.REG.lada.value; 
  var allValid = true; 
  var decPoints = 0; 
  var allNum = ""; 
  for (i = 0; i < checkStr.length; i++) { 
    ch = checkStr.charAt(i); 
    for (j = 0; j < checkOK.length; j++) 
      if (ch == checkOK.charAt(j))
        break; 
    if (j == checkOK.length) { 
      allValid = false; 
      break; 
    } 
    allNum += ch; 
  } 
  if (!allValid) { 
    alert("Please write only digits in field Lada");
    document.REG.lada.focus(); 
    return (false); 
  }  
  
  if (document.REG.numero.value.length==0){ 
       alert("Please write your Telephone") 
       document.REG.numero.focus() 
       return false; 
	 }
	 
	  var checkOK = "0123456789"; 
   var checkStr = document.REG.numero.value; 

  var allValid = true; 
  var decPoints = 0; 
  var allNum = ""; 
  for (i = 0; i < checkStr.length; i++) { 
    ch = checkStr.charAt(i); 
    for (j = 0; j < checkOK.length; j++) 
      if (ch == checkOK.charAt(j))
        break; 
    if (j == checkOK.length) { 
      allValid = false; 
      break; 
    } 
    allNum += ch; 
  } 
  if (!allValid) { 
    alert("Please write only digits in Telephone");
    document.REG.numero.focus(); 
    return (false); 
  }  
 
   var options_string="";
   var radio=document.getElementById("facturacion").value; 
   
  
 
  if(radio!=options_string)
  { 
    if(document.REG.facturacion[1].checked){
  
     if (document.REG.razon_social.value.length==0){ 
        alert("Please write your Social reason") 
        document.REG.razon_social.focus() 
        return false; 
	 }
	 
	 if (document.REG.rfc2.value.length==0){ 
       alert("Please write your RFC") 
       document.REG.rfc2.focus() 
       return false; 
	 }
	 
	 if (document.REG.direccion2.value.length==0){ 
       alert("Please write you Address") 
       document.REG.direccion2.focus() 
       return false; 
	 }
  
     if(document.REG.ciudad2.value.length==0){ 
       alert("Please write your City") 
       document.REG.ciudad2.focus() 
       return false; 
	 }
	 
	 if (document.REG.estado2.value.length==0){ 
       alert("Please write your State") 
       document.REG.estado2.focus() 
       return false; 
	 }
	 
	 if (document.REG.codigo_postal2.value.length==0){ 
       alert("Please write your Zip Code") 
       document.REG.codigo_postal2.focus() 
       return false; 
	 }
  
     return true;
    }else { 
	         if(document.REG.facturacion[0].checked)
	           return true;
              else{
	                alert("Debes de elegir una opcion" + radio);
                    document.REG.facturacion[0].focus();
                    return false;
              }
	       } 
			   
  }else{
	     alert("Debes de elegir una opcion" + radio);
         document.REG.facturacion[0].focus();
         return false;
       }
 }



function Suscribirse(){
  reg=Suscripcion();
  if(reg){
	if(confirm("Esta seguro de registrar sus datos ? ")){
    	document.SUS.submit();
	}else {}
  }
}


function Suscripcion(){


	
 if (document.SUS.name.value.length==0){ 
       alert("Por favor escribe tu nombre") 
       document.SUS.name.focus() 
       return false; 
    } 
	
	if(document.SUS.name.value.length<10){
	 alert("Tu Nombre Completo debe de tener mas de 10  caracteres") 
      document.SUS.name.focus() 
      return false; 
    }
	
	if(document.SUS.name.value.length>=4){
	  var resp
	  resp = validas(document.SUS.name.value,"Nombre"); 
	  if(resp==false){
	    document.SUS.name.focus() 
		document.SUS.name.value=""
		return false;
	  }
	}
	
	if (document.SUS.email.value.length==0){ 
       alert("Por favor escribe tu correo electronico") 
       document.SUS.email.focus() 
       return false; 
    }
	
	var valor=document.SUS.email.value;
	var filter=/^[A-Za-z][A-Za-z0-9_]+.*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
 if (filter.test(valor)){
    //alert("Your e-mail is correct");
	//return (true);
	
 }else{
    alert("Por favor escribe un correo valido");
    document.SUS.email.value="";
    document.SUS.email.focus();
    return false;
  
  }
  
  if (document.SUS.email2.value.length==0){ 
       alert("Por favor confirma tu correo electronico") 
       document.SUS.email2.focus() 
       return false; 
  }
	
  if(document.getElementById("email").value!=document.getElementById("email2").value){
	alert("Debes de capturar el mismo correo electronico");  
	document.getElementById("email2").value="";
	document.getElementById("email2").focus();
	return false;
  }
  
	return true;
}



function validarProductos(){


 
 if(document.FAP.lenguaje.value==2){ 
   alert("Por favor elige el lenguaje") 
   document.FAP.lenguaje.focus() 
   return false; 
 }  
 
 if(document.FAP.categoria.value==0){	 
      alert("Por favor elige la categoria") 
      document.FAP.categoria.focus() 
      return false; 
 }  
 
 if(document.FAP.subcats.value=='si'){
   if(document.FAP.subcat.value==0){	 
      alert("Por favor elige la subcategoria") 
      document.FAP.subcat.focus() 
      return false; 
   }else{}
 }  

 if(document.FAP.nombre.value==""){	 
      alert("Por favor captura el nombre o marca") 
      document.FAP.nombre.focus() 
      return false; 
 }  
 
 if(document.FAP.modelo.value==""){	 
      alert("Por favor captura el modelo") 
      document.FAP.modelo.focus() 
      return false; 
 }  
 
 if(document.FAP.parte.value==""){	 
      alert("Por favor captura el No. de partes que requieres") 
      document.FAP.parte.focus() 
      return false; 
 }  
 
 if(document.FAP.descripcion.value==""){	 
      alert("Por favor captura una descripcion breve del producto") 
      document.FAP.descripcion.focus() 
      return false; 
 }  
 
 /*if(document.FAP.precio.value==""){	 
      alert("Por favor captura el precio del producto") 
      document.FAP.precio.focus() 
      return false; 
 } */
 
 
 if( (document.FAP.oferta[0].checked==false) && (document.FAP.oferta[1].checked==false)){	 
      alert("Por favor elige si el producto esta en oferta") 
      document.FAP.oferta[0].focus() 
      return false; 
 } 
 
 if( (document.FAP.remate[0].checked==false) && (document.FAP.remate[1].checked==false)){	 
      alert("Por favor elige si el producto esta en remate") 
      document.FAP.remate[0].focus() 
      return false; 
 } 
 
 if( (document.FAP.lugar[0].checked==false) && (document.FAP.lugar[1].checked==false) && (document.FAP.lugar[2].checked==false)){	 
      alert("Por favor elige si el producto es para Ensenada, Tijuana o Ambas") 
      document.FAP.lugar[0].focus() 
      return false; 
 } 
 
 
	 
 return true;
}


function validarNoticias(){
	
 if(document.FAN.titulo.value==""){	 
      alert("Por favor captura el titulo de la noticia") 
      document.FAN.titulo.focus() 
      return false; 
 } 
 
 if(document.FAN.noticia.value==""){	 
      alert("Por favor captura el contenido de la noticia") 
      document.FAN.noticia.focus() 
      return false; 
 } 
 
return true;
}

function validarCategoria(){
	
 if(document.FAC.categoria.value==""){	 
      alert("Por favor captura el nombre de la categoria") 
      document.FAC.categoria.focus() 
      return false; 
 } 
 
return true;
}

function validarSubCategoria(){
	
 if(document.FSC.subcategoria.value==""){	 
      alert("Por favor captura el nombre de la subcategoria") 
      document.FSC.subcategoria.focus() 
      return false; 
 } 
 
return true;
}
//============================================================================
	//                 Validacion de los inputs radio 
	//============================================================================
	/*var marcado = "no";
      with(document.REG){
        for(var i = 0; i < facturacion.length; i++ ) {
           if(facturacion[i].checked ) {
            // return true;
           band=1;
		   }
        }
         if(marcado == "no" ){
           window.alert("You must choose invoice me with" ) ;
		   return false;
         }
     }
	 
   if(band==1)	 
     return true;*/
  

function popUp(URL,w,h) {
	
	
  day = new Date();
  id = day.getTime();
  eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,"+ w + h + "');");
}