var numberreg = new RegExp(
    "^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$");

function doajax(method, dataurl, data, sucessCallBack, errorCallBack) {
    var user_key = undefined;
    var user = $.zui.store.get("user")
    if (typeof(user) == "undefined" || user == null) {

    } else {
        user_key = "XinTong " + (user.token);
    }
    if (typeof(user_key) == "undefined" || user_key == null) {
        $.ajax({
            type: method,
            url: dataurl,
            contentType: "application/json",
            dataType: "json",
            async: true,
            data: JSON.stringify(data),
            success: function(data) {
                sucessCallBack(data);
            },
            error: function(error) {
                if (HandleError(error)) return;
                errorCallBack(error);
            }
        })
    } else {

        $.ajax({
            type: method,
            url: dataurl,
            contentType: "application/json",
            dataType: "json",
            beforeSend: function(xhr) {
                xhr.setRequestHeader("token", user_key);
            },
            headers: {
                'token': user_key
            },
            async: true,
            data: JSON.stringify(data),
            success: sucessCallBack,
            error: function(error) {
                if (HandleError(error)) return;
                errorCallBack(error);
            }
        })
    }

}

function ajaxGet(dataurl, data, sucessCallBack, errorCallBack) {

    doajax("GET", dataurl, data, sucessCallBack, errorCallBack)
}

function ajaxPost(dataurl, data, sucessCallBack, errorCallBack) {

    doajax("POST", dataurl, data, sucessCallBack, errorCallBack)

}

function ajaxPut(dataurl, data, sucessCallBack, errorCallBack) {

    doajax("PUT", dataurl, data, sucessCallBack, errorCallBack)
}

function ajaxDelete(dataurl, data, sucessCallBack, errorCallBack) {

    doajax("DELETE", dataurl, data, sucessCallBack, errorCallBack)

}


function HandleError(error) {
    if (typeof(error) != "undefined" && error != null) {
        if (typeof(error.status) != "undefined" && error.status != null) {
            if (error.status == 403) {
                //未登录退出

                layer.msg('登陆已经过期，将重新登陆！', {
                    time: 2000, //20s后自动关闭
                }, function() {
                    self.location = base_ui_url + UI_USER_LOGIN + "?time=" + (Date.parse(new Date()));
                })


                return true;
            }
        }
    }
    return false;
}


function GetQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);

    if (r != null) {
        return unescape(r[2]);
    }
    return null;
}

function getItemByIdFromArr(id, curDatas) {
    var rowData;
    for (var i = 0; i < curDatas.length; i++) {
        if (id == curDatas[i].id) {
            rowData = curDatas[i];
            break;
        }
    }
    return rowData;
}

function showPopup4Common(title, callback, area, divId, offset, btnName) {
    if (!area) area = 'auto';
    if (!divId) divId = '#form-div';
    if (!offset) offset = 'auto';
    if (!btnName) btnName = '保存';
    //添加常量页面
    return layer.open({
        type: 1,
        area: area,
        title: title,
        closeBtn: 1,
        shadeClose: true,
        offset: offset,
        skin: 'layui-layer-lan',
        content: $(divId),
        btn: btnName,
        btnAlign: 'c', //按钮居中
        shade: 0, //不显示遮罩
        yes: function(index) {
            if (callback != false) {
                callback();
            }
            layer.close(index);
        }
    });
}


function deleteItem4Common(id, url, okCb, offset) {
    if (!offset) offset = 'auto';
    //询问框
    layer.confirm('确定删除记录？', {
        btn: ['删除', '取消'], //按钮
        offset: offset
    }, function() {
        var param = { "id": id };
        no_return_common_service(url, param, function(data) {
            okCb(); //重新加载表格数据
            layer.msg(data, {
                time: 2000 //20s后自动关闭
            });
        }, function(error) {
            // alert(error);
        });
    }, function(index) {
        layer.close(index);
    });
}

function deleteItem4CallBack(cb) {
    layer.confirm('确定删除记录？', {
        shade: 0,
        btn: ['确定', '取消'] //按钮
    }, function() {
        if (cb) cb();
    }, function(index) {
        layer.close(index);
    });
}

