//Show and hide items of a given tag on the page based on the selected value of a dropdownlist
//param: selectID - the id of the dropdownlist
//param: itemTag - the tagname of items involved
//param: itemGroupName - the value of the 'title' attribute on the items, thus defining the group of items to which 
// the selection applies
function showSelectedItem(selectID, itemTag, itemGroupName){
	showSelectedItemWithExtraAttribute(selectID, itemTag, itemGroupName, null);
} 
//Show and hide items of a given tag on the page based on the selected value of a dropdownlist, and an extra attribute
// the extra attribute needs to be set on the select-element as well as the items to which it applies
function showSelectedItemWithExtraAttribute(selectID, itemTag, itemGroupName, extraAttribute){
	var selectElem = document.getElementById(selectID); 
	if (selectElem!=null){
		var selectedValue = selectElem.options[selectElem.selectedIndex].value;
		var items= document.getElementsByTagName(itemTag);
		for (var index=0; index<items.length; index++){
			if (items[index].getAttribute("title")==itemGroupName){
				items[index].style.display="none";
				if ((items[index].id==selectedValue)||(selectedValue=="all")){
					if (extraAttribute){
						if (items[index].getAttribute(extraAttribute)==selectElem.getAttribute(extraAttribute)){
							items[index].style.display="block";
						}
					}else{
						items[index].style.display="block";
					}
				}
			}
		}
	}
}