// JavaScript Document
// Author: Andy Asberry, Ciphertek Systems, LLC
// Date: October 2009



var Poll = new function() {
	this.ajax = null;
	this.form = null;
	
	this.init = function() {
	  var self = Poll;
	  self.ajax = new Ajax();
	  self.form = document.getElementById('poll_form');
	};
	
	this.submitData = function() {
	  var self = Poll;
	  var postData = '';
	  postData = formData2QueryString(self.form);
	  self.ajax.doPost('/php_inc/poll_class/doPoll.php', postData, self.handleResp);
	  
	};
	
	this.handleResp = function(str) {
	  var self = Poll;
	  if (str.length > 0) {
	    self.form.innerHTML = str;
	  }
	  else {
		alert('There was an error processing your request.');
	  }
	};
	
	this.cleanup = function() {
	  var self = Poll;
	  self.ajax = null;
	  self.form = null;
	}
};
