well i am not a javascript expert or coder i need help to update this javascript so that it works properly with no errors
<script type="text/javascript">
<!--
$('.categoryNodeInfo').prepend("<div class='showhideNodes hideNodes'>Collapse</div>");
var showhideNodesCookie = $.getCookie('showhideNodes');
var showhideNodesArray=new Array();
if (showhideNodesCookie) {
showhideNodesArray = showhideNodesCookie.split(",");
$.each(showhideNodesArray,function(){
var selector = 'li[id='+this+']';
$(selector+' ol.nodeList').hide();
$(selector+' .showhideNodes').toggleClass('showNodes');
$(selector+' .showhideNodes').toggleClass('hideNodes');
$(selector+' .showhideNodes').text('showhideNodes_expand');
});
}
$('.showhideNodes').click(
function() {
if ($(this).text() == 'Collapse') {
$(this).parent().next().slideUp();
$(this).text('showhideNodes_expand');
//if($.inArray(this,showhideNodesArray) != -1){
showhideNodesArray.push($(this).parent().parent().attr('id'));
$.setCookie('showhideNodes',showhideNodesArray.join(","));
//}
}
else if ($(this).text() == 'showhideNodes_expand') {
$(this).parent().next().slideDown();
$(this).text('Collapse');
var remove = $(this).parent().parent().attr('id');
showhideNodesArray.splice($.inArray(remove,showhideNodesArray),1);
$.setCookie('showhideNodes',showhideNodesArray.join(","));
}
$(this).toggleClass('showNodes');
$(this).toggleClass('hideNodes');
});
//-->
</script>
well i hope someone can update it with its same functioning thanks and sorry for my bad english