var randompic_requrl;

function randompic_init(requrl)
{
	randompic_requrl = requrl;
}

function randompic_refresh(exclude)
{
    // function body defined below
	var mysack = new sack( randompic_requrl );

	mysack.execute = 1;

	mysack.method = 'POST';
	mysack.setVar("refresh", 1);
	mysack.setVar("exclude", exclude);
	
	mysack.onError = function() { document.getElementById('randompic_nextentry').innerHTML = 'Error getting entry'; };
	mysack.onLoading = function() { document.getElementById('randompic_nextentry').innerHTML = 'Loading ...'; };
	mysack.onLoaded = function() { document.getElementById('randompic_nextentry').innerHTML = '<a style="cursor:pointer" onclick="randompic_refresh('+exclude+');">Next picture &raquo</a>'; };
//	mysack.onInteractive = function() { document.getElementById('randompic').innerHTML += '...'; };
//	mysack.onCompletion = function() { document.getElementById('randompic').innerHTML = mysack.response; };
	mysack.runAJAX();
	return true;
}
