var liflst_requrl, liflst_nextgoal, liflst_loading, liflst_errortext;

function lifelist_init(requrl, nextgoal, loading, errortext)
{
	liflst_requrl = requrl;
	liflst_nextgoal = nextgoal;
	liflst_loading = loading;
	liflst_errortext = errortext;
}



function lifelist_refresh(instance, exclude, show_author, show_source, filter_tags, char_limit)
{
	jQuery("#lifelist_nextgoal-"+instance).html(liflst_loading);
	jQuery.ajax({
		type: "POST",
		url: liflst_requrl,
		data: "refresh="+instance+"&exclude="+exclude+"&show_author="+show_author+"&show_source="+show_source+"&char_limit="+char_limit+"&tags="+filter_tags,
		success: function(response) {
			jQuery("#lifelist_randomgoal-"+instance).hide();
			jQuery("#lifelist_randomgoal-"+instance).html( response );
			jQuery("#lifelist_randomgoal-"+instance).fadeIn("slow");	
		},
		error: function() {
			alert("There was an error getting goal.");
			jQuery("#lifelist_nextgoal-"+instance).html(liflst_nextquote);
		}	
	});
}

