var _id = 'folder-list';
var _slideEl = 'ul';
var _duration = 300;
var _hide = false;

$(document).ready(function() {
	$('.'+_id+' a').click(function () {
		if (_hide) hideLevels(this);
		$(this).next(_slideEl).toggle(_duration);
		$(this).parent().toggleClass('active');
		$(this).DupeHref();
		return false;
		
	});
});

function hideLevels(_this){
	$('.'+_id+' li').each(function() {
		var _f = false;
		var _a = $('a', this).each(function(i, _el) {
			if (_el == _this) _f = true;
		});
		if (!_f)  {
			$(_slideEl, this).hide(_duration);
			$(this).removeClass('active');
		}
	});
}
jQuery.fn.DupeHref =  function(){  			
    var target = $(this).find(".active ul li a").attr("href");
	if(typeof(target) === void(0)){}else{window.location(target);}
}



