﻿/// <reference path="jquery-1.2.6.min.js" />

$(document).ready(function() {
//sets a timer at 30 seconds to send a request.
    $.timer(30000, function(timer) {
        keepAlive.keepMeAlive(KeepAlive); // sends information async to keep the session alive
    });
});
///<summary>
/// recieves information back about the session.
///</summary>
///<param name="results" optional="false">string[] of results [0] is working [2] is username [3] is URL.</param>
function KeepAlive(results) {
    //alert(results[0]);
    if (results[0] != '0') {//checks if it worked.
        if (results[0] == '2' & results[3] != null) { //if the user is logged in and I got a url.
            keepAlive.keepMeAlive(KeepAlive); //resend the request.
        }
        //document.getElementById("ctl00_lblUsersOnline").innerHTML = results[1]; // submits the result.
        if (results[2] != null & results[2] != '') {
            commonPopup(results[3] + '/IM/chat.aspx?isPopUp=true&r=' + results[2], 400, 350, 4, 'Chat' + results[2]); //sends the popup request if it came back successful.
        }
    }
};
