$(document).ready(function(){	
		
	$('.tabbed-nav-type a').click(function(){
		if ($(this).hasClass('active') == false){
			
			// transition the tab
			$('.tabbed-nav-type a').removeClass('active');
			$(this).addClass('active');
			
			// transition the content
			var location = $(this).attr("href");
			var locationArray = location.split('#');
			var currentPane = '#home-' + locationArray[1];
			var newSize = $(currentPane).height();
			
		}
	});		
	
	$('a[title="Phone"]').click(function(){
		$('#RegistrationType').val('1');
	});	
	$('a[title="Fax"]').click(function(){
		$('#RegistrationType').val('2');
	});	
	$('a[title="Walk-In"]').click(function(){
		$('#RegistrationType').val('3');
	});	

	
	
	$('.tabbed-nav1 a').click(function(){
		if ($(this).hasClass('active') == false){
			$('#home-tab-container > div.active').fadeOut(200);
			
			// transition the tab
			$('.tabbed-nav1 a').removeClass('active');
			$(this).addClass('active');
			
			// transition the content
			var location = $(this).attr("href");
			var locationArray = location.split('#');
			var currentPane = '#home-' + locationArray[1];
			var newSize = $(currentPane).height();
			$('#home-tab-container').animate({
	     		height: newSize
	    	}, { duration: 505}); //animate container to correct size.
			$(currentPane).fadeIn(500);
			$(currentPane).addClass('active');;
			
		}
	});
		
	$('.tabbed-nav2 a').click(function(){
		if ($(this).hasClass('active') == false){
			$('#home-tab-container > div.active').fadeOut(200);
			
			// transition the tab
			$('.tabbed-nav2 a').removeClass('active');
			$(this).addClass('active');
			
			// transition the content
			var location = $(this).attr("href");
			var locationArray = location.split('#');
			var currentPane = '#home-' + locationArray[1];
			var newSize = $(currentPane).height();
			$('#home-tab-container').animate({
	     		height: newSize
	    	}, { duration: 505}); //animate container to correct size.
			$(currentPane).fadeIn(500);
			$(currentPane).addClass('active');
		}
	});
	
	$('a[title="HalfMarathon"]').click(function(){
		$('#RegistrationRace').val('0');
	});	
	$('a[title="5K"]').click(function(){
		$('#RegistrationRace').val('1');
	});	

	
	$('a[title="Same as Runner"]').click(function(){
		$('#BillingFirstName').slideDown();
		$('#BillingLastName').slideDown();
		$('#BillingBillingFirstName').val( $('#RegistrationFirstName').val() );
		$('#BillingBillingLastName').val( $('#RegistrationLastName').val() );
		$('#typename').slideUp();
	});	
	$('a[title="Somebody Else"]').click(function(){
		$('#BillingFirstName').slideDown();
		$('#BillingLastName').slideDown();
		$('#BillingBillingFirstName').val( '' );
		$('#BillingBillingLastName').val( '' );
		$('#typename').slideDown();
	});	

		
	$('a').hover(function(){
		//$(this).hide();
	});	
	
	$('.form-section').hover(function(){
		$('.form-section').removeClass('form-section-over');
		$(this).addClass('form-section-over');
	});	
		
});//end document.ready();