// PARA ABRIR VENTANAS
function aVentana(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// PARA VALIDACION DE CAMPOS

var letras ="abcdefghijklmnñopqrstuvwxyzáéíóúüABCDEFGHIJKLMNÑOPQRSTUVWXYZÁÉÍÓÚÜ ";
var numeros ="0123456789";
var strRFC ="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
var strAlpha ="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ";
var letrnums =letras+numeros;
var strNick = letras+numeros+"-_";
var validos = "abcdefghijklmnñopqrstuvwxyz"+numeros+"@.,-_";
var folios  = "0123456789-";
var Correo =/^([\w-]+(?:\.[\w-]+)*)@((:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
var bolReg=false;
var keycode;

function vNick(e){
  bolReg=false;
  keycode= (e.keyCode) ? e.keyCode: e.which;
  if (strNick.indexOf(String.fromCharCode(keycode))!=-1) { bolReg=true;}
  return bolReg;
}

function vLetras(e){
  bolReg=false;
  keycode= (e.keyCode) ? e.keyCode: e.which;
  if (keycode==9 || keycode==46 || keycode==8) { bolReg=true;}
  if (letras.indexOf(String.fromCharCode(keycode))!=-1) { bolReg=true;}
  return bolReg;
}

function vNumeros(e){
  bolReg=false;
  keycode= (e.keyCode) ? e.keyCode: e.which;
  if (keycode==9 || keycode==46 || keycode==8) { bolReg=true;}
  if (numeros.indexOf(String.fromCharCode(keycode))!=-1) { bolReg=true;}
  return bolReg;
}


function vValidos(e){
  bolReg=false;
  keycode= (e.keyCode) ? e.keyCode: e.which;
  if (keycode==9 || keycode==46 || keycode==8) { bolReg=true;}
  if (validos.indexOf(String.fromCharCode(keycode))!=-1) { bolReg=true;}
  return bolReg;
}


function vCorreo(valor){
  bolReg=false;
   if (Correo.test(valor)){bolReg=true}
  return bolReg;
}

function vAlpha(e){
  bolReg=false;
  keycode= (e.keyCode) ? e.keyCode: e.which;
  if (keycode==9 || keycode==46 || keycode==8) { bolReg=true;}
  if (strAlpha.indexOf(String.fromCharCode(keycode))!=-1) { bolReg=true;}
  return bolReg;
}

function vFolios(e){
  bolReg=false;
  keycode= (e.keyCode) ? e.keyCode: e.which;
  if (folios.indexOf(String.fromCharCode(keycode))!=-1) { bolReg=true;}
  return bolReg;
}



//Cambia a Mayúsculas y pone el fondo blanco
function MayBlnk(o){
o.value=o.value.toUpperCase();
o.className='';
}
/********************* INICIO BOTON MAGICO/VALIDACION **************************/

var tmpBoton;
function MButton(boton,que){
	if (que==0) { //Lo Apago
		tmpBoton=boton.value;
		boton.value="Procesando...";
		boton.disabled=true;
	}
	
	if (que=="1") { //Lo regreso a como estaba
		boton.value=tmpBoton;
		boton.disabled=false;
		
		}

}

// TRABAJO CON CAPAS

function pCapa(id) //v2.0
   {
     var i, id, args=pCapa.arguments;
     for (i=0; i<(args.length); i++) {
       id= args[i];
       document.getElementById(id).style.visibility = 'visible';
      }
   }

function aCapa(id) //v2.0
   {
     var i, id, args=aCapa.arguments;
     for (i=0; i<(args.length); i++) {
       id= args[i];
       document.getElementById(id).style.visibility = 'hidden';
      }
   }

function mCapa(id) //v2.0
   {
     var i, id, args=mCapa.arguments;
     for (i=0; i<(args.length); i++) {
       id= args[i];
       document.getElementById(id).style.display = 'block';
      }
   }

function oCapa(id) //v2.0
   {
     var i, id, args=oCapa.arguments;
     for (i=0; i<(args.length); i++) {
       id= args[i];
       document.getElementById(id).style.display = 'none';
      }
   }

//

function wPop(que,w,h){
  var ArgDesc = "toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes,,top=50,left=50,width=" + w + ",height=" + h +"";
  Popbar = window.open(que,"Popbar",ArgDesc);
}
