/*
 * This is used on the 'Listen' page to show the mp3 listing for each selected category
 */
var last_clicked_link_object = null;
var blind_duration = 1;
function show_mp3s(link_object) {
  // Used to prevent duplication within the 'show_mp3s' function
	function show_selected_list(list_id, link_id, old_link_id) {
		new Effect.BlindDown(
			list_id,
			{
				scaleX : false,
				scaleY : true,
				scaleContent : false,
				duration : blind_duration,
				afterFinish : function() {
				  // Do we need to remove a highlight?
					if(old_link_id) {
						Element.setStyle(old_list_link, { fontWeight:'normal' });
					}
				  // Highlight the item selected
					Element.setStyle(link_id, { fontWeight:'bold' });
				}
			}
		);
	}


	if(!link_object  ||  (!is_windows  &&  is_ie)) {
	  // Something's wrong so use the HREF
		return true;
	}
  // Remove the highlight around the link
	link_object.blur();
	if(link_object == last_clicked_link_object) {
		return false;
	}
  // Start the effect
	var list_id = link_object.id + "_mp3";
	if(last_clicked_link_object != null) {
	  // Hide the currently viewed item and then show the new one
		var old_list_link = last_clicked_link_object.id;
		var old_list_id = last_clicked_link_object.id + "_mp3";
		new Effect.BlindUp(
			old_list_id,
			{
				scaleX : false,
				scaleY : true,
				scaleContent : false,
				duration : blind_duration,
				afterFinish : function() {
				  // Display the new selection (adding / removing any highlighting as necessary)
					show_selected_list(list_id, link_object.id, old_list_link);
				}
			}
		);
	} else {
	  // Simply show the new item
		show_selected_list(list_id, link_object.id);
	}
	last_clicked_link_object = link_object;
	return false;
}
