/**
 * ajax.js
 * Hammer of Goel Guild Site
 * Duane Sibilly II <admin@hammerofgoel.com>
 * 
 * This script provides basic AJAX functionality to the Hammer of Goel WordPress
 * theme.  It periodically updates the Ventrilo Status section of the theme with
 * a realtime roster of who is using our Ventrlo server.
 *
 * Prototype 1.6.x or higher is required.
 */

var HAMMER = {
	init: function() {
		this.VentModule.update_vent();
	},
	
	VentModule: {
		target: 'vent',
		url: '/wp-content/themes/hammerofgoel/includes/ajax/vent.php',
		updater: 0,

		update_vent: function() {
			var target = this.getTarget();
			var url = this.getURL();
			var interval = 3;
			var options = {
				method: 'post',
				frequency: interval,
				decay: 2
			};
			
			this.updater = new Ajax.PeriodicalUpdater(target, url, options);
			this.showRoster();
		},
		start: function() {
			this.updater.start();
		},
		stop: function() {
			this.updater.stop();
		},
		
		getTarget: function() {
			return this.target;
		},
		getURL: function() {
			return this.url;
		},
		showRoster: function() {
			return true;
		}
	}
};

//Event.observe(window, 'load', HAMMER.init); // RUINS "this"
Event.observe(window, 'load', function() { HAMMER.init(); });
