String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
//**************************************************************************
function fFiltrar(){
	document.getElementById("TxtAc").value="F";
	document.getElementById("Frm").submit();
}
//**************************************************************************
function fCancelar(){
	document.getElementById("TxtNom").value="";
	document.getElementById("TxtDir").value="";
	document.getElementById("CboDis").value="";
	document.getElementById("TxtDni").value="";
	document.getElementById("TxtTel").value="";
	document.getElementById("TxtCel").value="";
	document.getElementById("TxtFi").value="";
	document.getElementById("TxtEma").value="";	
	document.getElementById("CboCar").value="";	
	//
	document.getElementById("CmdE").disabled =true;
	document.getElementById("CmdG").value="Guardar";
	document.getElementById("TxtId").value="";
	document.getElementById("TxtAc").value="";
	//
	var OFec=gv("Ocu_Fec");
	document.getElementById("TxtFi").value=OFec;
	jF("TxtNom");
}

function fGuardar(){
	var Nom=document.getElementById("TxtNom").value;
	var Dni=document.getElementById("TxtDni").value;
	var Fn=document.getElementById("TxtFn").value;
	var Fi=document.getElementById("TxtFi").value;
	if(Nom.trim().length==0){
		alert("Ingrese el nombre del Personal");
		document.getElementById("TxtNom").focus();
		return;
	}

	if(Fn.trim().length>0){
		if(!EsFecha(Fn)){
			alert("Fecha no valida 'FEC. NAC', verifique el formato");
			document.getElementById("TxtFn").focus();
			return;			
		}
	}

	if(Dni.trim().length>0){
		if(Dni.trim().length!=8){
			alert("El numero de dni debe tener 8 digitos");
			document.getElementById("TxtDni").focus();
			return;
		}
	}

	if(Fi.trim().length>0){
		if(!EsFecha(Fi)){
			alert("Fecha no valida 'FEC. INGRESO', verifique el formato");
			document.getElementById("TxtFi").focus();
			return;			
		}
	}
	
	if(document.getElementById("CmdG").value=="Guardar"){
		document.getElementById("TxtAc").value="G";
	}else{
		document.getElementById("TxtAc").value="M";
	}
	document.getElementById("Frm").submit();
}
/**************************************************************************
	onkeypress="return pulsar(event);"
**************************************************************************/
function pulsar(e) { 	
	var tecla = (document.all) ? e.keyCode :e.which; 
	var Obj=event.srcElement.name;	
	if(Obj=="TxtNom"){
		if(tecla==13){			
			document.getElementById('CmdG').click();			
		}
	}	
	return (tecla!=13); 
} 
//**************************************************************************
$(document).keydown(function(e){
	var AT=gv("TxtAT");
	
	if(e.which==71 && e.altKey){		
		if(AT=="1"){	
		document.getElementById("CmdG").click();
		return;
		}
	}
	
	if(e.which==78 && e.altKey){
		if(AT=="1"){
		document.getElementById("CmdC").click();
		return;
		}
	}
	
	if(e.which==75 && e.altKey){
		if(AT=="1"){	
		document.getElementById("CmdE").click();
		return;
		}
	}

	if(e.which==66 && e.altKey){
		if(AT=="1"){	
		document.getElementById("CmdB").click();
		return;
		}
	}

	if(e.which==77 && e.altKey){
		if(AT=="1"){
		document.getElementById("CmdZ").click();
		return;
		}
	}
  
});