jQuery(function($) {
	
	$('.box ul li').each(function() { 
		if($('ul', this).length){
			$(this).find('a:eq(0)').addClass('has-dd');
			$('<span class="arrow">&nbsp;</span>').appendTo($(this).find('a:eq(0)'));
		}
	});

	$('#sidebar li.current_page_item').parent().parent('.current_page_parent').find('a:eq(0)').addClass('active');
	
	$('.box ul:eq(0) > li > a').live('click', function() {
		var this_dd = $(this).parent().find('ul');
		$('.box a').not($(this)).removeClass('active');
		$('.box ul li ul').not(this_dd).slideUp();
		
		if ($(this).hasClass('has-dd')) {
			if ($(this).hasClass('active')) {
				this_dd.slideUp();
				$(this).removeClass('active');
			} else {
				this_dd.slideDown();
				$(this).addClass('active');
			};
			return false;
		} else {
			$(this).addClass('active');
		};
		
	});
	
	if ($.browser.msie && $.browser.version.substr(0,1)<7) {
		DD_belatedPNG.fix('.container, h1#logo a ,.top ,.bottom ,.inner');
	};
});
