$(document).ready(function () {
	/* Features popup
	 * I start by adding styles that should only be added
	 * if javascript is enabled
	 * TODO: put this in a stylesheet and activate a special class with javascript
	 */

	$.fn.wait = function(time, type) {
		time = time || 600;
		type = type || "fx";
		return this.queue(type, function() {
			var self = this;
			setTimeout(function() {
				$(self).dequeue();
			}, time);
		});
	};

	/* Navigation bar expand and collapse */
	$('.nav_menu ul').hide();
	$('.nav_menu .highlight').show().parent().show().show();
	$('.nav_menu li').hover(
		function() {
			$('ul', this).wait(400).slideDown({duration: 100});
		}
	,	function() {
			$('ul', this).stop(true, true).wait(5000).slideUp({duration: 100});
	});

	//lightbox photo previews
	$('a.lightbox').lightBox();

	//and alternating table rows
	$('tr:nth-child(even)').addClass('alt');
});
