jQuery.ajaxSetup({
	'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")}
});

jQuery(document).ready(function($) {


	// Start Jquery Code
	// $('#editors .overlay').css('opacity','.8');
	
	$('#lists label a').bind('click', open_list);
	
	function unresponsive_click(){
		return false;
	}
	
	function open_list(t){
		
		$(this).unbind('click');
		$(this).bind('click', unresponsive_click);
		
		// Removes Editors list and halts if list is present at current target
		if($(this).parent().siblings('ul').size() > 0){
			$('#lists ul').slideUp('slow', function(){
				$(this).remove();
			});
			$(this).bind('click', open_list);
			return false;
		}
		
		// Removes all open Editor lists to prep for new list
		// Should only allow one open at a time
		$('#lists ul').slideUp('slow', function(){
			$(this).remove();
		});
		
		// Gets content for new list and adds to current target
		$.get($(this).attr('href'), function(data){
			$(t.target).parent().parent().append(data).children('ul').hide().slideDown('slow');
			$(t.target).bind('click', open_list);
		});
				
		return false;
	};
	
	// End of JQuery Code
});