$(function(){

    /**
     * 双击表格弹出修改窗口
     */
    $('table > tbody > tr').click(function () {
        mobileClickTimes++;
        var this_index=$(this).index();
        if(this_index==tr_index){
            setTimeout(
                function () {
                    mobileClickTimes = 0;
                    tr_index=-1;
                },
                800
            );

            if (mobileClickTimes > 1) {
                dblclickF(this);
                mobileClickTimes = 0;
                tr_index=-1;
            }
        }else{
            tr_index=this_index;
        }
    });
    function dblclickF(obj){
        var id = $(obj).find(':checkbox:eq(0)').val();
        var data = {};
        data['noticeId'] = id;
        doDataPost(
            data,
            false,
            ctx+"/adm/news/query_notice_by_noticeid",
            function(htmlText){
                $("div.popup_window").remove();
                addForm(htmlText);
                openWin('notice-info-div');
            }
        );
    }

    /**
     * 实现分页条件查询
     */
    $('#msgListTableDiv div.my-pagination > div > a').click(function(){
        var data = {};
        var href = $(this).attr('href');
        var str = href.substring(1,href.Length);
        data.page=parseInt(str);
        getPageData(data,ctx+"/adm/news/query_notice_by_communityid");
    });
    $('#msgListTableDiv div.my-pagination .page-current').change(function(){
        var data = {};
        var page = $(this).val();
        data.page=parseInt(page);
        getPageData(data,ctx+"/adm/news/query_notice_by_communityid");
    });
    adjustTableCellWidth('msgListTableDiv');

});

/**
 * 刷新列表页面（附搜索条件）
 */
function refreshList(){
    var data = {};
    data.title = $("form.form-search :input[name=search]").val();
    data.fabu = $('form.form-search select[name$=fabu]').val();
    doDataPost(
        data,
        false,
        ctx+"/adm/news/query_notice_by_communityid",
        function(msg){

        addPage(msg);
    });
}