// 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("w3-top_")
  } else {
    navbar.classList.remove("w3-top_");
  }
}

// Map Resize
$(function() {
	$('.map').maphilight({fade: false});
	});

	$('map').imageMapResize();
    
// 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');
            $('#checkTenable').attr('disabled', 'disabled');            
        } else {
            $('#ischeckenable').attr('disabled', 'disabled');
            $('#checkTenable').attr('disabled', 'disabled');            
        }
    });
});

// Phone Mask
function phoneMask() { 
    var num = $(this).val().replace(/\D/g,''); 
    $(this).val(num.substring(0,1) + '(' + num.substring(1,4) + ')' + num.substring(4,7) + '-' + num.substring(7,11)); 
}
$('[type="tel"]').keyup(phoneMask);

// Birthday set
function birthdaySET() { 
    var num = $(this).val().replace(/\D/g,''); 
    $(this).val(num.substring(0,4) + '-' + num.substring(4,6) + '-' + num.substring(6,8)); 
}
$('[type="dateb"]').keyup(birthdaySET);

// 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");
  }
});

//window.onload=function(){
//  document.getElementById("statusLoad").click();
//};

function notifyUserPhoto() {
  var x = document.getElementById("statusUpload");
  x.className = "show";
  setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000);
}