$(document).ready(function() {
	$('.homesearch_btn').click(function() {
		$('.homecol1 form').submit();
		return false;
	});

	$('.explore_click').click(function() {
		$('.track_sshow').fadeOut('slow');
		$('.explore_sshow').fadeIn('fast');

		$('.explore_sshow').find('.slides li:first').before(
			$('.explore_sshow').find('.slides li:last')
		);

		$('.explore_sshow').find('.slides ul').css({'left':
			$('.explore_sshow').find('.slides li').outerWidth() * (-1)
		});

		return false;
	});

	$('.explore_close').click(function() {
		$('.explore_sshow').fadeOut('slow');
		$('.track_sshow').fadeOut('slow');
		return false;
	});

	$('.track_click').click(function() {
		$('.explore_sshow').fadeOut('slow');
		$('.track_sshow').fadeIn('fast');

		$('.track_sshow').find('.slides li:first').before(
			$('.track_sshow').find('.slides li:last')
		);

		$('.track_sshow').find('.slides ul').css({'left':
			$('.track_sshow').find('.slides li').outerWidth() * (-1)
		});

		return false;
	});

	$('.track_close').click(function() {
		$('.track_sshow').fadeOut('slow');
		$('.explore_sshow').fadeOut('slow');
		return false;
	});

	$('.carousel .buttons .prev').click(function() {
		var carousel = $(this).parent().parent();
		var slides = carousel.find('.slides ul');
		var left_indent = parseInt(slides.css('left')) + slides.find('li').outerWidth();

		slides.animate({'left': left_indent}, 1000, 'easeOutCirc', function() {
			slides.find('li:first').before(slides.find('li:last'));
			slides.css({'left': slides.find('li').outerWidth() * (-1)});
		});

		return false;
	});
	
	$('.carousel .buttons .next').click(function() {
		var carousel = $(this).parent().parent();
		var slides = carousel.find('.slides ul');
		var left_indent = parseInt(slides.css('left')) - slides.find('li').outerWidth();

		slides.animate({'left': left_indent}, 1000, 'easeOutCirc', function() {
			slides.find('li:last').after(slides.find('li:first'));
			slides.css({'left': slides.find('li').outerWidth() * (-1)});
		});

		return false;
	});

	$('.whatintro_click').click(function() {
		$('UL.whatintro LI:last').css('border', 'none');
		$('body').animate({scrollTop: $('.whatintro_click').offset().top - 10}, 1000);
		$('.whatintro_cont').animate({height: 'toggle'}, 1000, 'easeOutBounce', function() {});

		return false;
	});

	$('.whatintro_close').click(function() {
		$('.whatintro_cont').animate({height: 'toggle'}, 1500, 'easeOutBounce', function() {});
		return false;
	});
});