function formato_campo(fld,e,t) {
	
    var aux = aux2 = '';
	var i = j = 0;

	if(t==1)
    	var strCheck = '0123456789';
	if(t==2)
    	var strCheck = 'AaBbCcDdEeFfGgHhIiJjKkLlÑñNnMmOoPpQqRrSsTtUuVvWwXxYyZzáÁéÉíÍóÓúÚ ';
	if(t==3)
    	var strCheck = '0123456789-ext';
	if(t==4)
    	var strCheck = '0123456789';
	if(t==5)
	var strCheck ='ABCDEFGHIJKLMNÑOPQRSTUVWXYZÁÉÍÓÚ';
	
    var whichCode = (window.Event) ? e.which : e.keyCode;
    if (whichCode == 13) return true; // Enter
	if (whichCode == 8) return true; // Enter
	if (whichCode == 0) return true; // Enter
	if(t==4){
		if(fld.value==""){
			aux_old=0;
			aux_old2=0;
		}
		if(fld_old=="0")
			fld_old=fld;
		else{
			if(fld_old==fld){
				if (whichCode == 46 && aux_old==0){
				aux_old=1;
				return true;
				}
				if (whichCode == 45 && aux_old2==0 && fld.value==""){
				aux_old2=1;
				return true;
				}
			}else{
				fld_old=fld;
				aux_old=0;
				aux_old2=0;
				if (whichCode == 46 && aux_old==0){
				aux_old=1;
				return true;
				}
				if (whichCode == 45 && aux_old2==0 && fld.value==""){
				aux_old2=1;
				return true;
				}
			}
		}
	}
    key = String.fromCharCode(whichCode); // Get key value from key code
    if (strCheck.indexOf(key) == -1) return false; // Not a valid key
	fld.value += aux2.charAt(i);
} 

function ventanaPopUp (pagina,ancho,alto,scroll_b){
      
	var opciones=("toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars="+scroll_b+", resizable=no, width="+ancho+", height="+alto+"");
	var w=window.open(pagina,"ventana",opciones);
}
function ventanaPopUp2(pagina,ancho,alto,scroll_b){
	var opciones=("toolbar=no, location=no, directories=no, status=no, menubar=yes, scrollbars="+scroll_b+", resizable=no, width="+ancho+", height="+alto+"");
	var w=window.open(pagina,"ventana2",opciones);
}
