	/* Spinboard
	--------------------------------------------------------*/
	init_events.push (function () {
		// How long between each spin? (milliseconds)
		var spin_interval = 5000;
		var pause_length  = 25000;

		// Create the array of spinboards and their tabs
		var spinboards = $$('#spinboards .spinboard');
		var spinboard_tabs = $$('#spinboard_tabs li');
		$('spinboard_container').setStyle ('overflow', 'visible');
		if (spinboards.length != spinboard_tabs.length)
		{
			alert ('WARNING: More tabs than boards, or vice versa.');
		}

		// Create the wee pointer arrow element
		spinboard_arrow = new Element ('img', {
			'src': '/images/widgets/spinboard/arrow.gif',
			'id': 'spinboard_tab_arrow'
		});
		$('spinboards').adopt (spinboard_arrow);

		// Setup basic styling and events beyond what CSS is capable of
		total_width_of_tabs = 760 - (spinboards.length - 1);
		average_tab_width = Math.floor (total_width_of_tabs / spinboards.length);
		spinboard_tabs.each (function (element, index) {
			var a_obj = element.getElement ('a');

			spinboards[index].setStyle ('z-index', spinboards.length - index);

			// Add the 'first' class to the first tab
			if (index == 0)
			{
				element.addClass ('first');
			}

			// Set proper width
			a_obj.setStyle ('width', average_tab_width).onclick = return_false;
			if (index == spinboards.length - 1)
			{
				a_obj.setStyle ('width', average_tab_width + (total_width_of_tabs - (average_tab_width * spinboards.length)));
			}

			if ($chk ($('IE')))
			{
				a_obj.setStyles ({
					'position': 'absolute',
					'bottom': 0,
					'margin-left': 0,
					'left': index * (average_tab_width + 1)
				});
			}

			// Assign event
			a_obj.addEvent ('click', function () {
				pause_spinner (pause_length, true);
				spin_to_board (index);
			});
		});

		// Hover will pause
		$('spinboard_container').addEvents ({
			// Pause on mouseover for 60 seconds
			'mouseover': function () {
				pause_spinner (1000 * 60);
			},
			// Restart
			'mouseout': function () {
				start_spinner ();
			}
		});

		// The timed spinning bit
		spin = function () {
			if (!spin.current_index)
			{
				spin.current_index = 0;
			}

			if (++spin.current_index > spinboards.length - 1)
			{
				spin.current_index = 0;
			}

			spin_to_board (spin.current_index);
		};

		// Draw a board based on index
		spin_to_board = function (board_index, pause_for) {
			spinboards.each (function (element, index) {
				// Show
				if (index == board_index)
				{
					spin.current_index = index;
					element.fade (1);
					spinboard_tabs[index].addClass ('current');
					spinboard_arrow.setStyle ('left', (average_tab_width / 2) + spinboard_tabs[index].getElement ('a').offsetLeft - 8);
				}

				// Hide
				else
				{
					element.fade (0);
					spinboard_tabs[index].removeClass ('current');
				}
			});

			if (pause_for)
			{
				pause_spinner (pause_for);
			}
		};

		spin_to_board (0);

		// Pause the spinner for a number of milliseconds
		pause_delay = false;
		pause_spinner = function (how_long, lock) {
			spinner_interval = $clear (spinner_interval);
			_ = (function () {
				pause_delay = false;
				start_spinner ();
			});

			if (lock)
			{
				pause_delay = _.delay (how_long);
			}
			else
			{
				_.delay (how_long);
			}
		}

		spinner_interval = false;
		start_spinner = function () {
			 return false;
			// Don't start the spinner if it is paused
			if (!pause_delay)
			{
				spinner_interval = $clear (spinner_interval);
				spinner_interval = spin.periodical (spin_interval);
			}
		};
		start_spinner ();


		// Periodically check the URL for #spin_to_X requests
		check_for_spin_request = function () {
			requested_board = window.location.toString ().match (/\#spin_to_([0-9])$/);
			if (requested_board && requested_board[1] <= spinboards.length)
			{
				spin_to_board (requested_board[1] - 1, pause_length);
				window.location = '#';
			}
		};
		check_for_spin_request.periodical (500);
	});