var _openDirs = new Array;

function openDir(_dir,_depth) {	
	
	//console.log(_dir + " " + _depth);
	
	for(var i = 0; i < _openDirs.length; i++) {
		
		if (i >= _depth) {
			$("#sub" + _openDirs[i]).animate({"height":"toggle","opacity":"toggle"}, "slow");
			delete _openDirs[i];
		}
	}
	
	_openDirs[_depth] = _dir;
	$("#sub"+_dir).animate({"height":"toggle","opacity":"toggle"}, "slow");
}

function startDir(_dir,_depth) {
	
	if(_dir == 0) {
		return;
	}
	
	for(i = _depth; i >= 0; i--) {

		$("#sub"+_dir).css("display","block");
	
		_openDirs[i] = _dir

		_dir = $("#sub"+_dir).parent().attr("id").replace(/sub/,"");
	}
}
