function getsrc(e, n) {
    var i = new RegExp(e + "(\\?(.*))?$"), s = document.getElementsByTagName("script");
    for (var o = 0; o < s.length; o++) {
        var u = s[o];
        if (u.src && u.src.match(i)) {
            var a = u.src.match(i)[2];
            if (a && (t = a.match(/([^&=]+)=([^=&]+)/g))) for (var f = 0; f < t.length; f++) {
                r = t[f];
                var l = r.match(/([^&=]+)=([^=&]+)/);
                if (l && l[1] == n) return l[2]
            }
        }
    }
    return ""
}

function online_user() {
    var e = getsrc("onlineuser.js", "src");
    e != "" && $.ajax({
        url: "/api/statistics/onlineuser.ashx?rtc=" + window.location.href, error: function () { $(e).html("1") }, success: function (t) {
            $(e).html(t)
        }
    })
}
$(document).ready(online_user())

var input_time = document.createElement("input");
input_time.setAttribute("type", "hidden");
input_time.setAttribute("id", "sys_user_online_count_2013050809");
window.document.body.appendChild(input_time);


var styTime = 1;
function show_secs() {
    styTime = styTime + 1;
    var count_user_line = document.getElementById("sys_user_online_count_2013050809");
    count_user_line.setAttribute("value", styTime);
}
window.setInterval('show_secs()', 1000);


window.document.body.onbeforeunload = function () {
    var count_user_line = document.getElementById("sys_user_online_count_2013050809");
    var ss = count_user_line.getAttribute("value");
    $.ajax({ url: "/api/statistics/onlineuser.ashx?unload=unload&rtc=" + ss, success: function (t) { } })
}