var VoteButton = Class.create({

	initialize: function(div){
		this.div = div;
		this.id = this.div.up('.inductee').id.split('_')[1];
		this.div.observe('click', this.handle_click.bind(this));
	},
	
	handle_click: function(e){
		new Ajax.Updater({ success: this.div }, '/cravers/hall-of-fame/' + this.id + '/vote.js', { method: 'put' });
		// Track the vote
		flash_track({events: 'event7'});
		Event.stop(e);
	}

});

Event.observe(window, 'load', function() {
	$$('.inductee').each(function(div){
		if (typeof(TextExpander) != "undefined") {
			new TextExpander(div, 'div.last', 'p:not(p:first-of-type)');
		}
		new VoteButton(div.down('.vote'));
	});
});