String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
//**************************************************************************
function fMenuConfig(){
	document.getElementById("TxtAc").value="CM";
	document.getElementById("Frm").submit();
}
function fFiltrar(){
	document.getElementById("TxtAc").value="F";
	document.getElementById("Frm").submit();
}
//**************************************************************************
function fCancelar(){
	document.getElementById("CH_EV").checked=false;
	document.getElementById("CH_MV").checked=false;
	document.getElementById("CH_AV").checked=false;
	document.getElementById("CH_MP").checked=false;
	document.getElementById("TxtNom").value="";
	document.getElementById("TxtPass").value="";
	document.getElementById("TxtPass2").value="";
	document.getElementById("TxtFull").value="";
	document.getElementById("CboHab").value="SI";
	document.getElementById("CmdG").value="Guardar";
	document.getElementById("CmdLoad").disabled=true;
	document.getElementById("TxtId").value="";
	document.getElementById("TxtAc").value="";
	//
	//
	document.getElementById("TxtNom").focus();
}
function fGuardar(){
	var Nom=document.getElementById("TxtNom").value;
	var Pass=document.getElementById("TxtPass").value;
	var Pass2=document.getElementById("TxtPass2").value;
	var Full=document.getElementById("TxtFull").value;
	var Hab=document.getElementById("CboHab").value;
	if(Nom.trim().length==0){
		alert("Ingrese el nombre de usuario");
		document.getElementById("TxtNom").focus();
		return;
	}
	if(Pass.trim().length==0){
		alert("Ingrese el password");
		document.getElementById("TxtPass").focus();
		return;
	}
	if(Pass2.trim().length==0){
		alert("Ingrese el password nuevamente");
		document.getElementById("TxtPass2").focus();
		return;
	}
	if(Pass!=Pass2){
		alert("Los password son distintos");
		document.getElementById("TxtPass2").focus();
		return;
	}
	if(Full.trim().length==0){
		alert("Ingrese los nombres y apellidos");
		document.getElementById("TxtFull").focus();
		return;
	}	
	if(Hab.trim().length==0){
		alert("Seleccion un estado");
		document.getElementById("CboHab").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); 
} 
//**************************************************************************
