Folded counts issue for multiple contents

Folders (a href link) are indexed with numbers to be identified by jQuery script. However, the number is reset to zero for each page content. For example, when there are folders in sidebar, they are opened/closed by clicking other folders in main content. This problem is due to index numbers for folder, 'folded_count's are overlaps.

In this fork, some codes were modified so that jQuery finds and counts folder element (A) and folded element (SPAN, DIV). So all folders work correctly in either sidebar or main contents. They also work in multiple tab page with tabinclude plugin.