$(document).ready(function()
{
	/**
	 * Suckerfish dropdown-style,
	 * shows or hides nested <ul>s, depends on CSS rules:
	 * @nav li ul {
	 *   display: none;
	 * }
	 * #nav li.over ul {
	 *   display: block;
	 * }
	 */
	$('#nav > li')
		.mouseover(function()
		{
			$(this).addClass('over');
		})
		.mouseout(function()
		{
			$(this).removeClass('over');
		});

	/**
	 * cycle():
	 * - Only first image is loaded to speed up rendering
	 * - Uses 'before' callback to load next image while current item plays
	 * - Depends on custom 'img-src' attribute (container element)
	 */		
	$('#lead-in').cycle({
		fx: 'fade',
		speed: 3500,
		timeout: 7000,
		before: function(element)
		{
			var $next = $(element).next();
			if (!$next)
				return;
	
			$('img', $next).attr('src', $next.attr('img-src'));
		}
	});

	/**
	 * SEO: show showroom call to action only if client is JavaScript-enabled.
	 * Call to action is nearly the same for all pages, hurts indexed text.
	 */
	$('#call-to-action').fadeIn('fast');
});