(function($) {
  'use strict';
  $(function() {
    var body = $('body');
    var footer = $('.footer');

    var current = location.pathname.split("/").slice(-1)[0].replace(/^\/|\/$/g, '');
    $('.navbar.horizontal-layout .nav-bottom .page-navigation .nav-item').each(function() {
      var $this = $(this);
      if (current === "") {
        //for root url
        if ($this.find(".nav-link").attr('href').indexOf("index.html") !== -1) {
          $(this).find(".nav-link").parents('.nav-item').last().addClass('active');
          $(this).addClass("active");
        }
      } else {
        //for other url
        if ($this.find(".nav-link").attr('href').indexOf(current) !== -1) {
          $(this).find(".nav-link").parents('.nav-item').last().addClass('active');
          $(this).addClass("active");
        }
      }
    })

    $(".navbar.horizontal-layout .navbar-menu-wrapper .navbar-toggler").on("click", function() {
      $(".navbar.horizontal-layout .nav-bottom").toggleClass("header-toggled");
    });

    // Navigation in mobile menu on click
    var navItemClicked = $('.page-navigation >.nav-item');
    navItemClicked.on("click", function(event) {
      if(window.matchMedia('(max-width: 991px)').matches) {
        if(!($(this).hasClass('show-submenu'))) {
          navItemClicked.removeClass('show-submenu');
        }
        $(this).toggleClass('show-submenu');
      }
    })

    // Navigation on scroll
    $(function () {
        $(document).scroll(function () {
          var $nav = $(".navbar-fixed-top");
          $nav.toggleClass('scrolled', $(this).scrollTop() > $nav.height());
        });
      });

    //checkbox and radios
    $(".form-check .form-check-label,.form-radio .form-check-label").not(".todo-form-check .form-check-label").append('<i class="input-helper"></i>');

    $(window).scroll(function() {
      'use strict';
      if(window.matchMedia('(min-width: 992px)').matches) {
        var header = '.navbar.horizontal-layout';
      if ($(window).scrollTop() >= (70 + $('.navbar.horizontal-layout').height())) {
          $(header).addClass('fixed-on-scroll');
        } else {
          $(header).removeClass('fixed-on-scroll');
        }
      }
    });
  });
})(jQuery);



// ---deposit-page--table--template-rex-template--////

$("input[name=h_id]").on("change", function(){
  'use strict';
var dataID = $(this).data("id");
$(".tab-content > .card-block").hide();
$(".tab-content > #"+ dataID).show();
})
$("#plan-1").trigger('click');

$("input[name=deposit_system]").on("change", function(){
var dataID = $(this).data("id");
$(".tab-content > .card-block-deposit").hide();
$(".tab-content > #"+ dataID).show();
})
$("#external").trigger('click');
$("#1").trigger('click');

//---deposit-page--table--template-rex-template---end////



//---menu_dashboard_selector_in_accoriding_to_active_page___//////////
$('.nav-bottom .container ul li a').each(function () {
      var location = window.location.href;
      var link = this.href;
      if(location == link) {
          $(this).addClass('module__dash-menu__link_active');
      }
  });
//---menu_dashboard_selector_in_accoriding_to_active_page___end//////////


// svg4everybody();

$(function() {
  'use strict';
    FastClick.attach(document.body);
});

// Modules


// module__account-notification
(function() {
  'use strict';

    var close = $('.jsClose'),
        visible = $('.jsVisible');

    close.click(function(event) {
        $(this).closest(visible).removeClass('jsVisible');
    });

})();


// module__loading

(function() {
  'use strict';

    $('.count').each(function () {
        $(this).prop('Counter',0).animate({
            Counter: $(this).text()
        }, {
            duration: 10000,
            easing: 'swing',
            step: function (now) {
                $(this).text(Math.ceil(now));
            }
        });
    });

    setTimeout(function() {
        $('.count-2').each(function () {
            $(this).prop('Counter',0).animate({
                Counter: $(this).text()
            }, {
                duration: 5000,
                easing: 'swing',
                step: function (now) {
                    $(this).text(Math.ceil(now));
                }
            });
        });
    }, 1500);

    setTimeout(function() {
        $('.count-3').each(function () {
            $(this).prop('Counter',0).animate({
                Counter: $(this).text()
            }, {
                duration: 2500,
                easing: 'swing',
                step: function (now) {
                    $(this).text(Math.ceil(now));
                }
            });
        });
    }, 2500);

    setTimeout(function() {
        $('.dis').fadeIn(1)
    }, 1500);

    setTimeout(function() {
        $('.vis').fadeOut(1)
    }, 1500);

        setTimeout(function() {
        $('.dis-2').fadeIn(1)
    }, 2500);

})();



///////end___dash_board/////


// module__loading

(function() {

    $('.count').each(function () {
        $(this).prop('Counter', 0).animate({
            Counter: $(this).text()
        }, {
            duration: 10000,
            easing: 'swing',
            step: function (now) {
                $(this).text(Math.ceil(now));
            }
        });
    });

    setTimeout(function() {
        $('.count-2').each(function () {
            $(this).prop('Counter', 0).animate({
                Counter: $(this).text()
            }, {
                duration: 5000,
                easing: 'swing',
                step: function (now) {
                    $(this).text(Math.ceil(now));
                }
            });
        });
    }, 1500);

    setTimeout(function() {
        $('.count-3').each(function () {
            $(this).prop('Counter', 0).animate({
                Counter: $(this).text()
            }, {
                duration: 2500,
                easing: 'swing',
                step: function (now) {
                    $(this).text(Math.ceil(now));
                }
            });
        });
    }, 2500);

    setTimeout(function() {
        $('.dis').fadeIn(1)
    }, 1500);

    setTimeout(function() {
        $('.vis').fadeOut(1)
    }, 1500);

        setTimeout(function() {
        $('.dis-2').fadeIn(1)
    }, 2500);

})();



///////get//data/ for loading Module /////

$(document).ready(function(){
$.ajax({
      url: '/?a=account',
      dataType: 'html',
      success: function(data){
          $('#acc_ip_access').text($(data).find('#acc_ip_access_add').text());
          $('#acc_last_ip_access').text($(data).find('#acc_last_ip_access_add').text());
          $('#acc_check_ip').text($(data).find('#acc_check_ip_add').text());
          $('#acc_last_access_date').text($(data).find('#acc_last_access_date_add').text());

      }
    })
    setTimeout(function() {
      $("#acc_check_ip:contains(Passed)").css("color", "#79be1f");
      $("#acc_check_ip:contains(detected)").css("color", "#ffcb01");
},800);

});

///////end /////


// end__module__loading

