var path = window.location.pathname.split('/');
path = path[path.length-1];

if (path !== undefined) {
    $(".page_item")
        .find("a[href='" + path + "']") // gets all links that match the href
        .parents('li')  // gets all list items that are ancestors of the link
        .children('a')  // walks down one level from all selected li's
        .addClass('sf-breadcrumb');
}

(function (c) {
    var a = c.scrollTo = function (d, f, g) {
            c(window).scrollTo(d, f, g)
        };
    a.defaults = {
        axis: "xy",
        duration: parseFloat(c.fn.jquery) >= 1.3 ? 0 : 1
    };

    c.fn._scrollable = function () {
        return this.map(function () {
            var d = this,
                f = !d.nodeName || c.inArray(d.nodeName.toLowerCase(), ["iframe", "#document", "html", "body"]) != -1;

            var g = (d.contentWindow || d).document || d.ownerDocument || d;
            return c.browser.safari || g.compatMode == "BackCompat" ? g.body : g.documentElement
        })
    };
    c.fn.scrollTo = function (f, e, d) {
        if (typeof e == "object") {
            d = e;
        }

        e = e || d.speed || d.duration;
        d.offset = b(d.offset);
        d.over = b(d.over);
        return this._scrollable().each(function () {
            var n = this,
                l = c(n),
                m = f,
                j, k = {},
                h = l.is("html,body");
            switch (typeof m) {

            case "object":
                    j = (m = c(m)).offset()
            }
            c.each(d.axis.split(""), function (q, r) {
                var t = r == "x" ? "Left" : "Top",
                    s = t.toLowerCase(),
                    v = "scroll" + t;
                if (j) {
                    k[v] = j[s] + (h ? 0 : p - l.offset()[s]);
                    k[v] += d.offset[s] || 0;
                } else {
                }
            });
            i(d.onAfter);

            function i(g) {
                l.animate(k, e, d.easing, g &&
                function () {
                    g.call(this, f, d)
                })
            }
        }).end()
    };
    a.max = function (g, j) {
        var n = j == "x" ? "Width" : "Height",
            k = "scroll" + n;
        if (!c(g).is("html,body")) {
            return g[k] - c(g)[n.toLowerCase()]()
        }
        var o = "client" + n,
            f = g.ownerDocument.documentElement,
            d = g.ownerDocument.body;
        return Math.max(f[k], d[k]) - Math.min(f[o], d[o])
    };

    function b(d) {
        return typeof d == "object" ? d : {
            top: d,
            left: d
        }
    }
})(jQuery);
(function (d) {
    var a = location.href.replace(/#.*/, "");
    var c = d.localScroll = function (e) {
            d("body").localScroll(e)
        };
    c.defaults = {
        duration: 1000,
        axis: "y",
        event: "click",
        stop: true,
        target: window,
        reset: true
    };
    c.hash = function (f) {
        if (location.hash) {
            f = d.extend({}, c.defaults, f);
            f.hash = false;
            if (f.reset) {
                var g = f.duration;
                delete f.duration;
                d(f.target).scrollTo(0, f);
                f.duration = g
            }
            b(0, location, f)
        }
    };
    d.fn.localScroll = function (e) {
        e = d.extend({}, c.defaults, e);
        return e.lazy ? this.bind(e.event, function (g) {
            var h = d([g.target, g.target.parentNode]).filter(f)[0];
            if (h) {
                b(g, h, e)
            }
        }) : this.find("a,area").filter(f).bind(e.event, function (g) {
            b(g, this, e)
        }).end().end();

        function f() {
            return !!this.href && !! this.hash && this.href.replace(this.hash, "") == a && (!e.filter || d(this).is(e.filter))
        }
    };

    function b(i, p, g) {
        var q = p.hash.slice(1),
            o = document.getElementById(q) || document.getElementsByName(q)[0];
        if (!o) {
            return
        }
        if (i) {
            i.preventDefault()
        }
        var n = d(g.target);
        if (g.lock && n.is(":animated") || g.onBefore && g.onBefore.call(g, i, o, n) === false) {
            return
        }
        n.scrollTo(o, g).trigger("notify.serialScroll", [o])
    }
})(jQuery);
jQuery(function (a) {
    a.localScroll.defaults.axis = "y";
    a.localScroll.hash({
        queue: true,
        duration: 1000
    });
    a("nav").localScroll({
        queue: true,
        duration: 1000,
        offset: -168,
        hash: false,
        onBefore: function (d, c, b) {},
        onAfter: function (b, c) {}
    });
});
(function (B) {
        a = function () {
            if (!T.is(":visible")) {
                clearInterval(p);
                return
            }
            B("div", T).css("top", (N * -40) + "px");
            N = (N + 1) % 12
        };
})(jQuery);
(function (d) {
}(jQuery));
(function (b) {

})(jQuery);

$(document).ready(function () {
	$("header h1, nav").delay(600).animate({
        opacity: "show",
        top: "0"
    }, 600);
    $(window).scroll(function () {
		/* FEATURED */
        if ($(this).scrollTop() <= 830 ) {
            $("#n-featured").addClass("current");
            $("#n-about,#n-clients,#n-contact").removeClass("current");
        } else {
			$("#n-featured").removeClass("current");
		};
		/* ABOUT */
		if ($(this).scrollTop() >= 830 && $(this).scrollTop() < 1140) {
            $("#n-about").addClass("current");
            $("#n-featured,#n-clients,#n-contact").removeClass("current");
            $(".about").animate({
                opacity: "show"
            }, 400)
        } else {
			$("#n-about").removeClass("current");
			$(".about").animate({
				opacity: "hide"
			}, 1000)
		};
		/* CLIENTS */
		if ($(this).scrollTop() >= 1140 && $(this).scrollTop() < 1830) {
            $("#n-clients").addClass("current");
            $("#n-featured,#n-about,#n-contact").removeClass("current");
            $(".clients").animate({
                opacity: "show"
            }, 400)
        } else {
			$("#n-clients").removeClass("current");
			$(".clients").animate({
				opacity: "hide"
			}, 1000)
		};
		/* CONTACT */
		if ($(this).scrollTop() >= 1830 && $(this).scrollTop() < 2550) {
            $("#n-contact").addClass("current");
            $("#n-featured,#n-about,#n-clients").removeClass("current");
            $(".contact").animate({
                opacity: "show"
            }, 400)
        } else {
			$("#n-contact").removeClass("current");
			$(".contact").animate({
				opacity: "hide"
			}, 1000)
		};
		
    });
})
