if you means that you have many hidden div tag and only first div is visible,
you can use a general variable (for example $status=0)that shown level0 position.
so when click on first level offer to
$(".categorylist").click(function(){}
in function start be check every div tags with "categorylist" class and ...
my friend see below code:
$status=0;
$(document).ready(function()
{
for($x=1; $x<=$categories.length; $x++){
$(".categorylist.level"+$x).css("display", "none");
}
$(".categorylist").click(function(){
for($x=0; $x<=$categories.length; $x++)
{
if($status==$x){
$(".categorylist.level"+$x).css("display", "none");
$(".categorylist.level"+$x+1).css("display", "block");
}
}
});
});