function getColors(str)
{
    var color = ((navigator.appName.indexOf("Microsoft") > -1) ? screen.colorDepth : screen.pixelDepth); 

    str += "&colors=" + color;

    return str;
}

function getResolution(str)
{
    str += "&res=" + window.screen.width + "x" + window.screen.height;

    return str;
}

function getReferer(str)
{
    if (document.referrer != "")
    {
        ref = "&ref=" + escape(document.referrer); 

        if ((ref != "") || (ref != "undefined")) 
        { 
            str += ref; 
        }
    }

    return str;
}

function getIsJava(str)
{
    if (navigator.javaEnabled() == 1)
    {
        str += "&java=1";
    }

    return str;
}

function getIsFontSmootingEnabled(str)
{
    if (window.screen.fontSmoothingEnabled == true)
    {
        str += "&fonts=true";
    }

    return str;
}

function getIsCookieEnabled(str)
{
    if (navigator.cookieEnabled != null) 
    {
        if (navigator.cookieEnabled == 1)
        {
            str += "&cookie=1";
        } 
    }

    return str;
}

function getPlugins(str)
{
    var num_of_plugins = navigator.plugins.length;

    for (var i = 0; i < num_of_plugins; i++) 
    {
        str += "&plugin[" + i + "]=" + navigator.plugins[i].name;
    }
 

    return str;
}

function doStat(name)
{
    var str = "";

    str = getIsJava(str);
    str = getColors(str);
    str = getResolution(str);
    str = getIsFontSmootingEnabled(str);
    str = getReferer(str);
    str = getIsCookieEnabled(str);
    str = getPlugins(str);

    document.write('<a href="http://stats.ericbruggema.nl/index.php?load=' + name + '" TITLE="View user statistics"><img src="http://stats.ericbruggema.nl/stat.php?name=' + name + str + '&ext=.png" border=0 ALT="Statistics image"></a>'); 
}
