String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
//**************************************************************************
function fImportarDatos(){
	document.getElementById("TxtAc").value="UP";
	document.getElementById("Frm").submit();
}
//+++
function fFiltrar(){
	document.getElementById("TxtAc").value="F";
	document.getElementById("Frm").submit();
}
//**************************************************************************
function fCancelar(){
	SM("L");
	/*
	document.getElementById("TxtCod").value="";
	document.getElementById("CboLin").value="";
	document.getElementById("TxtDes").value="";
	document.getElementById("TxtPcS").value="";
	document.getElementById("TxtPcD").value="";
	document.getElementById("TxtPvMin").value="";
	document.getElementById("TxtPvMax").value="";
	document.getElementById("CboPUso").value="SI";
	document.getElementById("TxtRojo").value="0";
	document.getElementById("TxtAmbar").value="0";
	//
	document.getElementById("CmdE").disabled =true;
	document.getElementById("CmdG").value="Guardar";
	document.getElementById("TxtId").value="";
	document.getElementById("TxtAc").value="";
	document.getElementById("TxtCod").focus();
	*/
}
//**************************************************************************
function CalcularDOL(){
	var PcS=document.getElementById("TxtPcS").value;
	var Tc=document.getElementById("TxtTC").value;
	var PcD=parseFloat("0");
	if(PcS.trim().length==0)PsC="0";
	if(Tc.trim().length==0)Tc="0";
	PcS=parseFloat(PcS);
	Tc=parseFloat(Tc);
	PcD=PcS * Tc;
	PcD=PcD.toFixed(3);	
	if(PcD=="NaN"){
		document.getElementById("TxtPcD").value="0";
	}else{
		document.getElementById("TxtPcD").value=PcD;
	}
}
//**************************************************************************
function fGuardar(){
	var Cod=document.getElementById("TxtCod").value;
	var Lin=document.getElementById("CboLin").value;
	var Des=document.getElementById("TxtDes").value;
	var PcS=document.getElementById("TxtPcS").value;
	var PcD=document.getElementById("TxtPcD").value;
	var PMin=document.getElementById("TxtPvMin").value;
	var PMax=document.getElementById("TxtPvMax").value;
	
	if(Des.trim().length==0){
		alert("Ingrese la descripcion o nombre del producto");
		document.getElementById("TxtDes").focus();
		return;
	}
	if(document.getElementById("CmdG").value=="Guardar"){
		document.getElementById("TxtAc").value="G";
	}else{
		document.getElementById("TxtAc").value="M";
	}
	document.getElementById("CmdG").disabled=true;
	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); 
} 
//**************************************************************************
