function buscar(){
	if($.trim($("#txtbusqueda").val()) != "" && ($.trim($("#txtbusqueda").val()) !=$.trim($("#txtbusquedamsg").val())) ){
		location.href = ABSOLUTE_PATH+"busqueda/?vb="+$("#txtbusqueda").val(); //vb valor a buscar
	}
}
function buscarproductos(campo){
	if(jQuery('#datobuscador').val().length > 2) {		
		if(campo == 'codigo'){
			datos = "&cod=";
		}	
		if(campo == 'descripcion'){
			datos = "&desc=";
		}
		document.location.href = ABSOLUTE_PATH+"busqueda/?"+jQuery('#parametros').val()+datos+jQuery('#datobuscador').val();
	} else {
		jQuery("#buscador_abajo").text(__mensajebuscador);
	}
}

function buscarproductosavanzado(){
	_datos = "";
	_txtcodigo 					= jQuery('#codigo');
	_txtcodigofabricante 		= jQuery('#codigofabricante');	
	_txtdescripcion				= jQuery('#descripcion');	
	_chkbuscaendetalle 			= jQuery('#buscaendetalle');	
	_txtean						= jQuery('#ean');
	_selidfabricante			= jQuery('#idfabricante');
	_selidfamilia				= jQuery('#idfamilia');
	_txtpreciodesde				= jQuery('#preciodesde');
	_txtpreciohasta				= jQuery('#preciohasta');
	_selcondicionprecio			= jQuery('#condicionprecio');	
	_chkcanon					= jQuery('#canon');		
	_chkdescuento				= jQuery('#descuento');		
	_chkdestacado				= jQuery('#destacado');			
	_chkvista3d					= jQuery('#vista3d');			
	_chkimagenes				= jQuery('#imagenes');		
	_chkdescatalogado			= jQuery('#descatalogado');
	_chkofertado				= jQuery('#ofertado');

	
	if($.trim(_txtcodigo.val()) != ''){
		_datos += "&cod="+_txtcodigo.val();
	}	

	if($.trim(_txtcodigofabricante.val()) != ''){
		_datos += "&codfab="+_txtcodigofabricante.val();
	}	

	if($.trim(_txtdescripcion.val()) != ''){
		_datos += "&desc="+_txtdescripcion.val();
		if(_chkbuscaendetalle.attr("checked")){
			_datos += "&incdetalle=1";
		}
	}
	
	if($.trim(_txtean.val()) != ''){
		_datos += "&ean="+_txtean.val();
	}	
	if($.trim(_selidfabricante.val()) != '-1'){
		_datos += "&idma="+_selidfabricante.val();
	}	

	if($.trim(_selidfamilia.val()) != '-1'){
		_datos += "&idfa="+_selidfamilia.val();
	}	
	if($.trim(_txtpreciodesde.val()) != '' && $.trim(_txtpreciodesde.val()) != '') {
		if(parseFloat(_txtpreciodesde.val())<parseFloat(_txtpreciohasta.val())){
			_datos += "&preciodesde="+_txtpreciodesde.val()+"&preciohasta="+_txtpreciohasta.val();
		}else{
			msg = __mensajebuscadoringreseprecios;
			$("#mensajeresultado").text(msg);	
			$("#mensajeresultado").show();	
		}
	}	

	if(_chkofertado.attr('checked')){
		_datos += "&incoferta="+_chkofertado.val();
	}	
	if(_chkcanon.attr('checked')){
		_datos += "&inccanon="+_chkcanon.val();
	}
	if(_chkdescuento.attr('checked')){
		_datos += "&incdesc="+_chkdescuento.val();
	}
	if(_chkdestacado.attr('checked')){
		_datos += "&incdest="+_chkdestacado.val();
	}
	if(_chkvista3d.attr('checked')){
		_datos += "&incv3d="+_chkvista3d.val();
	}		
	if(_chkimagenes.attr('checked')){
		_datos += "&incimgs="+_chkimagenes.val();
	}	
	if(_chkdescatalogado.attr('checked')){
		_datos += "&incdescat="+_chkdescatalogado.val();
	}	
	if($.trim(_datos)!=""){
		location.href = ABSOLUTE_PATH+"busqueda/?"+_datos;
	}else{
		$("#mensajeresultado").show();
	}
	
}
