function showLang(langId){
	var plusloc = "/images/plus.png";
	var minusloc = "/images/minus.png";
	if (checkBeforeIE6()){
		plusloc = "/images/plus.gif";
		minusloc = "/images/minus.gif";
	}
	var langSub = document.getElementById("lang"+langId);
	var langTop = document.getElementById("l"+langId);
	var img = document.getElementById("img"+langId);
	if (langSub.style.display == "none"){
		// set queue to this UL ID and limit to one to avoid running multiple clicks
		// set callback function to change the plus to a minus before starting the animation
		new Effect.Grow('lang'+langId, {
			direction: 'top-left',
			queue: { position: 'end', scope: 'lang'+langId, limit: 1},
			afterFinish: function(effect){ img.src = minusloc; }
		});
	}else{
		// set queue to this UL ID and limit to one to avoid running multiple clicks
		new Effect.Shrink('lang'+langId, {
			direction: 'top-left',
			queue: { position: 'end', scope: 'lang'+langId, limit: 1},
			afterFinish: function(effect){ closeSub(langSub); img.src = plusloc; }
		});
	}
}

function showCat(langId, catId){
	var plusloc = "/images/plus.png";
	var minusloc = "/images/minus.png";
	if (checkBeforeIE6()){
		plusloc = "/images/plus.gif";
		minusloc = "/images/minus.gif";
	}
	var catSub = document.getElementById("lang"+langId+"cat"+catId);
	var catTop = document.getElementById("l"+langId+"c"+catId);
	var img = document.getElementById("img"+langId+"c"+catId);
	if (catSub.style.display == "none"){
		new Effect.Grow('lang'+langId+'cat'+catId, {
			direction: 'top-left',
			queue: { position: 'end', scope: 'lang'+langId+'cat'+catId, limit: 1},
			afterFinish: function(effect){ img.src = minusloc; }
		});
	}else{
		new Effect.Shrink('lang'+langId+'cat'+catId, {
			direction: 'top-left',
			queue: { position: 'end', scope: 'lang'+langId+'cat'+catId, limit: 1},
			afterFinish: function(effect){ img.src = plusloc; }
		});
	}
}

function closeSub(langSub){
	var plusloc = "/images/plus.png";
	if (checkBeforeIE6()){
		plusloc = "/images/plus.gif";
	}
	// use prototype elements
	// select nested UL elements inside the language
	var list = $(langSub.id).select('ul');
	for (var i=0; i<list.length; i++){
		var ul = list[i].identify();
		// select nested UL elements inside the categories
		var subList = $(ul).select('ul');
		for (var j=0; j<subList.length; j++){
			var subUl = subList[j].identify();
			// if the UL's children are visible, change its list icon and hide its contents.
			if ($(subUl).getStyle('display') == "block"){
				var img = $(ul).select('img');
				img[0].src = plusloc;
				new Effect.Shrink(subUl, {
					direction: 'top-left',
					duration: .2
				});
			}
		}
	}
}

function checkBeforeIE6(){
	var browser=navigator.appName;
	var b_version=navigator.appVersion;
	var version=parseFloat(b_version);
	if (browser == "Microsoft Internet Explorer" && version <= 4){
		return true;
	}else{
	 	return false;
	}
}