var benchmarks = new Object();

function openBenchmark(sName)
{
    if (benchmarks[sName] != null)
    {
        return false;
    }
    var t = new Date();
    benchmarks[sName] = new Array();
    benchmarks[sName][0] = t;
    return true;
}

function closeBenchmark(sName)
{
    var t = new Date;
    if (benchmarks[sName] != null)
    {
        benchmarks[sName][1] = t;
        return true;
    }
    return false;
}

function drawBenchmarks()
{
    var sResult = "";
    for (x in benchmarks)
    {
        var bench = benchmarks[x];
        var benchName = x;
        var result = bench[1] - bench[0];
        sResult += x + ": " + result + " (" + typeof(result) + ")";
    }
    //alert(sResult);
}