function addOrUpdateItem4Common(param, url, okCb) {
    no_return_common_service(url, param, function(data) {
        if (okCb) okCb(); //重新加载表格数据
        layer.msg(data, {
            time: 2000 //20s后自动关闭
        });
    }, function(error) {
        // alert(error);
    });
}
//获取道管中心列表
function getRoadManagerList() {
    get_common_service("/dept/getAllRM", null, function(data) {
        $.zui.store.set("cache_road_manager_list", data);
        // cb(data);
    });
}

function setRoadManagerSelect(div, selectId, hasAll) {
    var rmList = $.zui.store.get("cache_road_manager_list");
    setRoadManagerValue(rmList, div, selectId, hasAll, false);
}

function setRoadManagerSelect_1(div, selectId, hasAll) {
    var rmList = $.zui.store.get("cache_road_manager_list");
    setRoadManagerValue(rmList, div, selectId, hasAll, true);
}

function setRoadManagerValue(data, div, selectId, hasAll, isname) {
    var optStr = ''; //<option value="">全部</option>';
    if (hasAll) optStr = '<option value="">全部</option>';
    for (var i in data) {
        if (isname ? (data[i].name.indexOf(selectId) != -1) : (data[i].deptid == selectId))
            optStr += '<option value="' + data[i].deptid + '" selected="selected">' + data[i].name + '</option>';
        else
            optStr += '<option value="' + data[i].deptid + '">' + data[i].name + '</option>';
    }
    $(div).html('');
    $(div).html(optStr);
}

var cache_road_manager_fee_list_map;

//获取收费站列表
function getFeeList(callback) {
    get_common_service("/dept/getAllFs", null, function(data) {
        $.zui.store.set("cache_fee_station_list", data);
        var map = new Map();
        for (var i = 0; i < data.length; i++) {
            if (!map.get(data[i].parentid)) {
                map.put(data[i].parentid, []);
            }
            var arr = map.get(data[i].parentid);
            arr.push(data[i]);
        }
        cache_road_manager_fee_list_map = map;
        if (callback) callback(data);
    });
}

function setFeSelect(div, selectId) {
    var feeList = $.zui.store.get("cache_fee_station_list");
    if (feeList) {
        setFeeSelectValue(feeList, div, selectId);
    } else {
        get_common_service("/dept/getAllFs", null, function(data) {
            setFeeSelectValue(data, div, selectId);
        });
    }
}

function setSASelect(div, selectId) {
    hasall = true;
    var feeList = $.zui.store.get("cache_sa_station_list");
    if (feeList) {
        setSASelectValue(feeList, div, selectId);
    } else {
        get_common_service("/dept/getAllSA", null, function(data) {
            $.zui.store.set("cache_sa_station_list", data);
            setSASelectValue(data, div, selectId);
        });
    }
}

var hasall = true;

function setSASelecttemp(div, selectId, hasall1) {
    var feeList = $.zui.store.get("cache_sa_station_list");
    hasall = hasall1;
    if (feeList) {
        setSASelectValue(feeList, div, selectId);
    } else {
        get_common_service("/dept/getAllSA", null, function(data) {
            $.zui.store.set("cache_sa_station_list", data);
            setSASelectValue(data, div, selectId);
        });
    }
}

function setSASelectValue(data, div, selectId) {
    var optStr = '<option value="">全部</option>';
    if (!hasall) {
        optStr = "";
    }
    for (var i in data) {
        if (data[i].deptid == selectId)
            optStr += '<option value="' + data[i].deptid + '" selected="selected">' + data[i].name + '</option>';
        else
            optStr += '<option value="' + data[i].deptid + '">' + data[i].name + '</option>';
    }
    $(div).html('');
    $(div).html(optStr);
}

function setSASelectValueNoAll(data, div, selectId) {
    var optStr = '<option value="">请选择服务区</option>';
    for (var i in data) {
        if (data[i].deptid == selectId)
            optStr += '<option value="' + data[i].deptid + '" selected="selected">' + data[i].name + '</option>';
        else
            optStr += '<option value="' + data[i].deptid + '">' + data[i].name + '</option>';
    }
    $(div).html('');
    $(div).html(optStr);
}

