

 $(document).ready( function() {

	/* --- MAST SEARCH ----------------------------------------------------------------------------- */

	if ($('#search .field input[type=text]').val() != 'Search') {
		$('#search .field input[type=text]').css('color','black');
	}

	$('#search .field input[type=text]').focus( function() {
		if ($(this).val() == 'Search') {
			$(this).val('');
			$(this).css('color','black');
		}
	});

	$('#search .field input[type=text]').blur( function() {
		if ($(this).val() == '') {
			$(this).css('color','#cccccc');
			$(this).val('Search');
		}
	});

	/* --- HOME PAGE FEATURE ----------------------------------------------------------------------- */

	function homeFeature_initCallback(carousel)
	{
		// Disable autoscrolling if the user clicks the prev or next button.
		carousel.buttonNext.bind('click', function() {
			carousel.startAuto(0);
		});

		carousel.buttonPrev.bind('click', function() {
			carousel.startAuto(0);
		});

		// Pause autoscrolling if the user moves with the cursor over the clip.
		carousel.clip.hover(function() {
			carousel.stopAuto();
		}, function() {
			carousel.startAuto();
		});
	};

	jQuery(document).ready(function() {
		jQuery('#home-feature').jcarousel({
			/* auto: 10, */
			wrap: 'circular',
			scroll: 1,
			visible: 1,
			animation: "slow",
			initCallback: homeFeature_initCallback,
			buttonNextHTML: null,
			buttonPrvHTML: null
		});
	});

	/* --- SERVICES TABS --------------------------------------------------------------------------- */

	$('.service-tab').click( function() {
		$('.service-tab.active').removeClass('active');
		$('.service-pane:visible').removeClass('active');
		var newId = $(this).attr('id').replace('tab-','');
		$(this).addClass('active');
		$('#pane-' + newId).addClass('active');
	});

	/* --- PROCEDURE PULL-DOWN ON HOME PAGE -------------------------------------------------------- */

	$("#procedure-select").change( function() {
		var destination = $("#procedure-select option:selected").attr('value');
		window.location = '/radiation_oncology/' + destination;
	});

	/* --- FAQ ------------------------------------------------------------------------------------- */

	$("#faq-page .question").click ( function() {
		var current = $(this).next('.answer');
		current.slideToggle('normal', function() {
			$("#faq-page .answer:visible").not(current).slideUp('slow');
		});
	});

	/* --------------------------------------------------------------------------------------------- */
});
