var handleAnswers = function(t) {
	var jsonText = t.responseText;
	var jsonObject = jsonText.parseJSON();
	if(jsonObject.loggedIn != "false") {
		var i, j;
		var commandList = jsonObject.commandList;
		ExecuteCommandList(commandList);	/* found in ajax-voting.js */
	}
}

/* only used if there is an error when making ajax call to get_answers.asp */
var handleAnswersError = function(t) {
	alert("An error occurred while getting your voting answers. Please contact the website administrator.");
}

Event.observe(window,"load",function() {
	/* get user answers for voting */
	/* calls ajax page which returns JSON formatted instructions/commands for displaying answers */
	/* handlerAnswers takes JSON string, creates JSON object and then executes the commands */
	var timeString = new Date().getTime();
	if(blogItemList.charAt(0) == '|') {
		blogItemList = blogItemList.substring(1)
	}
	if(questionList.charAt(0) == '|') {
		questionList = questionList.substring(1)
	}

	var params = 'blogItems='+blogItemList+'&questions='+questionList+'&ts='+timeString;

	new Ajax.Request('/utility/ajax/voting/get_answers.asp', {method:'get', parameters: params, onSuccess:handleAnswers, onFailure:handleAnswersError});
});
