// ajax object so we don't get ajaxrequests that are faster than the former, replacing the former
var AjaxObject = {

	handleSuccess:function(o){
		articlediv = document.getElementById('archive_id'+ o.argument['id']);
		if(o.status == 200){ //responseText !== undefined){
			articlediv.innerHTML = o.responseText;
		} else {
			articlediv.innerHTML = "We are sorry but there was a problem fetching the data from the server.  Please try again";
		}
	},

	handleFailure:function(o){
		articlediv = document.getElementById('archive_id'+ o.argument['id']);
		if(o.responseText !== undefined){
			articlediv.innerHTML = "There was a problem getting the data from the server.  Please try again.  Errorlog: <ul>";
			articlediv.innerHTML += "<li>Transaction id: " + o.tId + "</li>";
			articlediv.innerHTML += "<li>HTTP status: " + o.status + "</li>";
			articlediv.innerHTML += "<li>Status code message: " + o.statusText + "</li></ul>";
		}
	},

	startRequest:function(id){
		sUrl = "archive.jsp";
		articlePostData = "article_id=" + id;
		articlediv = document.getElementById('archive_id'+id);
		callback.argument['id'] = id;
		request = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, articlePostData);
	}
}

var callback =
{
  success:AjaxObject.handleSuccess,
  failure:AjaxObject.handleFailure,
  argument:['id'],
  scope: AjaxObject
};

function makeRequest(id){
	AjaxObject.startRequest(id);
}

