//onKeyPress="return(formato_campo(this,event,1))"
function formato_campo(fld,e,t) {
//alert(e);
    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 = '0123456789.';
	if(t==6)
		var strCheck = 'AaBbCcDdEeFfGgHhIiJjKkLlÑñNnMmOoPpQqRrSsTtUuVvWwXxYyZzáÁéÉíÍóÓúÚ 0123456789-';
	if(t==7)	
		var strCheck = 'AaBbCcDdEeFfGgHhIiJjKkLlÑñNnMmOoPpQqRrSsTtUuVvWwXxYyZz0123456789';
	if(t==8)	
		var strCheck = 'ABCDEFGHIJKLNMOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
	if(t==9)
		var strCheck = 'AaBbCcDdEeFfGgHhIiJjKkLlÑñNnMmOoPpQqRrSsTtUuVvWwXxYyZzáÁéÉíÍóÓúÚ 0123456789.()/,';
	if(t==10)
		var strCheck = 'sS0123456789';
	if(t==11)
    	var strCheck = '0123456789:';
	if(t==12)
    	var strCheck = '0123456789-';

	if(navigator.appName != "Microsoft Internet Explorer")
		var whichCode = e.which;
	else
		var whichCode = e.keyCode;	

	if (whichCode == 16) return false;					//shift
    if (whichCode == 0) return true; 					
	if (whichCode == 8) return true; 					// Enter
	if (whichCode == 9) return true; 					// Tab
	if (whichCode == 13) return true; 					// Enter
	//if (whichCode == 46) return true;
	key = String.fromCharCode(whichCode);
	// Consigue el valor del codigo de tecla...
    if (strCheck.indexOf(key) == -1) return false; 		// no es una tecla valida
//	fld.value += aux2.charAt(i);
};