/* Created by GrandPix.fi */
var currentList = null;
function showList(list_id){
	if(currentList){
		collapseList(currentList);
	}
	if(list_id && list_id !== currentList){
		expandList(list_id);
		currentList = list_id;
	} else {
		currentList = null;
	}
}
function expandList(list_id){
	var list = document.getElementById(list_id);
	list.setAttribute('expanding','true');
	if(typeof(list_id+'_timer') == "undefined"){
		eval(list_id+'_timer = null');
	}
	show = function(lid){
		var l = document.getElementById(lid);
		clearTimeout(lid+'_timer');
		if(l.getAttribute('expanding') == 'true' && l.clientHeight < l.scrollHeight){
			var step = Math.ceil((l.scrollHeight-l.clientHeight)/3);
			l.style.height = l.clientHeight+step+'px';
			eval(lid+'_timer = setTimeout(function(){show(lid)},20)');
		} else {
		}
	}
	show(list_id);
}
function collapseList(list_id){
	var list = document.getElementById(list_id);
	list.setAttribute('expanding','false');
	if(typeof(list_id+'_timer') == "undefined"){
		eval(list_id+'_timer = null');
	}
	hide = function(lid){
		var l = document.getElementById(lid);
		clearTimeout(lid+'_timer');
		if(l.getAttribute('expanding') == 'false' && l.clientHeight > 1){
			var step = Math.ceil(l.clientHeight/3);
			l.style.height = l.clientHeight-step+'px';
			eval(lid+'_timer = setTimeout(function(){hide(lid)},20)');
		} else {
		}
	}
	hide(list_id);
}
