/*!
 * Start Bootstrap - Freelancer Bootstrap Theme (http://startbootstrap.com)
 * Code licensed under the Apache License v2.0.
 * For details, see http://www.apache.org/licenses/LICENSE-2.0.
 */

// jQuery for page scrolling feature - requires jQuery Easing plugin
$(function() {
    $('body').on('click', '.page-scroll a', function(event) {
        var $anchor = $(this);
        $('html, body').stop().animate({
            scrollTop: $($anchor.attr('href')).offset().top
        }, 1500, 'easeInOutExpo');
        event.preventDefault();
    });
});

// Floating label headings for the contact form
$(function() {
    $("body").on("input propertychange", ".floating-label-form-group", function(e) {
        $(this).toggleClass("floating-label-form-group-with-value", !! $(e.target).val());
    }).on("focus", ".floating-label-form-group", function() {
        $(this).addClass("floating-label-form-group-with-focus");
    }).on("blur", ".floating-label-form-group", function() {
        $(this).removeClass("floating-label-form-group-with-focus");
    });
});

// Highlight the top nav as scrolling occurs
$('body').scrollspy({
    target: '.navbar-fixed-top'
})

// Closes the Responsive Menu on Menu Item Click
$('.navbar-collapse ul li a').click(function() {
    $('.navbar-toggle:visible').click();
});

// girl code - fancy effects when scrolling past things

var wasScrolledBelow = false;

function isScrolledBelow($el) {
    var topofDiv = $el.offset().top + $el.outerHeight();
    return $(window).scrollTop() + $(window).height() > topofDiv;
}


//hack to make spinners wobble when scrolled on screen
var spinnersScrolledBelow = false;
var spinnersTrigger = $($(".mg-spin").get(0));

var animTrigger = $(".animatedList");
var animItems = $(".animatedList li");
var animTimeouts = [];
animItems.addClass("off-left");
animItems.addClass("slide-in");

$(window).scroll(function(){
    var isBelow = isScrolledBelow(animTrigger);
    if (isBelow && !wasScrolledBelow) {
        console.log("show");
        wasScrolledBelow = true;
        animItems.each(function (i) {
            var that = this;
            animTimeouts.push(setTimeout(function () {
                $(that).removeClass("off-left");
            }, 200 * i));
        });
    } else if (!isBelow && wasScrolledBelow) {
        //reset
        console.log("hide");
        animTimeouts.forEach(function (id) {
            clearTimeout(id);
        });
        animTimeouts = [];
        wasScrolledBelow = false;
        animItems.addClass("off-left");
    }

    var isBelow2 = isScrolledBelow(spinnersTrigger);
    if (isBelow2 && !spinnersScrolledBelow) {
        console.log("bump");
        spinnersScrolledBelow = true;
        bumpSpinners();
    } else if (!isBelow2 && spinnersScrolledBelow) {
        spinnersScrolledBelow = false;
    }
});



@@ -1855,16 +1855,48 @@
 -in%22);%0A%0A
+if (animTrigger.length %3E 0) %7B%0A  
 $(window
@@ -1916,16 +1916,18 @@
 tion()%7B%0A
+  
     var 
@@ -1962,32 +1962,34 @@
 imTrigger);%0A    
+ 
+ 
 if (isBelow && !
@@ -2000,32 +2000,34 @@
 crolledBelow) %7B%0A
+  
         console.
@@ -2039,32 +2039,34 @@
 show%22);%0A        
+  
 wasScrolledBelow
@@ -2074,32 +2074,34 @@
 = true;%0A        
+ 
+ 
 animItems.each(f
@@ -2122,24 +2122,26 @@
             
+  
 var that = t
@@ -2145,16 +2145,18 @@
 = this;%0A
+  
         
@@ -2214,24 +2214,26 @@
             
+  
 $(that).remo
@@ -2265,16 +2265,18 @@
         
+  
 %7D, 200 *
@@ -2277,24 +2277,26 @@
  200 * i));%0A
+  
         %7D);%0A
@@ -2295,24 +2295,26 @@
     %7D);%0A    
+  
 %7D else if (!
@@ -2356,16 +2356,18 @@
     
+  
 //reset%0A
     
@@ -2362,16 +2362,18 @@
 //reset%0A
+  
         
@@ -2393,32 +2393,34 @@
 hide%22);%0A        
+  
 animTimeouts.for
@@ -2452,16 +2452,18 @@
         
+  
 clearTim
@@ -2472,16 +2472,18 @@
 ut(id);%0A
+  
         
@@ -2486,32 +2486,34 @@
     %7D);%0A        
+  
 animTimeouts = %5B
@@ -2515,16 +2515,18 @@
 s = %5B%5D;%0A
+  
         
@@ -2551,32 +2551,34 @@
  false;%0A        
+ 
+ 
 animItems.addCla
@@ -2597,19 +2597,23 @@
 %22);%0A    
+  
 %7D%0A%0A
+  
     var 
@@ -2657,24 +2657,26 @@
 igger);%0A    
+ 
+ 
 if (isBelow2
@@ -2697,32 +2697,34 @@
 crolledBelow) %7B%0A
+  
         console.
@@ -2736,32 +2736,34 @@
 bump%22);%0A        
+  
 spinnersScrolled
@@ -2784,16 +2784,18 @@
         
+ 
+ 
 bumpSpin
@@ -2798,24 +2798,26 @@
 Spinners();%0A
+  
     %7D else i
@@ -2857,32 +2857,34 @@
 elow) %7B%0A        
+  
 spinnersScrolled
@@ -2906,12 +2906,16 @@
     
+ 
+ 
 %7D%0A
+  
 %7D);%0A
-%0A
+%7D
 %0A

fix js errors on tutorial pages