var doZeroValues = "no";

function doDateUpdate()
{
    // *** Nothing to edit below here. *** \\
//    var today   = new Date();

    tempToday = new Date();
    tempObj   = tempToday.getTime() - counterOffset;

    var today = new Date( tempObj );

    var output  = "";

    var raw_ms_left  = targetDate - today;
    var n_days_until = (raw_ms_left - ( raw_ms_left % 86400000 )) / 86400000;
    if( (n_days_until > 0) || (doZeroValues == "yes") )
    {
        output += n_days_until;
        if( n_days_until == 1 )
	{
	    output += ' day, ';
	}
	else
	{
	    output += ' days, ';
	}
    }

    raw_ms_left -= (n_days_until * 86400000);
    var n_hours_until = (raw_ms_left - ( raw_ms_left % 3600000 )) / 3600000;
    if( ((n_hours_until > 0) || (doZeroValues == "yes")) || (n_days_until > 0) )
    {
        output += n_hours_until;
	if( n_hours_until == 1 )
	{
	    output += ' hour, ';
	}
	else
	{
	    output += ' hours, ';
	}
    }

    raw_ms_left -= (n_hours_until * 3600000);
    var n_minutes_until = (raw_ms_left - ( raw_ms_left % 60000 )) / 60000;
    if( ((n_minutes_until > 0) || (doZeroValues == "yes")) || 
        ((n_hours_until > 0) || (n_days_until > 0)) )
    {
        output += n_minutes_until;
	if( n_minutes_until == 1 )
	{
	    output += ' minute ';
	}
	else
	{
	    output += ' minutes ';
	}
    }

    raw_ms_left -= (n_minutes_until * 60000);
    var n_seconds_until = (raw_ms_left - ( raw_ms_left % 1000 )) / 1000;
    if( ((n_seconds_until > 0) || (doZeroValues == "yes")) || 
        ((n_minutes_until > 0) || (n_hours_until > 0) || (n_days_until > 0)) )
    {
        if( ((n_minutes_until > 0) || (n_hours_until > 0) || (n_days_until > 0 )) || 
	    (doZeroValues == "yes") )
	{
	    output += ' and ';
	}

        output += n_seconds_until;
	if( n_seconds_until == 1 )
	{
	    output += ' second';
	}
	else
	{
	    output += ' seconds';
	}
    }

    // Are we at the date or beyond it?
    if( Math.floor( (today.getTime() / 1000) ) >= 
        Math.floor( (targetDate.getTime() / 1000) ) )
    {
        output = targetMetMsg;
    }        

    if( document.layers )
    {
        var xref = document.layers["counter"].document;

	xref.open();
	xref.write( '<FONT CLASS = "counter">System lockout in: ' + output + '</FONT>' );
	xref.close();
    }
    else
    {
        theCounterDiv = document.getElementById( "counter" );
	theCounterDiv.innerHTML = '<FONT CLASS = "counter">System lockout in: ' + output + '</FONT>';
    }

    setTimeout( "doDateUpdate()", 1000 );
}

function noLockout()
{
    var output = 'No lock-out time set... pre or post season';

    if( document.layers )
    {
        var xref = document.layers["counter"].document;

	xref.open();
	xref.write( '<FONT CLASS = "counter">' + output + '</FONT>' );
	xref.close();
    }
    else
    {
        theCounterDiv = document.getElementById( "counter" );
	theCounterDiv.innerHTML = '<FONT CLASS = "counter">' + output + '</FONT>';
    }
}

function doError( output )
{
    if( document.layers )
    {
        var xref = document.layers["counter"].document;

	xref.open();
	xref.write( '<FONT CLASS = "counter">' + output + '</FONT>' );
	xref.close();
    }
    else
    {
        theCounterDiv = document.getElementById( "counter" );
	theCounterDiv.innerHTML = '<FONT CLASS = "counter">' + output + '</FONT>';
    }
}


