$(document).ready(function() {
	init('naxx', 'ulduar', 'ony', 'toc');
});

var showProgress = 'Show progress';
var hideProgress = 'Hide progress';

function init() {
	var args = arguments;
	var len = args.length;
	if ( len > 0 ) {
		var i = 0;
		while ( i < len ) {
			// give the link it's text
			// then
			// give the toggle their action for the content	
			$('#'+args[i]+'-toggle a').text(showProgress).click(function() {
				var name = $(this).parent().attr('id').toString().split('-')[0];
				var state = $(this).text() == showProgress;
				if ( state ) {
					$(this).text(hideProgress);
					$('#'+name+'-content').slideDown('slow');
				}
				else {
					$(this).text(showProgress);
					$('#'+name+'-content').slideUp('fast');
				}
			});			
			i++;
		}
	}
}
