// JavaScript Document
// Callback functions for handling server response when voting for a message.

var threadDiv = null;
var refreshDiv = null;

function getThread(sUrl,msgId){
	var request = YAHOO.util.Connect.asyncRequest('GET', sUrl, callbackThread);
	threadDiv = document.getElementById('thread_'+msgId);
	refreshDiv = document.getElementById('refresh_'+msgId);
	refreshDiv.innerHTML = "<img src='/yui/utefans/wait.gif' width='32' height='32' />";
}

var handleSuccessThread = function(o){
	if(o.responseText !== undefined){
		threadDiv.innerHTML = o.responseText;
	}
}

var handleFailureThread = function(o){
	if(o.responseText !== undefined){
		threadDiv.innerHTML = "<li>Transaction id: " + o.tId + "</li>";
		threadDiv.innerHTML += "<li>HTTP status: " + o.status + "</li>";
		threadDiv.innerHTML += "<li>Status code message: " + o.statusText + "</li>";
	}
}

var callbackThread =
{
  success:handleSuccessThread,
  failure:handleFailureThread,
  argument: { foo:"foo", bar:"bar" }
};