(function($) {
	
	$(document).ready(function () {
				
		$('.anythingSlider').anythingSlider({
		        easing: "easeOutBack",                // Anything other than "linear" or "swing" requires the easing plugin
		        autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not
		        startStopped: false,            // If autoPlay is on, this can force it to start stopped
		        delay: 3000,                    // How long between slide transitions in AutoPlay mode
		        animationTime: 600,             // How long the slide transition takes
		        hashTags: true,                 // Should links change the hashtag in the URL?
		        buildNavigation: false,         // If true, builds and list of anchor links to link to each slide
		        pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
		        startText: "Start",             // Start text
		        stopText: "Stop",               // Stop text
		        navigationFormatter: null       // Details at the top of the file on this use (advanced use)
		});
		
		$('.nav li a').smoothScroll({
			speed: 900
		});
				
		$('#anchor .general').hide();		
		$('.switcher li a').click(function(e){
		
			$button 		= $('#anchor');
			$button_span 	= $('#anchor').find('span');
			
			$gen_inq	 	= $('.gen_inq');
			$rfp			= $('.rfp');
	
			if (!$('#anchor:animated').length) { 
	
				if($(this).attr('href')=='#general'){
		
					$button.attr('href','#rfp');
		
					$button_span
					.animate({
						opacity : '0'
					}, 200, function(){
					
						$button
						.animate({
							width : $rfp.width()
						}, 20, function(){
						
							$button
							.animate({
								width : $gen_inq.width(),
								left : '47px'
							}, 300, function(){
							
								$button_span
								.text($gen_inq.text())
								.animate({
									opacity : '1'
								}, 200);
	
							})
	
						});
					});
					
					$('.attach').fadeOut('slow');
					
				} else if($(this).attr('href')=='#rfp'){
				
					$button.attr('href','#general');
	
					$button_span
					.animate({
						opacity : '0'
					}, 200, function(){
					
						$button
						.animate({
							width : $gen_inq.width()
						}, 20, function(){
						
							$button
							.animate({
								width : $rfp.width(),
								left : '0'
							}, 300, function(){
							
								$button_span
								.text($rfp.text())
								.animate({
									opacity : '1'
								}, 200);
	
							})
	
						});
					});
					
					$('.attach').fadeIn('slow');
				}
			}
			
		});
		
		$form_fields = $('.wpcf7-form input[type="text"],.wpcf7-form textarea');
		$form_labels = $('.wpcf7-form label.field_name');
		
		$form_fields.each(function(){
			
			if($(this).val().length>0){
				$label = $(this).parents('fieldset:eq(0)').find('label.field_name');
				$label.fadeOut(400);
			}
		});
		
		$form_labels.click(function(e){
						
			$(this).parents('fieldset:eq(0)').find('input,textarea').focus();
	
		});
		
		$form_fields.focus(function(e){
														
			$label = $(this).parents('fieldset:eq(0)').find('label.field_name');
			if($(this).val().length==0){
				$label.fadeTo(400,'0.2');
			}
			
		});
		
		$form_fields.blur(function(e){
													 
			$label = $(this).parents('fieldset:eq(0)').find('label');
			if($(this).val().length==0)
				$label.fadeTo(400,'1.0');
			
		});
		
		$form_fields.keyup(function(e){
			
			if($(this).val().length>0)
				$label.fadeOut(100);
			else
				$label.fadeIn(500);
		
		});
					
	});

})(jQuery);
