BehaviourRules = {
	'form.pollform input.pollsubmit' : function(but){
		Event.observe(but,"click", function(e){
			var jsonobj = new Object;
			jsonobj["id"] = but.id.substring(0,but.id.length-7);
			jsonobj["choice"] = $FT(but.form.elements.choice);
//			alert(Object.toJSON(jsonobj));
			gotourl = getAjaxURL();
			var myAjax = new Ajax.Request(gotourl, {method: 'post', 
				postBody: Object.toJSON(jsonobj), 
				onComplete: function(e){
					AJAX.showResponse(e);
	//					Behaviour.applyToId(tablediv.id);
					AJAX.complete(wrapperdiv);
				},
				onLoading: function(e){
					AJAX.loading(wrapperdiv);
				},
				onFailure: AJAX.reportError, 
				contentType: 'text/plain; charset=UTF-8'} );
			Event.stop(e); // to prevent click action
		});
	},
	'form.pollform div.abstain a' : function(abst){
		Event.observe(abst,"click", function(e){
			var jsonobj = new Object;
			jsonobj["id"] = abst.id.substring(0,abst.id.length-8);
			jsonobj["choice"] = "abstain";
//			alert(Object.toJSON(jsonobj));
			gotourl = getAjaxURL();
			var myAjax = new Ajax.Request(gotourl, {method: 'post', 
				postBody: Object.toJSON(jsonobj), 
				onComplete: function(e){
					AJAX.showResponse(e);
	//					Behaviour.applyToId(tablediv.id);
					AJAX.complete(wrapperdiv);
				},
				onLoading: function(e){
					AJAX.loading(wrapperdiv);
				},
				onFailure: AJAX.reportError, 
				contentType: 'text/plain; charset=UTF-8'} );
			Event.stop(e); // to prevent click action
		});
	}
};
Behaviour.load(BehaviourRules);
