/*全局自适应高度*/
function autoFlashHeight(){
    var headerHeight = $(".header").height();
    var topContentHeight = $('#rationSearchResult').is(':visible') ? 0 : $('.top-content').height();
    var toolsBar = $(".toolsbar").height();
    var toolsBarHeightQ = $(".tools-bar-height-q").height();
    $(".content").height($(window).height()-headerHeight);
    $(".main-side-top").height(($(window).height()-headerHeight) * 0.85);
    $(".main-side-bottom").height(($(window).height()-headerHeight) * 0.15);
    $('.main-side-bottom').find('textarea').height($('.main-side-bottom').height() - 20);
    $('.main-side-bottom').find('textarea').width($('.main-side-bottom').width() - 25);
    $(".fluid-content").height($(window).height()-headerHeight-1);
    $(".side-content").height($(window).height()-headerHeight);
    $(".poj-list").height($(window).height()-headerHeight);
    $(".form-list").height($(window).height()-headerHeight-50);
    $('.main-top-content').height(($(window).height()-headerHeight-toolsBar)*0.85);
    $('.main-bottom-content').height(($(window).height()-headerHeight-toolsBar)*0.15);
    $('.main-bottom-content').find('textarea').height($('.main-bottom-content').height() - 20);
    $('.main-bottom-content').find('textarea').width($('.main-bottom-content').width() - 25);
    $(".main-data").height($('.main-top-content').height());
    $(".main-data-full").height($(window).height()-headerHeight);
    $(".main-data-bottom").height($(window).height()-headerHeight-toolsBarHeightQ-topContentHeight-$('#rationSearchResult').height() + 30);
    $('.bottom-content').height($('.main-data-bottom').height());
    if (typeof billsGuidance !== 'undefined') {
        billsGuidance.initSlideSize();
    }
};
$(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")// 关闭处理
        }

    });
/*侧滑*/
/*工具提示*/
$('*[data-toggle=tooltip]').mouseover(function() {
 $(this).tooltip('show');
  });
/*工具提示*/
});

function setLocalCache(key, value) {
    const storage = window.localStorage;
    if (!storage || key === '' || value === '') {
        return;
    }

    storage.setItem(key, value);
}

function getLocalCache(key) {
    const storage = window.localStorage;
    if (!storage || key === '') {
        return null;
    }

    return storage.getItem(key);
}

function removeLocalCache(key) {
    const storage = window.localStorage;
    if (!storage || key === '') {
        return null;
    }
    return storage.removeItem(key);
}

function replaceAll(FindText, RepText,str) {
    let regExp = new RegExp(FindText, "g");
    return str.replace(regExp, RepText);
};
