// Get the Sidebar
var mySidebar = document.getElementById("mySidebar");
var overlayBg = document.getElementById("myOverlay");
function w3_open() {
  if (mySidebar.style.display === 'block') {
    mySidebar.style.display = 'none';
    overlayBg.style.display = "none";
  } else {
    mySidebar.style.display = 'block';
    overlayBg.style.display = "block";
  }
}
function w3_close() {
  mySidebar.style.display = "none";
  overlayBg.style.display = "none";
}
function accesform() {
  var x = document.getElementById("accesform");
  if (x.className.indexOf("w3-show") == -1) {  
    x.className += " w3-show";
  } else { 
    x.className = x.className.replace(" w3-show", "");
  }
}
function subCategorii() {
  var x = document.getElementById("subCategorii");
  if (x.className.indexOf("w3-show") == -1) {  
    x.className += " w3-show";
  } else { 
    x.className = x.className.replace(" w3-show", "");
  }
}
window.onscroll = function() {myFunction()};
var navbar = document.getElementById("navbar");
var sticky = navbar.offsetTop;
function myFunction() {
  if (window.pageYOffset >= sticky) {
    navbar.classList.add("sticky")
  } else {
    navbar.classList.remove("sticky");
  }
}

// Validate checkbox
$(function() {
    $('#checkTenable').click(function() {
        if ($(this).is(':checked')) {
            $('#checkPenable').removeAttr('disabled');
        } else {
            $('#checkPenable').attr('disabled', 'disabled');
            $('#ischeckenable').attr('disabled', 'disabled');
        }
    });
    
    $('#checkPenable').click(function() {
        if ($(this).is(':checked')) {
            $('#ischeckenable').removeAttr('disabled');
        } else {
            $('#ischeckenable').attr('disabled', 'disabled');
        }
    });
});

// Toogle Password
$(".toggle-password").click(function() {

  $(this).toggleClass("fa-eye fa-eye-slash");
  var input = $($(this).attr("toggle"));
  if (input.attr("type") == "password") {
    input.attr("type", "text");
  } else {
    input.attr("type", "password");
  }
});