function openBranch(jQueryElement, noAnimation) {jQueryElement.addClass('OPEN').removeClass('CLOSE');if(noAnimation)jQueryElement.parent().find('ul:first').show();else jQueryElement.parent().find('ul:first').slideDown();}function closeBranch(jQueryElement, noAnimation){jQueryElement.addClass('CLOSE').removeClass('OPEN');if(noAnimation)jQueryElement.parent().find('ul:first').hide();else jQueryElement.parent().find('ul:first').slideUp();}function toggleBranch(jQueryElement, noAnimation) {if(jQueryElement.hasClass('OPEN'))closeBranch(jQueryElement, noAnimation);else openBranch(jQueryElement, noAnimation);}$(document).ready(function () {if(!$('ul.tree.dhtml').hasClass('dynamized')){$('ul.tree.dhtml ul').prev().before("<span class='grower OPEN'> </span>");$('ul.tree.dhtml ul li:last-child, ul.tree.dhtml li:last-child').addClass('last');$('ul.tree.dhtml span.grower.OPEN').addClass('CLOSE').removeClass('OPEN').parent().find('ul:first').hide();$('ul.tree.dhtml').show();$('ul.tree.dhtml .selected').parents().each( function() {if ($(this).is('ul'))toggleBranch($(this).prev().prev(), true);});toggleBranch( $('ul.tree.dhtml .selected').prev(), true);$('ul.tree.dhtml span.grower').click(function(){toggleBranch($(this));});$('ul.tree.dhtml').addClass('dynamized');$('ul.tree.dhtml').removeClass('dhtml');}});
