Streamlining code

This is alot of code to read through. Can you be a little more specific? When you say not working, what do you mean?

It looks like you are calling all the expand/collapse code every time your dropdown changes.

I would perhaps isolate one use case and debug it and then you will know how to hookup the rest