	/*
		// Usage of this class
		
		HTTP.connect({		// Options that can be passed:
			action: '',		// action variable passed to remote script
			data: '',		//	data string passed to remote script
			waiting: '',	// replaces a node (button) with waiting image icon
			after: function(){} OR functionname,	// function to call after completion
			update: '' OR object,	// node to update after completion -- auto detects ID or object
		});
	*/

	var HTTP = {
		connect: function(options) {
			url = options.url;	// required
			this.after = options.after;
			this.update = options.update;
			var data = "action=" + options.action + "&" + options.data;
			if (options.waiting){
				this.buttonWait(options.waiting);
				this.waiting = true;
			}

			if (window.XMLHttpRequest) {	// Gecko
				request = new XMLHttpRequest();
				this.request = request;
				request.onreadystatechange = this.transfer;
				request.open("POST", url, true);
				request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
				request.send(data);
			}
			else if (window.ActiveXObject) { // IE
				request = new ActiveXObject("Microsoft.XMLHTTP");
				this.request = request;
				if (request) {
					request.onreadystatechange = this.transfer;
					request.open("POST", url, true);
					request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
					request.send(data);
				}
			}
		},

		transfer: function () {  
			var request = HTTP.request;
			if (request.readyState == 4){ // if xmlhttp shows "loaded"
				if (request.status == 200){  // if "OK"
					if (HTTP.waiting){
						HTTP.buttonRestore();
					}
						
					if (HTTP.after)
						HTTP.after.call(this, request.responseText);
					if (HTTP.update){
						if ((typeof HTTP.update) == 'string')
							document.getElementById(HTTP.update).innerHTML = request.responseText;
						else
							HTTP.update.innerHTML = request.responseText;
					}
				}
				else {
					alert("Problem sending data.  Try again.");
				}
			}
		},

		buttonWait: function (button) {	// replaces a button with the waiting icon
			this.button = button;
			button.style.background = '#7BE17B';
			button.style.color = 'black';
		},

		buttonRestore: function () {
			this.button.style.background = '';
			this.button.style.color = '';
		}
	}