function setSASelectValueNoAll_name(data, div, selectId, name) {
    var optStr = '<option value="">' + name + '</option>';
    for (var i in data) {
        if (data[i].deptid == selectId)
            optStr += '<option value="' + data[i].deptid + '" selected="selected">' + data[i].name + '</option>';
        else
            optStr += '<option value="' + data[i].deptid + '">' + data[i].name + '</option>';
    }
    $(div).html('');
    $(div).html(optStr);
}

function setSASelectValueNoAll2(data, div, selectId) {
    var optStr = '';
    for (var i in data) {
        if (data[i].deptid == selectId)
            optStr += '<option value="' + data[i].deptid + '" selected="selected">' + data[i].name + '</option>';
        else
            optStr += '<option value="' + data[i].deptid + '">' + data[i].name + '</option>';
    }
    $(div).html('');
    $(div).html(optStr);
}

function setFeeSelectValue(data, div, selectId) {
    var optStr = '<option value="">全部</option>';
    for (var i in data) {
        if (data[i].deptid == selectId)
            optStr += '<option value="' + data[i].deptid + '" selected="selected">' + data[i].name + '</option>';
        else
            optStr += '<option value="' + data[i].deptid + '">' + data[i].name + '</option>';
    }
    $(div).html('');
    $(div).html(optStr);
}

function setFeeSelectValueNoAll(data, div, selectId) {
    var optStr = '';
    for (var i in data) {
        if (data[i].deptid == selectId)
            optStr += '<option value="' + data[i].deptid + '" selected="selected">' + data[i].name + '</option>';
        else
            optStr += '<option value="' + data[i].deptid + '">' + data[i].name + '</option>';
    }
    $(div).html('');
    $(div).html(optStr);
}

var cache_road_manager_wrecker_group_map;

//获取清障部队列表
function getWreckerGroupList(callback) {
    get_common_service("/dept/getAllWG", null, function(data) {
        $.zui.store.set("cache_wrecker_group_list", data);
        var map = new Map();
        for (var i = 0; i < data.length; i++) {
            if (!map.get(data[i].parentid)) {
                map.put(data[i].parentid, []);
            }
            var arr = map.get(data[i].parentid);
            arr.push(data[i]);
        }
        cache_road_manager_wrecker_group_map = map;
        if (callback) callback(data);
    });
}

var cache_service_area_map;

//获取服务区列表
function getServiceAreaList(callback) {
    get_common_service("/dept/getAllSA", null, function(data) {
        $.zui.store.set("cache_service_area_list", data);
        var map = new Map();
        for (var i = 0; i < data.length; i++) {
            if (!map.get(data[i].parentid)) {
                map.put(data[i].parentid, []);
            }
            var arr = map.get(data[i].parentid);
            arr.push(data[i]);
        }
        cache_service_area_map = map;
        if (callback) callback(data);
    });
}

function setWreckerGroupSelect(div, selectId) {
    var feeList = $.zui.store.get("cache_wrecker_group_list");
    if (feeList) {
        setWreckerGroupSelectValue(feeList, div, selectId);
    } else {
        get_common_service("/dept/getAllWG", null, function(data) {
            setWreckerGroupSelectValue(data, div, selectId);
        });
    }
}

function setWreckerGroupSelectValue(data, div, selectId) {
    var optStr = '<option value="">全部</option>';
    for (var i in data) {
        if (data[i].deptid == selectId)
            optStr += '<option value="' + data[i].deptid + '" selected="selected">' + data[i].name + '</option>';
        else
            optStr += '<option value="' + data[i].deptid + '">' + data[i].name + '</option>';
    }
    $(div).html('');
    $(div).html(optStr);
}

function setLaneSelect(div, selectId) {
    var optStr = '';
    var data = [];
    for (var i = 0; i <= 8; i++) {
        if (i == 0)
            data.push({ id: i, name: '值机室' });
        else
            data.push({ id: i, name: i + '车道' });
    }
    for (var i in data) {
        if (i == selectId)
            optStr += '<option value="' + data[i].id + '" selected="selected">' + data[i].name + '</option>';
        else
            optStr += '<option value="' + data[i].id + '">' + data[i].name + '</option>';
    }
    $(div).html('');
    $(div).html(optStr);
}

