﻿String.prototype.endsWith = function(str) {
    return (this.match(str + "$") == str);
}

$(document).ready(function () {
    var currentPageHref = window.location.href.toLowerCase();
    if (currentPageHref.endsWith("/")) {
        return;
    } else {
        $("#onceLifeNavigation li a").each(function (i) {
            var $this = $(this);
            var navHref = $this.attr("href").toLowerCase();
            var currentPageHrefSplit = currentPageHref.split("/");
            var currentPathHref = currentPageHrefSplit[currentPageHrefSplit.length - 1];
            if (navHref == currentPathHref) {
                $this.parent("li").addClass("on");
            }
        });
    }
});