function search_user(){

	var url = "index.php?option=com_invoices&controller=invoice&task=search_user&searchword=" + jQuery('#search_user').val() ;

	jQuery.ajax({
	  url: url,
	  cache: false,
	  context: document.body
	}).done(function(responseText) {

	    jQuery('#log_clientes').html ( responseText );
	});

}

function obtain_user(id){

	var url = "index.php?option=com_invoices&controller=invoice&task=obtain_user&id=" + id ;

	jQuery.ajax({
	  url: url,
	  cache: false,
	  context: document.body
	}).done(function(responseText) {

	   load_user(responseText);
	});

}

function load_user(resultat){

	for (var property in resultat) {
	    if (resultat.hasOwnProperty(property)) {

					vm.current_invoice[property] = resultat[property];

	    }
	}

	if(vm.current_invoice.vincular_cliente_checkbox == 1) vm.current_invoice.vincular_cliente_checkbox = 3;

}
