// if (jQuery) jQuery.noConflict();
$(document).ready(function() {
	if ($('a.lightbox')[0]) {
		$('a.lightbox').lightBox();
	}
	/*
	* Convert the locations page sections into select options.
	*/
	if ($('#body-4')[0]) {
		/**
		* Location services content.
		*/
		var first = false;
		$('#locations h3').each(function() {
			if (!first) first = $(this);
			$(this).hide();
			var list = $(this).next('div.location-content');
			list.hide();
		});
		
		first.before('<div id="dp-cs-select-container"><select id="dp-cs-select"></select></div>');
		
		var i = 0;
		var contents = { };
		$('#locations h3').each(function() {
			i++;
			$("#dp-cs-select").append('<option value="' + i + '" id="option-' + i + '">' + $(this).html() + '</option>');
			contents[i] = $(this).next('div.location-content');
		});
		
		var showing = false;
		$("#dp-cs-select").change(function() {
			var next = contents[$(this).val()];
			if (showing) {
				showing.fadeOut('normal', function() { next.fadeIn('normal'); });
			} else {
				next.fadeIn('normal');
			}
			showing = next;
		});
		$("#dp-cs-select").val(1).trigger('change');
	}
});
