function filter_by(obj) {
	if (obj == 'search') {
		var w = 'search';
		var v = $("#search_filter").val();
	} else {
		var w = obj.id;
		var v = obj.value;
	}
	if (get_a.length > 0) {
		//0=aisle : 1=shelf : 2=manufacturer : 3=sort : 4=page: : 5=search : 6=department name : 7=aisle name
		var get_array = get_a.split(':');
		switch(w) {
		case 'mfg':
			if (v == 'all') {
				get_array[2] = '';
			} else {
				get_array[2] = v;
			}
			get_array[4] = '';
			break;
		case 'shelf':
			if (v == 'all') {
				get_array[1] = '';
			} else {
				get_array[1] = v;
			}
			get_array[4] = '';
			break;
		case 'sort_by':
			get_array[3] = v;
			get_array[4] = '';
			break;
		case 'search':
			get_array[5] = v;
			get_array[4] = '';
			break;
		}
		var new_get = get_array.join(':');
		document.location.href = '?a=' + new_get;
	}
	if (get_m.length > 0) {
		//0=manufacturer : 1=sort : 2=page : 3=search : 4=mfg name
		var get_array = get_m.split(':');
		switch(w) {
		case 'sort_by':
			get_array[1] = v;
			get_array[2] = '';
			break;
		case 'search':
			get_array[3] = v;
			get_array[2] = '';
			break;
		}
		var new_get = get_array.join(':');
		document.location.href = '?m=' + new_get;
	}
	if (get_s.length > 0) {
		//0=sort : 1=page : 2=search
		var get_array = get_s.split(':');
		switch(w) {
		case 'sort_by':
			get_array[0] = v;
			get_array[1] = '';
			break;
		case 'search':
			get_array[2] = get_array[2] + " " + v;
			get_array[1] = '';
			break;
		}
		var new_get = get_array.join(':');
		document.location.href = '?s=' + new_get;
	}
	if (get_p.length > 0) {
		//0=sort : 1=page : 2=search : 3=pid
		var get_array = get_p.split(':');
		switch(w) {
		case 'sort_by':
			get_array[0] = v;
			get_array[1] = '';
			break;
		case 'search':
			get_array[2] = v;
			get_array[1] = '';
			break;
		}
		var new_get = get_array.join(':');
		document.location.href = '?p=' + new_get;
	}
}

function list_mfg() {
	$(".td_select").mouseenter(function(){$(this).css("cursor","pointer");$(this).css("background-color","#ccc");});
	$(".td_select").mouseleave(function(){$(this).css("background-color","#fff");});
	$(".td_select").click(function(){ go_mfg($(this).text(),$(this).attr("id"));$.fancybox.close();});
	//$.fancybox($("#lists_div"),{'overlayOpacity':0.7,'overlayColor':'#000000'});
	$.fancybox($("#lists_div"),{'overlayOpacity':0.7,'overlayColor':'#000000','scrolling':'no','width':910,'height':490});
}
function go_mfg(m,i) {
	document.location.href = host + '/?m=' + i + '::::' + m.replace(/ /g,'-').replace('/','-');
}
function go_search() {
	if ($('#search_field').val().length > 0) {
		document.location.href = host + '/?s=::' + escape($('#search_field').val());
	}
}
function go_search_pid() {
	if ($('#search_pid').val().length > 0) {
		document.location.href = host + '/?p=:::' + escape($('#search_pid').val());
	}
}

