String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
//**************************************************************************
function fFiltrar(){
	document.getElementById("TxtAc").value="F";
	document.getElementById("Frm").submit();
}
//**************************************************************************
function fCancelar(){
	sv("CboEmp","");
	document.getElementById("TxtNom").value="";
	document.getElementById("TxtObs").value="";
	document.getElementById("TxtDir").value="";
	//
	document.getElementById("CmdE").disabled =true;
	document.getElementById("CmdG").value="Guardar";
	document.getElementById("TxtId").value="";
	document.getElementById("TxtAc").value="";
	document.getElementById("CboEmp").focus();
}

function fGuardar(){
	var Nom=document.getElementById("TxtNom").value;
	var Obs=document.getElementById("TxtObs").value;
	if(Nom.trim().length==0){
		alert("Ingrese el nombre del almacen");
		document.getElementById("TxtNom").focus();
		return;
	}
	if(Obs.trim().length==0){
		alert("Ingrese un nombre corto");
		document.getElementById("TxtObs").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); 
} 
//**************************************************************************
