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("TxtCon").value="";
	document.getElementById("TxtDir").value="";
	document.getElementById("CboDis").value="";
	document.getElementById("TxtRuc").value="";
	document.getElementById("TxtDni").value="";
	document.getElementById("TxtTel").value="";
	document.getElementById("TxtCel").value="";
	document.getElementById("TxtFax").value="";
	document.getElementById("TxtEma").value="";	
	document.getElementById("CmdE").disabled =true;
	document.getElementById("CmdG").value="Guardar";
	document.getElementById("TxtId").value="";
	document.getElementById("TxtAc").value="";
	document.getElementById("TxtNom").focus();
}
function fGuardar(){
	var Nom=document.getElementById("TxtNom").value;
	var Ruc=document.getElementById("TxtRuc").value;
	if(Nom.trim().length==0){
		alert("Ingrese el nombre del proveedor");
		document.getElementById("TxtNom").focus();
		return;
	}
	if(Ruc.trim().length>0){
		if(Ruc.trim().length!=11){
			alert("El numero de ruc debe tener 11 digitos");
			document.getElementById("TxtRuc").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); 
} 
//**************************************************************************
