function setPollResult( sPollId, sPollAnswer )
{
	var a = new PollResult( sPollId, sPollAnswer );
}

function PollResult( sPollId, sPollAnswer )
{
	if ( document.getElementById )
		this.init( sPollId, sPollAnswer );
};

PollResult.prototype.init = function( sPollId, sPollAnswer )
{
	this._rpc = '/rpc.php';
	this._init = false;
	
	this._command = "pollform";

	this._busyclass = "ajaxprogress";
	this._loading = false;
	this._pollid = sPollId;
	this._pollanswer = sPollAnswer;
	
	// load initial list
	this._load();
	
	this._init = true;
	
	return true;
};

PollResult.prototype._load = function()
{
	this._loading = true;
	
	if ( this._init )
		document.body.className += ( " " + this._busyclass );
	
	var oXML = new klib3.xml();
	oXML._parent = this;
	
	oVariable = new Object();
	oVariable.command = this._command;
	oVariable._format = "xml";
	oVariable._cusid = ( typeof this._cusid != "undefined" ) ? this._cusid : "";
	oVariable.pollid = this._pollid;
	oVariable.pollanswer = this._pollanswer;

	oXML.onload  = function()
	{
		this._parent._onLoad( this );
	}	
	oXML.post( this._rpc, true, oVariable );
	
	return false;
};

PollResult.prototype._onLoad = function( oXML )
{
	var oStatus = new Status( oXML );	
	var oDiv = document.getElementById("pollerror");
	if ( oDiv )
	{
		oDiv.className = "feedback " + (oStatus.status == "OK" ? "info" : "error" );
		oDiv.innerHTML = oStatus.message;
	}
	if ( oStatus.status != "ERROR"){
		// nieuwe html erin zetten
		var oDiv = document.getElementById("pollhtml");
		if ( oDiv )
			oDiv.innerHTML = oStatus.content["data"];		
	}
	this._loading = false;
	document.body.className = document.body.className.replace( new RegExp( this._busyclass, "gi" ), "" );
};