// ========== Open mobile Nav ========== //
$(document).ready(function() {
  $('.cms_open_navbutton').click(function(){

    $('.cms_sidebar').toggleClass("open_sidebar");
    $('.cms_content_area').toggleClass("content_open_sidebar");
    $('.cms_sidebar_trigger').toggleClass("trigger_active");
  });
  
});

$(document).ready(function() {
  $('.cms_sidebar_trigger').click(function(){

    $(this).toggleClass("trigger_active");
    $('.cms_sidebar').toggleClass("open_sidebar");
    $('.cms_content_area').toggleClass("content_open_sidebar");

  });
  
});



$(window).resize(function() {
  if ($(window).width() < 1100) {
    $('.cms_sidebar').removeClass("open_sidebar");
    $('.cms_content_area').removeClass("content_open_sidebar");
 }
});

// ========== Open Cell Setting on click ========== //
$(document).ready(function() {
  $('.cell_settings_click').click(function(){

  	$('.cell_settings_inner').removeClass("cell_settings_inner_open");
    $(this).parent().find('.cell_settings_inner').addClass("cell_settings_inner_open");

  });
  $('.cell_settings_close').click(function(){

    $('.cell_settings_inner').removeClass("cell_settings_inner_open");

  });
});

// ========== Open Profile Box ========== //
$(document).ready(function() {
  $('.user_profile_trigger').click(function(){
    if ($('.user_profile').hasClass('open_profile')) {
      $('.user_profile_content').slideUp();
      $('.user_profile').removeClass('open_profile');
    } else {
      $('.user_profile_content').slideDown();
      $('.user_profile').addClass('open_profile');
    }
    
  });
});

// ========== Toggle Fieldgroup ========== //
$(document).ready(function() {
  $('.cms_fieldgroup_trigger').click(function(){
    if ($(this).parent().parent().hasClass('fieldgroup_open')) {
      $(this).parent().parent().find('.cms_fieldgroup_content').slideUp();
      $(this).parent().parent().removeClass('fieldgroup_open');
    } else {
      $(this).parent().parent().find('.cms_fieldgroup_content').slideDown();
      $(this).parent().parent().addClass('fieldgroup_open');
    }
    
  });
});