// Copyright (c) 2002 Anahoret Team

// period of data passing to server in sec,
var period = 30;

// id of webmaster which uses this script
//-- var webmaster_id = ;

// Url for image which gets info about visitor and return one 1x1 transparent
// GIF:
var img_url = 'http://www.600mainstreet.com/wmserver/tag.php?';

// using this image all info is passed to server inside of url
var img = new Image();

// Converts days to miliseconds
/*
function days2miliseconds( days )
{
    return days * 24 * 60 * 60 * 1000;
}
*/

// returns current time to make urls unique
function getUTCTime()
{
    var d = new Date();
    var res = d.getUTCFullYear() + "/" +
              d.getUTCMonth() + "/" +
              d.getUTCDate() + " " +
              d.getUTCHours() + ":" +
              d.getUTCMinutes() + ":" +
              d.getUTCSeconds() + ":" +
              d.getUTCMilliseconds();
    return res;
}


// Sends info about
function SendStartInfo()
{
    var browser = navigator.userAgent;
    var page_url = window.location.href;
    var page_title = window.document.title;
    var referrer = window.document.referrer;
    var time = getUTCTime();
    var url = img_url +
              "action=new_page&" +
//--              "webmaster_id=" + webmaster_id + "&" +
              "visitor_user_agent=" + escape( browser ) + "&" +
              "page_url=" + escape ( page_url ) + "&" +
              "page_title=" + escape( page_title ) + "&" +
              "page_referer=" + escape( referrer ) + "&" +
              "time=" + escape( time );
    img.src = url;
}

// Sends info about the fact that this user is till on the site
function SendPresenceInfo()
{
    var time = getUTCTime();
    var url = img_url +
              "action=cur_page&" +
//--              "webmaster_id=" + webmaster_id + "&" +
              "time=" + escape( time );
    img.src = url;
}

SendStartInfo();
window.setInterval( 'SendPresenceInfo()', period * 1000 );
