Learn by making steps: each step adds more features:
step1 - simplest step. code is not wrapped into class.
step2 - code wrapped into class
step3 - subcategories can be selected independently
back - a little more about linked lists
//=============================================================================================
// Class spawnedCats - Category tree browser.
//
// Allows to browse single branch of category tree, mode all_toggled=false, or
// independently select any subcategory from tree, mode all_toggled=true.
//
// Tree data is preset inside the class.
// Dependency: form and div#category_div like above must exist on page when this initialization
// code is executed: spawnedCats.init().
// Apparently, there is a bug which does not expand first child select box in mode
// "all_toggled=true". Should be easy to fix.
//=============================================================================================
//
//
Copyright (c) 2010 Konstantin V. Kirillov
// Prototype has been used: Prototype JavaScript framework, version 1.6.0.3 (c) 2005-2008 Sam Stephenson