var quotcoll2_requrl, quotcoll2_nexquote, quotcoll2_loading, quotcoll2_errortext;

function quotescollection2_init(requrl, nextquote2, loading, errortext)
{
	quotcoll2_requrl = requrl;
	quotcoll2_nextquote2 = nextquote2;
	quotcoll2_loading = loading;
	quotcoll2_errortext = errortext;
}

function quotescollection2_refresh(instance, exclude, show_author, show_source)
{
    // function body defined below
	var mysack = new sack( quotcoll2_requrl );

	mysack.execute = 1;

	mysack.method = 'POST';
	mysack.setVar("refresh", instance);
	mysack.setVar("exclude", exclude);
	mysack.setVar("show_author", show_author);
	mysack.setVar("show_source", show_source);
	
	mysack.onError = function() { document.getElementById('quotescollection2_randomquote-'+instance).innerHTML = quotcoll2_errortext; };
	mysack.onLoading = function() { document.getElementById('quotescollection2_nextquote2-'+instance).innerHTML = quotcoll2_loading; };
	mysack.onLoaded = function() { document.getElementById('quotescollection2_nextquote2-'+instance).innerHTML = '<a style="cursor:pointer" onclick="quotescollection2_refresh('+instance+','+exclude+','+show_author+','+show_source+');">' + quotcoll2_nextquote2 + ' &raquo</a>'; };
//	mysack.onInteractive = function() { document.getElementById('quotescollection2_nextquote2-'+instance).innerHTML += '...'; };
//	mysack.onCompletion = function() { document.getElementById('quotescollection2_randomquote-'+instance).innerHTML = mysack.response; };
	mysack.runAJAX();
	return true;
}