// var ViewMap = new HashMap()
// ViewMap.set("/view/mytask/unchecked.html", __inline('/view/mytask/unchecked.html'));
// ViewMap.set("/view/mytask/unexamined.html", __inline('/view/mytask/unexamined.html'));
// ViewMap.set("/view/mytask/undispatched.html", __inline('/view/mytask/undispatched.html'));
// ViewMap.set("/view/mytask/dispatched.html", __inline('/view/mytask/dispatched.html'));
// ViewMap.set("/view/constant/constant.html", __inline('/view/constant/constant.html'));

/**
 * @Func 处理长整形时间格式化
 * @time long
 * @format string 有默认值
 */
function timeStamp2String(time, format) {
    if (time == "" || time == null)
        return;
    if (format == undefined || format == "")
        format = "yyyy/MM/dd hh:mm:ss";
    var datetime = new Date();
    datetime.setTime(time);
    return datetime.Format(format);
};

/**
 * @Func 时间格式化
 * @FuncName Format
 * (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
 */
Date.prototype.Format = function(fmt) {
    var o = {
        "M+": this.getMonth() + 1,
        "d+": this.getDate(),
        "H+": this.getHours(),
        "m+": this.getMinutes(),
        "s+": this.getSeconds(),
        "q+": Math.floor((this.getMonth() + 3) / 3),
        "S": this.getMilliseconds()
    };
    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
        if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    return fmt;
};
String.prototype.trim = function() {
    // 用正则表达式将前后空格
    // 用空字符串替代。
    return this.replace(/(^\s*)|(\s*$)/g, "");
}

/**
 * 提示框
 */
function tip(data, timeout) {
    if (data == undefined || data == '')
        return;
    layer.msg(data, {
        time: (timeout != null) ? timeout : 2000 //20s后自动关闭
    });
}

function showPopup4CommonBtns(title, area, divId, btns, callback1, callback2) {
    if (!area) area = 'auto';
    if (!divId) divId = '#form-div';
    //添加常量页面
    return layer.open({
        type: 1,
        area: area,
        title: title,
        closeBtn: 1,
        shadeClose: true,
        content: $(divId),
        btn: btns,
        btnAlign: 'c', //按钮居中
        shade: 0, //不显示遮罩
        yes: function(index) {
            if (callback != false) {
                callback();
            }
            layer.close(index);
        }
    });
}

function getCurrentUser() {
    var user = $.zui.store.get("user")
    return user;
}

function hasRole(role) {
    var user = getCurrentUser();
    var roles = user.roles;
    for (var i in roles) {
        if (roles[i].name == role) return true;
    }
    return false;
}

function roleContains(role) {
    var user = getCurrentUser();
    var roles = user.roles;
    for (var i in roles) {
        if (roles[i].name.indexOf(role) >= 0) return true;
    }
    return false;
}

function setCheckmanSelect(div, selectId, notHaveUserId, callback) {
    post_common_service("/user/getAllCheckman", null, function(data) {
        var optStr = '';
        for (var i in data) {
            if (data[i].id == notHaveUserId) continue;
            if (data[i].id == selectId)
                optStr += '<option value="' + data[i].id + '" selected="selected">' + data[i].truename + '</option>';
            else
                optStr += '<option value="' + data[i].id + '">' + data[i].truename + '</option>';
        }
        $(div).html('');
        $(div).html(optStr);
        if (callback) callback();
    });
}

