$(document).ready(function () {
    $(".tabTitle").html("ERP Software")
    var domain = "https://erp.aurarichconsult.com";
    var UserType = sessionStorage.getItem('UserType');
    var ActivePage = sessionStorage.getItem("ActivePage");
    var nthChild = sessionStorage.getItem("nthChild");
    var SigninPage = sessionStorage.getItem("SigninPage");
    var url = window.location.origin;
    if (ActivePage == null) {
        sessionStorage.removeItem("SigninPage");
        $.get(domain + "/API-Others/verify-url/verify-url.php?url=" + encodeURIComponent(url), function(data) {
            if (data.code == 200) {
                $(".tabTitle").html("ERP | Booomers Bamboo Bikes")
                $(".body").load(domain + "/COMPONENTS/signin/index.php", function () {
                    $(".signin-signup-form").load(domain + "/COMPONENTS/signin/form.php?UniqueId=" + encodeURIComponent(data.uniqueid)+"", function () {
                        $(".preloader").fadeOut();
                    })
                });
            }else{
                $(".tabTitle").html("Ablɔɖe ERP");
                $(".body").load(domain + "/COMPONENTS/index/business-signin.php", function () {
                    $(".business-signin").load(domain + "/COMPONENTS/index/form.php", function () {
                        $(".preloader").fadeOut();
                    })
                });
            }
        });
        // if(url == "https://booomers.aurarichconsult.com"){
        //     $(".body").load(domain + "/COMPONENTS/signin/index.php", function () {
        //         $(".signin-signup-form").load(domain + "/COMPONENTS/signin/form.php", function () {
        //             $(".preloader").fadeOut();
        //         })
        //     });
        // }else{
        //     $(".body").load(domain + "/COMPONENTS/index/business-signin.php", function () {
        //         $(".business-signin").load(domain + "/COMPONENTS/index/form.php", function () {
        //             $(".preloader").fadeOut();
        //         })
        //     });
        // }
      
    } else {

        $(".body").load(UserType, function (data) {
            if (SigninPage == 1) {
                $(".preloader").fadeOut();
                $(".business-signin").load(ActivePage, function (data) { });
            } else if (SigninPage == 2) {
                $(".preloader").fadeOut();
                $(".business-create").load(ActivePage, function (data) { });
            } else if (SigninPage == 3) {
                $(".preloader").fadeOut();
                $(".signin-signup-form").load(ActivePage, function (data) { });
            } else {
                sessionStorage.removeItem("SigninPage");
                $(".preloader1").fadeOut();
                if (nthChild == null) {
                    $(".sidebar-link:eq(0)").addClass("active");
                } else {
                    $(".sidebar-link:eq(" + nthChild + ")").addClass("active");
                }
                $(".container-fluid").load(ActivePage, function (data) { });
            }
        })
    }


});