// When the page is ready
$(document)
		.ready(
				function() {

					/**
					 * set up any light boxes
					 */
					$("div.lightbox")
							.each(
									function(index) {

										var a = $(this).children("a");

										$(this)
												.addClass(
														'ui-widget-content ui-corner-all');

										a
												.eq(0)
												.prepend(
														"<span class='ui-icon ui-icon-newwin'/>");
										a.colorbox( {
											opacity : "0.2",
											rel : "group" + index
										});
									});

					$(".faq dl dd").hide();

					$(".faq dl dt")
							.each(
									function(index) {

										$(this).wrapInner(
												"<span class='faq-question'/>")
										$(this)
												.prepend(
														"<span class='ui-icon ui-icon-plus' style='margin-top:.2em; float:left;'/>")

										$(this).wrapInner("<a href='#'/>");
									});

					$(".faq dl dt a").click(function(event) {

						var span = $(this).children(".ui-icon");
						var dt = $(this).parents("dt");

						var dd = dt.next("dd");

						dd.slideToggle(200, function() {

							if (dd.is(":visible")) {

								span.attr('class', 'ui-icon ui-icon-minus');

							} else {

								span.attr('class', 'ui-icon ui-icon-plus');
							}
						});

						event.preventDefault();
					});

					$(".feature-more").hide();

					$(".feature-more")
							.before(
									function() {

										var text = this.title;

										if (text == '') {

											text = "More...";
										}

										return "<div class='feature-more-control ui-widget-content ui-corner-all'><a href='#'><span class='ui-icon ui-icon-plus'/><span>"
												+ text + "</span></a></div>"
									});

					$(".feature-more-control a").click(function(event) {

						var span1 = $(this).children("span").eq(0);
						var span2 = $(this).children("span").eq(1);

						var more = $(this).parent().next(".feature-more");

						more.slideToggle(200, function() {

							var feature = $(this).parents(".feature");

							if ($(this).is(":visible")) {

								feature.addClass("feature-expanded")
								span1.attr('class', 'ui-icon ui-icon-minus');
								span2.text("Less detail");

							} else {

								feature.removeClass("feature-expanded")
								span1.attr('class', 'ui-icon ui-icon-plus');
								span2.text($(this).attr("title"));
							}
						});

						/**
						 * Stop the link click from doing its normal thing
						 */
						event.preventDefault();
					});
				});

try {

	var pageTracker = _gat._getTracker("UA-12359194-1");
	pageTracker._trackPageview();

} catch (err) {
}

