var update = false;

if(!update)
    upd_static(false);

function upd_static(go)
{
    $.getJSON(home+'?static=online', function(data)
    {
        if(!go){
            upd_static(true)
        } else {
        
            $('#admins').text(data['admins']);
            $('#supports').text(data['supports']);
            $('#users').text(data['users']);
            $('#allusers').text(data['all']);
            $('#registered').text(data['registered']);
            $('#regday').text(data['regis_day']);
            $('#visitors').text(data['visitors']);    
            $('#chat_notice, #minichat_notice').text(data['chat_notice']);

            if(data['chat_notice'] > 0)
            {
            	$('#chat_notice').css('display', 'inline-block');
            	$('#chat_notice').text(data['chat_notice']);
            }else
            	$('#chat_notice').hide();

            if(go)
            	setTimeout(function(){upd_static(true);}, 10000);
        }
    });
}

var getURL = function getURL(sParam) {
    var sPageURL = window.location.search.substring(1),
        sURLVariables = sPageURL.split('&'),
        sParameterName,
        i;

    for (i = 0; i < sURLVariables.length; i++) {
        sParameterName = sURLVariables[i].split('=');

        if (sParameterName[0] === sParam) {
            return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
        }
    }
};

function go(url)
{
    document.location = url;
    return false;
}