// JavaScript Document
function list_carga(divi,list_cod,list_desc)
{
	

		$.ajax({
		cache:false,
		url:'../lib/lista_maesb.php',
		datatype: "text",
	    async:false,
		type:'POST',
		data:{docu:divi,list_cod:list_cod,list_desc:list_desc}, 
    	beforeSend: function(jqXHR, textStatus)
		{
	
		}, 
		
		success:function(dato, textStatus, jqXHR)
		{
			document.getElementById('lista_temporal').innerHTML=dato;
		},
		error:function(jqXHR,textStatus,errorThrown )
		{
           if (jqXHR.status === 0) {
              console.log('Not connect: Verify Network.');
           } else if (jqXHR.status == 404) {
               console.log('Requested page not found [404]');
           } else if (jqXHR.status == 500) {
               console.log('Internal Server Error [500].');
           } else if (exception === 'parsererror') {
               console.log('Requested JSON parse failed.');
           } else if (exception === 'timeout') {
               //console.log('Time out error.');
			   alert('Servidor no Responde');
           } else if (exception === 'abort') {
               console.log('Ajax request aborted.');
           } else {
               console.log('Uncaught Error: ' + jqXHR.responseText);
           }

		}, 
	    complete:function(jqXHR, textStatus)
    	{
			
			if(textStatus==='success')
	        {
				document.getElementById('lista_temporal_contenedor').style.display='block';
			}           
		},
		timeout:30000
	});

}

function list_filabg(indf)
{
	for(i=0;i<=document.getElementsByClassName('list_filax').length-1;i++)
	{
		document.getElementsByClassName('list_filax').item(i).style.background='#fff';

	}

	document.getElementById('list_fila'+indf).style.background='#eee';

}
function list_agrega(e,v,d,l_cod,l_des)
{
	if(e.keyCode==13)
	{
		console.log(v+' - '+d);
		if(document.getElementById(l_cod))
		{
			document.getElementById(l_cod).value=v;
			document.getElementById(l_cod).innerHTML=v;
		}
		if(document.getElementById(l_des))
		{
			document.getElementById(l_des).value=v;
			document.getElementById(l_des).innerHTML=v;

		}
		document.getElementById('lista_temporal_contenedor').style.display='none';
		document.getElementById('lista_temporal_contenedor').innerHTML='';

	}
}
