jQuery(document).ready(function($){
	
	$( '#follow' ).scrollFollow({
					offset: 60
					}
	);
	
	// SCROLL TO
	$('a[href*=#]').smoothScroll({
		excludeWithin: ['#learnTabs'],
		speed: 1000,
        afterScroll: function() {
        	if (this.hash == '#header') {
				location.hash = '';
			} else {
		  		location.hash = this.hash;
			}
		
        }
      });


	$("#submitform").submit(function(e){
		var $this = $(this);

		var $firstField = $this.find("input[name=first_name]");
		if (!$firstField.attr('value'))
			{
				alert('Please enter your First Name.');
				$firstField.focus();
				return false;
			}	
			
		var $lastField = $this.find("input[name=last_name]");
		if (!$lastField.attr('value'))
			{
				alert('Please enter your Last Name.');
				$lastField.focus();
				return false;
			}	
	
		var $emailField = $this.find("input[name=email]");
		if (!$emailField.attr('value'))
			{
				alert('Please enter your Email.');
				$emailField.focus();
				return false;
			}	
		

		 var params = $this.serialize();
		$.post("/cgi-bin/intern_contact.cgi", params + '&random=' + Math.random(),
		   	function(data){
			$this.find(".button").fadeOut('slow', function(){
				$this.find(".button").after(data);
				$("#response").fadeIn('slow');
			});
			
			setTimeout(function(){
					$("#response").fadeOut('slow',function(){
						$("#response").remove();
						$this.find(".button").fadeIn('slow');
							
					});
				}, 5000);
	
		});
		
		return false;
		
	});

	
});

