// JavaScript Document
var j$ = jQuery; 
 
j$(function(){ 
  j$(".acc").each(function(){ 
    j$("li > a", this).each(function(index){ 
      var $this = j$(this); 

		var arr=location.href.split("/");
		
		if(arr[arr.length -2] == "house"){
			if(index > 0) $this.next().hide(); 
		}else if(arr[arr.length -2] == "reform"){
			if(index == 0) $this.next().hide(); 
			if(index > 1) $this.next().hide(); 
		}else if(arr[arr.length -2] == "good"){
			if(index < 2) $this.next().hide(); 
			if(index > 2) $this.next().hide(); 
		}else if(arr[arr.length -2] == "aboutus"){
			if(index < 5) $this.next().hide(); 
			if(index > 5) $this.next().hide(); 
		}else if(arr[arr.length -1] == "voice.html"){
			if(index < 3) $this.next().hide(); 
			if(index > 3) $this.next().hide(); 
		}else if(arr[arr.length -1] == "performance.html"){
			if(index < 4) $this.next().hide(); 
			if(index > 4) $this.next().hide(); 
		}else{
			if(index > -1) $this.next().hide(); 
		}
		
		var $endPath = arr[arr.length -1]; 
		var $endPath2 = arr[arr.length -2];  
		if($endPath == ""){
		$('ul.acc li ul li a[href$="'+$endPath2+'/"]').parent().parent().addClass('active');
		}else{
		$('ul.acc li ul li a[href$="'+$endPath+'"]').parent().parent().addClass('active');
		}
 
      $this.click(function(){ 
        var params = {height:"toggle", opacity:"toggle"}; 
        j$(this).next().animate(params).parent().siblings() 
          .children("ul:visible").animate(params);
        return false; 
      }); 
    }); 
  }); 
}); 
