var speed    = "middle";
var expanded = new Array(false,false,false);

jQuery.fn.slideFadeDown = function(speed, easing, callback) {
	return this.animate({opacity: 'show', height: 'show'}, speed, callback);
};

jQuery.fn.slideFadeUp = function(speed, easing, callback) {
	return this.animate({opacity: 'hide', height: 'hide'}, speed, callback);
};

function animateSelectBox(ulID, id) {

	$('ul#'+ulID).hide();

	$('div#'+ulID+'-div').parent().click(function(){
		$(this).unbind('click');		
		if (!expanded[id]) $('ul#'+ulID).slideFadeDown(speed);
		expanded[id] = true;
		$('body').click(function(){
			$('ul#'+ulID).slideFadeUp(speed,'',function(){
				expanded[id] = false;				
			});			
		});
		return false;
	});
	
}
	
