jQuery(document).ready(function($) {
	var useOpenCloseText = 0;
	$('.haz_collapse_object').hide();

	$('.haz_collapse_link').each(function(){
		$(this).parent().addClass('haz_collapse_link_parent');
		//store each link rel in the body object for use when clicked
		$('body').data('original_' + $(this).attr('rel'), $(this).html());

		$(this).click(function(e){
			collapseLink = $(this);
			collapseObject = collapseLink.attr('rel');

			$('.current').slideUp('fast',function()
			{
				$(this).removeClass('current');
				if(useOpenCloseText){
					id = $(this).attr('id');
					originalText = $('body').data('original_' + id);
					$('a[rel='+id+']').html(originalText);
				}
			});


			if(!$('#' + collapseObject).hasClass('current')){
				$('#' + collapseObject).slideDown('fast',function()
				{
					$(this).addClass('current');
					if(useOpenCloseText){
						collapseLink.html('Close');
					}
				});
			}

			e.preventDefault()
		})
	});
});