function genAppeaFiles(file_src) {
    initStringfunc();
    var files = file_src.split(",");
    var optionStr = "";

    for (var i in files) {
        var fileSrc = base_image_server_url + files[i];
        if (fileSrc.endWith("png") || fileSrc.endWith("jpg") || fileSrc.endWith("ico")) {
            if (ISCLIENT) {
                optionStr += '<a href="javascript:void(0)" onclick="showClientImg(' + fileSrc + ')"><img src="' + fileSrc + '" style="height:55px;margin:5px;"></a>';
            } else {
                optionStr += '<a href="' + fileSrc + '" target="_blank"><img src="' + fileSrc + '" style="height:55px;margin:5px;"></a>';
            }
        } else if (fileSrc.endWith("doc") || fileSrc.endWith("docx")) {
            if (ISCLIENT) {
                optionStr += '<a href="javascript:void(0)" onclick="downloadClientfile(' + fileSrc + ')"><i class="icon icon-file-word icon-4x" style="vertical-align: middle"></a>';
            } else {
                optionStr += '<a href="' + fileSrc + '" target="_blank"><i class="icon icon-file-word icon-4x" style="vertical-align: middle"></a>';
            }
        } else if (fileSrc.endWith("txt")) {
            if (ISCLIENT) {
                optionStr += '<a href="javascript:void(0)" onclick="downloadClientfile(' + fileSrc + ')"><i class="icon icon-file-code icon-4x" style="vertical-align: middle"></a>';
            } else {
                optionStr += '<a href="' + fileSrc + '" target="_blank"><i class="icon icon-file-code icon-4x" style="vertical-align: middle"></a>';
            }
        }
    }
    return optionStr;
}
initStringfunc();

function initStringfunc() {
    String.prototype.endWith = function(str) {
        if (str == null || str == "" || this.length == 0 || str.length > this.length) {
            return false;
        }
        if (this.substring(this.length - str.length) == str) {
            return true;
        } else {
            return false;
        }
    };

    String.prototype.startWith = function(str) {
        if (str == null || str == "" || this.length == 0 || str.length > this.length) {
            return false;
        }
        if (this.substr(0, str.length) == str) {
            return true;
        } else {
            return false;
        }

    };
}

function showClientImg(src) {
    callFunc("showImage", src);
}

function showClientVideo(src) {
    callFunc("showVideo", src);
}

function downloadClientfile(src) {
    callFunc("downloadfile", src);
}

function setTeamUserSelect(div, selectId, classId) {
    post_common_service("/team/getTeamPersonsByUserClassId/" + classId, null, function(data) {
        var optStr = '';
        for (var i in data) {
            if (data[i].positionid == 4) data[i].truename = data[i].truename + '(班长)';
            if (data[i].id == selectId)
                optStr += '<option value="' + data[i].id + '" selected="selected">' + data[i].truename + '</option>';
            else
                optStr += '<option value="' + data[i].id + '">' + data[i].truename + '</option>';
        }
        $(div).html('');
        $(div).html(optStr);
    });
}

function getJobList(callback) {
    var param = {
        "dept_id": 1
    };
    post_common_service("/job/getList/", param, function(data) {
        $.zui.store.set("cache_job_list", data);
        callback(data);
    });
}

function setJobSelect(div, selectId) {
    var jobList = $.zui.store.get("cache_job_list");
    if (jobList) {
        setJobSelectValue(jobList, div, selectId);
    } else {
        var param = {
            "dept_id": 1
        };
        post_common_service("/job/getList/", param, function(data) {
            setJobSelectValue(data, div, selectId);
        });
    }
}

function setJobSelectValue(data, div, selectId) {
    var optStr = '<option value="">全部</option>';
    for (var i in data) {
        if (data[i].id == selectId)
            optStr += '<option value="' + data[i].id + '" selected="selected">' + data[i].name + '</option>';
        else
            optStr += '<option value="' + data[i].id + '">' + data[i].name + '</option>';
    }
    $(div).html('');
    $(div).html(optStr);
}
var cache_fee_person_list_map;

function getFeePersonList(callback) {
    // var param={
    //     "dept_id":1
    // };
    post_common_service("/user/getFsUserList/", {}, function(data) {
        $.zui.store.set("cache_fee_person_list", data);
        var map = new Map();
        for (var i = 0; i < data.length; i++) {
            if (!map.get(data[i].organid)) {
                map.put(data[i].organid, []);
            }
            var arr = map.get(data[i].organid);
            arr.push(data[i]);
        }
        cache_fee_person_list_map = map;
        callback(data);
    });
}

function setFeePersonSelect(div, selectId, deptId) {
    var jobList = $.zui.store.get("cache_fee_person_list");
    if (deptId) {
        var map = cache_fee_person_list_map;
        jobList = map.get(deptId);
    }
    if (jobList) {
        setFeePersonSelectValue(jobList, div, selectId);
    } else {
        post_common_service("/user/getFsUserList/", {}, function(data) {
            setFeePersonSelectValue(data, div, selectId);
        });
    }
}

