/*全局自适应高度*/
function autoFlashHeight(){
    function getObjHeight(select) {
        return select.length > 0 ? select.height() : 0;
    }
    /*侧栏高度*/
    var sBar1 = getObjHeight($(".sjs-bar-1"));
    var sBar2 = getObjHeight($(".sjs-bar-2"));
    var sBar3 = getObjHeight($(".sjs-bar-3"));
    var sBar4 = getObjHeight($(".sjs-bar-4"));
    var sBar5 = getObjHeight($(".sjs-bar-5"));
    /*侧栏高度*/
    var cHeader = getObjHeight($(".c-header"));
    var sBar = getObjHeight($(".sjs-bar"));
    var sBart = getObjHeight($(".sjs-bart"));
    var sBarz = getObjHeight($(".side-bar"));
    var pBarz = getObjHeight($(".toolsbar-f"));
    var bdtopc = getObjHeight($(".body-height-top"));
    var bcontent = getObjHeight($(".bcontent-wrap"));
    $(".sjs-height-0").height($(window).height()-cHeader-90+53);
    $(".sjs-height-1").height($(window).height()-cHeader-bcontent-90+53);
    $(".sjs-height-2").height($(window).height()-cHeader-sBarz-120);
    $(".sjs-height-3").height($(window).height()-cHeader-sBar-492+25);/*492*/
    $(".sjs-height-4").height($(window).height()-cHeader-pBarz-110+75);
    $(".sjs-height-5").height($(window).height()-cHeader-sBar-492+55);/*492*/
    $(".sjs-height-6").height($(window).height()-cHeader-sBar-342+55);
    $(".sjs-height-7").height($(window).height()-cHeader-sBar-40);
    $(".sp-wrap").height(bcontent-30);
    /*侧栏高度*/
    $(".sjs-sh-1").height($(window).height()-cHeader-sBar1-92+55);
    $(".sjs-sh-2").height($(window).height()-cHeader-sBar2-92+55);
    $(".sjs-sh-3").height($(window).height()-cHeader-sBar3-92+55);
    $(".sjs-sh-4").height($(window).height()-cHeader-sBar4-92+55);
    $(".sjs-sh-5").height($(window).height()-cHeader-sBar5-92+55);
    /*标段设置高度*/
    $(".sjs-option-height").height($(window).height()-500);
    /*工程变更添加清单高度*/
    $(".sjs-biangeng-height").height($(window).height()/3.3);
};
$(window).resize(autoFlashHeight);
/*全局自适应高度结束*/
$(function(){
/*侧滑*/
$(".open-sidebar").click(function(){
    $(".slide-sidebar").animate({width:"800"}).addClass("open");
});
$("body").click(function(event){
        var e = event || window.event; //浏览器兼容性
        if(!$(event.target).is('a')) {
            var elem = event.target || e.srcElement;
            while (elem) { //循环判断至跟节点，防止点击的是div子元素
                if (elem.className == "open-sidebar" || elem.className == 'slide-sidebar open') {
                    return false;
                }
                elem = elem.parentNode;
            }
            $(".slide-sidebar").animate({width:"0"}).removeClass("open")// 关闭处理
        }

    });
/*侧滑*/
/*工具提示*/
$(function () {
  $('[data-toggle="tooltip"]').tooltip()
});
$(function () {
  $('[data-toggle="popover"]').popover()
});
/*侧栏菜单*/
$(".bg-nav > li > a").click(function() {
      var self = $(this);
      var subMenu = $(this).siblings('ul.sub-menu');
      if(subMenu.length > 0) {
          if(subMenu.is(":visible")) {
              self.find('.menu-arrow').removeClass('fa-angle-up').addClass('fa-angle-down');
              subMenu.slideUp('fast');
              self.parent().removeClass('active');
          }else{
              self.parent().addClass('active');
              self.find('.menu-arrow').removeClass('fa-angle-down').addClass('fa-angle-up');
              subMenu.slideDown('fast');
          }
      }
  });


});
