jQuery(document).ready(function(){

});

function app_filemanagerTreeView() {
  jQuery('.treeView li .node .expander').click(function(event) {
	  $this = jQuery(this);
	  $node = $this.parents('.node');
	  $header = $this.parents('.node').children('.header');
	  $content = $this.parents('.node').children('.content');
	  $aExpander = jQuery('a.expander', $header);
	  $ol = $node.siblings('ol');

	  if ($header.hasClass('active')) { $header.removeClass('active'); } 
	  else { $header.addClass('active'); }
	  
	  if ($aExpander.html() == '+') { $aExpander.html('-'); }
	  else { $aExpander.html('+'); }
	  
	  if ($ol.is(':hidden')) { $ol.show(); }
	  else { $ol.hide(); }
	  
	  if ($content.is(':hidden')) { $content.show(); }
	  else { $content.hide(); }
	  
	  jQuery.ajax({
	        type: 'POST',
	        url: '/website/filemanager/file/id/' + $node.attr('rel')
	  });
	  
	  event.stopPropagation();
  });
}
