// JavaScript Document
$(".treeview").ready(function() {
  $("ul.treeview > li > span").removeClass("pointage").siblings().hide();
    //Tab for 1st level
    $('ul.treeview > li > span').first().addClass("pointage").siblings().show();
    $('ul.treeview > li > span').each(function(i) {
        $(this).addClass('treeview_tab')
            .css("top", i * 90);
    }).click(function() {
    $("ul.treeview > li > span").removeClass("pointage").siblings().hide();
        $(this).addClass("pointage").siblings().show();
    });
});

$(function(){
  //Folder for 2nd level
  $('ul.treeview > li > ul >li').each(function(){
    $(this).children('ul').hide();
	$(this).prepend("<span>&nbsp; &nbsp; </span>")	  
	if($(this).children("ul").length>0)
	  $(this).children('span').addClass('folder').click(function(){
		  $(this).parent().siblings().children('ul').hide();
		  $(this).siblings('ul').toggle();
			});
  });

  //Plus mark for 3rd level
  $('ul.treeview > li > ul >li > ul >li').each(function(){
    $(this).children('ul').hide();
	if($(this).children("ul").length>0)
    $(this).prepend("<span class='plus'>&nbsp; &nbsp; </span>").children("span")
      .click(function(){
        $(this).siblings('ul').toggle();
		$(this).css('backgroundPosition',$(this).siblings('ul').css("display")=='block'?'left -15px':'left 3px');
          });
  });
  $('ul.treeview a').each(function(i){
	       $(this).parent().removeClass("pointOut");	     
           if(this.href.match(location.href))
           {
               $(this).parent().addClass("pointOut").parents('ul,li').show();     
           }
       });
});
// JavaScript Document