function setFeePersonSelectValue(data, div, selectId) {
    var optStr = '<option value="">全部</option>';
    for (var i in data) {
        if (data[i].id == selectId)
            optStr += '<option value="' + data[i].id + '" selected="selected">' + data[i].truename + '</option>';
        else
            optStr += '<option value="' + data[i].id + '">' + data[i].truename + '</option>';
    }
    $(div).html('');
    $(div).html(optStr);
}

/**
 * 自定义Map对象
 */
function Map() {

    var mapObj = {};

    this.put = function(key, value) {
        mapObj[key] = value;
    };

    this.remove = function(key) {
        if (mapObj.hasOwnProperty(key)) {
            delete mapObj[key];
        }
    };

    this.get = function(key) {
        if (mapObj.hasOwnProperty(key)) {
            return mapObj[key];
        }
        return null;
    };

    this.getKeys = function() {
        var keys = [];
        for (var k in mapObj) {
            keys.push(k);
        }
        return keys;
    };

    // 遍历map
    this.each = function(fn) {
        for (var key in mapObj) {
            fn(key, mapObj[key]);
        }
    };

    this.toString = function() {
        var str = "{";
        for (var k in mapObj) {
            str += "\"" + k + "\" : \"" + mapObj[k] + "\",";
        }
        str = str.substring(0, str.length - 1);
        str += "}";
        return str;
    }
}

function getTags(url, div, tagDiv, field) {
    post_common_service(url, null, function(data) {
        if (data) {
            var str = "";
            for (var i = 0; i < data.length; i++) {
                str += '<a href="javascript:void(0)" onclick="addTag(\'' + data[i][field] + '\',\'' + tagDiv + '\')" style="float:left;margin:5px;"><span class="label label-success" style="padding:5px;">' + data[i][field] + '</span></a>';
            }
            $(div).html(str);
        }
    });
}

var nowStr;

function getServerTime() {
    get_common_service("/comm/getTime", "", function(data) {
            nowStr = data;
            gettime();
        },
        function(data) {
            nowStr = moment().format('YYYY-MM-DD HH:mm:ss');
            gettime();
        });
}

function gettime() {
    nowStr = moment(nowStr).add(1, 's').format('YYYY-MM-DD HH:mm:ss');
    // console.log("时间："+nowStr);
    settime();
}

function settime() {
    nowStr = moment(nowStr).format('YYYY-MM-DD HH:mm:ss');
    $("#time_p").html(nowStr);
    $("#main").css("min-height", window.innerHeight);
    var height = window.innerHeight - $("body").height();
    $("#foot").css("bottom", height > 0 ? 0 : height);
    setTimeout(gettime, 1000);
}

var job_array = new Array();

function getJob() {
    post_common_service("/job/getList", {}, function(data) {
        job_array = data;
    }, function(error) {});
}

function getCodeByFlagAndValue(code_flag, code_value, callback) {
    post_common_service("/constant/getConstantByFlagAndValue", { code_flag: code_flag, code_value: code_value }, function(data) {
        callback(data);
    }, function(error) {});
}

function isRealNum(val) {
    // isNaN()函数 把空串 空格 以及NUll 按照0来处理 所以先去除
    if (val === "" || val == null) {
        return false;
    }
    if (!isNaN(val)) {
        return true;
    } else {
        return false;
    }
}


function trim(str) {
    return str.replace(/\s|\xA0/g, "");
}


function getTimeByMonth(time) {
    var t = time.replace("/", "-") + "";
    var endtime = moment(t + "-25 23:00:00", "YYYY-MM-DD HH:mm:ss");
    var starttime = moment(moment(t + "-25 23:00:00", "YYYY-MM-DD HH:mm:ss").subtract(1, 'month'));
    return { starttime: starttime, endtime: endtime };
}

function getMomentTimeFormat(t) {
    return t.format("YYYY-MM-DD HH:mm:ss");
}

function getCurrentTimeFormat() {
    var m = moment().get("D") > 25 ? (moment().get("M") + 1) : (moment().get("M"));
    var p = moment();
    p = p.month(m);
    return p.format("YYYY/MM");
}

function GV(selector) {
    return $(selector).val();
}