//Global Variable to store the ID of the category that was clicked
            var clickedCategory=0;
            function hideItems(catID) {

                //If the clickedCategory variable is not set, this is the first
                //level of recursion. Assign the catID to the global variable
                //as it is the clicked category.
                if (clickedCategory==0) {
                    clickedCategory=catID;
                }

                var validChildren=false;

                //Get the Parent Element of which we are investigating the children
                var parCat=document.getElementById(catID);

                //Get children of the parent element that are <li> tags.
                var childArray=parCat.getElementsByTagName('li');

                //Verify that the element has children
                if (childArray) {

                    //Loop through each child node
                    for (x in childArray) {

                        //Get the ID of the child node;
                        var childID=childArray[x].id;

                        //Verify the child node has an ID
                        if (childID) {

                            //Declare/Reset the state variable. Used for
                            //Determining the collapsed/expanded state.
                            var state="";

                            //Grab the first 4 characters of the node's ID
                            var idPrefix=childID.substring(0,4);

                            //Verify we are working with a <li> that has a category ID
                            if (idPrefix=="cat_") {
                                validChildren=true;
                                //Recursive call to check for child elements.
                                //This is only needed if the expansion goes more than
                                //One level deep.
                                if (hideItems(childID)) {
                                }

                                //Grab the ID of the parent <li> tag
                                var parentNodeID=document.getElementById(childID).parentNode.parentNode.id;

                                //Use the node ID to find the appropriate element
                                var elementID=document.getElementById(childID);

                                //Check to see if the element is displayed or not.
                                //If it isn't displayed and the clicked category is
                                //The parent <li> tag, then display it. This allows
                                //For only the first level of hierarchy to be affected.
                                if (elementID.style.display=="none" && parentNodeID==clickedCategory) {

                                    //Display the element
                                    elementID.style.display="block";

                                    //Set the state to expanded to determine the
                                    //Necessary state of the button.
                                    state="expanded";

                                } else {

                                    //If the block is already being displayed, hide it.
                                    document.getElementById(childID).style.display="none";

                                    //Set the state to collapsed to determine the
                                    //Necessary state of the button.
                                    state="collapsed"
                                }

                                //Recursive call to check for child elements.
                                //This is only needed if the expansion goes more than
                                //One level deep.
                                //hideItems(childID);
                            }

                            //Set the stated of the button based on the state.
                            if (document.getElementById('button_'+catID.substring(4))) {
                                if (state=="expanded") {
                                    document.getElementById('button_'+catID.substring(4)).src='/images/collapse.gif';
                                } else {
                                    document.getElementById('button_'+catID.substring(4)).src='/images/expand.gif';
                                }
                            }
                        }
                    }
                }

                //If the catID matches the clickedCategory variable we are back
                //Out to the first level of recursion, and are finished, so we
                //set the global variable clickedCategory back to 0.
                if (catID==clickedCategory) {
                    clickedCategory=0;
                }
                return validChildren;
            }
