$(document).ready(function()
{
	// Add table stripes
	$('table.stripe tbody tr:nth-child(odd)').addClass('alt');

	// Lightboxed images
	$('a[rel^="lightbox"]').lightbox();

	// YouTube videos
	$('.videolist').each(function()
	{
		var viewer = $(this).find('.player');
		var links  = $(this).find('a[href*="youtube.com"]');

		links.each(function()
		{
			var self = $(this);
			self.click(function()
			{
				// Make this active
				links.removeClass('active');
				self.addClass('active');

				self.flash(
					{ height: 370, width: 450 },
					{ version: 8 },
					function(options)
					{
						options.allowfullscreen = true;
						options.src = self.attr('href') +'&rel=0&showsearch=0&border=0&fs=1&autoplay=1';
						viewer.html($.fn.flash.transform(options));
					}
				);

				return false;
			});
		});
	});

	if ($('#admin textarea.editor').length)
	{
		// Changed editor textareas into markItUp with Markdown settings
		$('#admin textarea.editor').markItUp(mySettings);
	}

	// Require confirmation
	$('a.confirm').click(function()
	{
		return confirm('This action cannot be undone, continue?');
	});
});
