function LoadNav() {
    var url = location.pathname;
    
    if (document.getElementById("homeSub") == null) return;

    document.getElementById("homeSub").className = "";
    document.getElementById("invoicesSub").className = "";
    document.getElementById("customerSub").className = "";
    document.getElementById("paymentSub").className = "";
    document.getElementById("serviceSub").className = "";
    document.getElementById("reportsSub").className = "";
    if (url.toLowerCase().indexOf("service_tickets") != -1) {
        document.getElementById("servicequeue").className += " open";
        document.getElementById("serviceSub").className = "current";
        return;
    }

    if (url.toLowerCase().indexOf("payment_methods") != -1) {
        document.getElementById("paymentmethods").className += " open";
        document.getElementById("paymentSub").className = "current";
        return;
    }

    if (url.toLowerCase().indexOf("invoices") != -1) {
        document.getElementById("invoices").className += " open";
        document.getElementById("invoicesSub").className = "current";
        return;
    }

    if (url.indexOf("customers") != -1) {
        document.getElementById("selcustomer").className += " open";
        document.getElementById("customerSub").className = "current";
        return;
    }

    if (url.toLowerCase().indexOf("home") != -1) {
        SelectHomeTab();
        return;
    }

    if (url.toLowerCase().indexOf("reports") != -1) {
        document.getElementById("reports").className += " open";
        document.getElementById("reportsSub").className = "current";
        return;
    }

    SelectHomeTab();
}

function SelectHomeTab() {
    document.getElementById("home").className += " open";
    document.getElementById("homeSub").className = "current";
}