String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
//**************************************************************************
function fFiltrar(){
	document.getElementById("TxtAc").value="F";
	document.getElementById("Frm").submit();
}
//**************************************************************************
function fCancelar(){
	svv("TxtFec,TxtTot,TxtObs,CboAlm");
	//
	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("TxtFec").value=OFec;
	jF("TxtFec");
}
function fGuardar(){
	var Fec=document.getElementById("TxtFec").value;
	var Alm=document.getElementById("CboAlm").value;
	var Tot=document.getElementById("TxtTot").value;

	if(Fec.trim().length==0){
		alert("Ingrese la fecha, segun el formato");
		document.getElementById("TxtFec").focus();
		return;
	}
	if(EsFecha(Fec)==false){
		alert("Fecha no valida, verifique el formato");
		document.getElementById("TxtFec").focus();
		return;
	}
	if(Alm.trim().length==0){
		alert("Seleccione el almacen correspondiente");
		document.getElementById("CboAlm").focus();
		return;
	}
	if(Tot.trim().length==0){
		alert("Ingrese el total correspondiente");
		document.getElementById("TxtTot").focus();
		return;
	}

	if(document.getElementById("CmdG").value=="Guardar"){
		document.getElementById("TxtAc").value="G";
	}else{
		document.getElementById("TxtAc").value="M";
	}
	document.getElementById("Frm").submit();
}

//**************************************************************************

$(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;
		}
	}
  
});