function filterArticles(selectBoxId)
{
	wait(true);
	try
	{
		var sb = get(selectBoxId);
		var filterValue = getValue(selectBoxId+"Filter").toUpperCase();
		if (filterValue=="" || filterValue.charAt(0)=="*")
			filterValue="*";//select all	
		var selVal = Number(sb.selectedIndex > -1 ? sb.options[sb.selectedIndex].value : -33);
		for (var i=sb.childNodes.length-1;i>=0;i--)
		{//clear select box
			if (sb.childNodes[i].nodeName=="OPTGROUP")
				sb.removeChild(sb.childNodes[i]);
			else if (sb.childNodes[i].nodeName=="OPTION" && sb.childNodes[i].value!=0)
				sb.removeChild(sb.childNodes[i]);
		}	
		var curCat=null;
		for (var i=0;i<_articles.length;i++)
		{//fill select box with matches
			var art = _articles[i];
			if (Number(art.id)!=selVal && Number(sb.priceList)>0 && sb.priceList != art.lst)
				continue;
			if (Number(art.id)==selVal 
			|| (! art.ia && (filterValue=="*" || -1 < art.des.toUpperCase().indexOf(filterValue))))
			{
				if (curCat == null || art.cat != curCat.label)
				{
					curCat = document.createElement("OPTGROUP");
					curCat.label = art.cat;
					curCat.style.fontWeight="bold";
					sb.appendChild(curCat);
					curSub=null;
				}
				var opt = document.createElement("OPTION");
				if (Number(art.id)==selVal)
				{//show full name so it looks good when select box is closed
					opt.innerHTML = art.cat + "-" + art.grp + (art.up==1 ? "" : "-" + art.des);
					opt.selected = true;
				}
				else
				{//use short names to look good in groups
					opt.innerHTML = art.grp + (art.up==1 ? "" : "-" + art.des);
				}
				opt.value = art.id;
				curCat.appendChild(opt);
			}	
		}
		wait(false);
	}
	catch (e)
	{
		wait(false);
		alert("Filtering failed: " + e);
	}
}
function getLastInsert()
{
	var li = httpGet(url(getDocBase() + "AppletServer","function",8));
	return li > "" ? eval("new Object(" + li + ");") : null;
}
function pleaseWait()
{
	wait(true);
}
function stopWaiting()
{
	wait(false);
}