// JavaScript Document
// Callback functions for handling server response when getting next page.

var boardDiv = null;
var nextDiv = null;

function getNextPage(sUrl,currPage){
	var request = YAHOO.util.Connect.asyncRequest('GET', sUrl, callbackNextPage);
	boardDiv = document.getElementById('messageBoard');
	nextDiv = document.getElementById('nextPage_'+currPage);
	nextDiv.innerHTML = "<img src='/yui/utefans/wait.gif' width='32' height='32' />";
}

//Add response to end of div
var handleSuccessNextPage = function(o){
	if(o.responseText !== undefined){
		nextDiv.innerHTML = "";
		boardDiv.innerHTML += o.responseText;
	}
}

var handleFailureNextPage = function(o){
	if(o.responseText !== undefined){
		boardDiv.innerHTML = "<li>Transaction id: " + o.tId + "</li>";
		boardDiv.innerHTML += "<li>HTTP status: " + o.status + "</li>";
		boardDiv.innerHTML += "<li>Status code message: " + o.statusText + "</li>";
		nextDiv.innerHTML = "";
	}
}

var callbackNextPage =
{
  success:handleSuccessNextPage,
  failure:handleFailureNextPage,
  argument: { foo:"foo", bar:"bar" }
};