
	window.addEvent ('load', function () {
		/* Airplane
		--------------------------------------------------------*/
		// Animate the plane's entry
		var plane = new Element ('div', {
			'id': 'plane'
		});
		plane.inject ($('container_fixed'), 'top');

		if (window.location.toString ().match (/\.ca\/?(home\/?)?$/i))
		{
			plane.set ('morph', {
				'duration': 4000,
				'transition': 'quad:in:out'
			});
			plane.morph ({
				left: 230,
				top: 20,
				opacity: [0,1]
			});
		}
		else
		{
			plane.setStyles ({
				left: 230,
				top: 20
			});
		}

		/* Prompts
		--------------------------------------------------------*/
		show_prompts = function () {
			// Get size of prompts
			var prompts_size = $('prompts').getSize ();

			// Vertically center prompts
			final_location = Math.round ((window.getHeight () / 2) - (prompts_size.y / 2));

			$('prompts').set ('tween', {
				duration: 1000,
				transition: 'elastic:out'
			});

			$('prompts').tween ('top', final_location + window.getScrollTop ().toInt ());
		}

		hide_prompts = function () {
			$('prompts').set ('tween', {
				duration: 400,
				transition: 'linear'
			});
			$('prompts').tween ('top', -400);
		}

		if ($('prompts'))
		{
			$('prompts').addEvent ('click', hide_prompts);
			$('prompt_closer').onclick = function () { return false; };
			(function () { show_prompts (); }).delay (250);
		}
	});

	window.addEvent ('domready', function () {
		if (!document.body.hasClass ('admin'))
		{
			/* Accordions
			--------------------------------------------------------*/
			$$('.accordion').each (function (element, index) {
				var _ = new Accordion (element.getElements ('.accordion_handle'), element.getElements ('.accordion_element'), {
					alwaysHide: true,
					onActive: function (handle, toggler) {
						handle.addClass ('open_handle');
					},
					onBackground: function (handle, toggler) {
						handle.removeClass ('open_handle');
					}
				});
			});
		}

		/* Page Navigation > Page Picker
		--------------------------------------------------------*/
		$$('.page_navigator select').each (function (element, index) {
			element.addEvent ('change', function () {
				this.getParent ('form').submit ();
			});
		});
	});