var league = 0;
var current_date = '<xsl:value-of select="@date"/>';
var game_counter = 0;
var game_color = "";
var game_date = "";
var game_time = "";
var team_counter = 0;
var score = '';
var in_header = false;
var number_of_books;
var sports_books;
function in_game (gd, gt)
    {
    game_date = gd;
    game_time = gt;
    if (((game_counter++) % 2) == 0)
        game_color = "white";
    else
        game_color = "grey";
    if (in_header)
        {
        in_header = false;
        document.write ('<TD class="headings">Time</TD>');
        document.write ('<TD class="headings">Gm #</TD>');
        document.write ('<TD class="headings" colspan="2">Team</TD>');
        document.write ('<TD class="headings" colspan="2">Score</TD>');
        for (i = 0; i < number_of_books; i++)
            document.write ('<TD class="headings">' + sports_books [i] + '</TD>');
        }
    }
function string_time (ctime)
    {
    minutes = ctime.substring (3);
    hour = ctime.substring (0, 2);
    if (hour.substring (0,1) == '0')
        game_hour = parseInt (hour.substring (1));
    else
        game_hour = parseInt (hour);

    ampm = 'a';
    if (game_hour >= 12)
        {
        if (game_hour >= 13)
            game_hour -= 12;
        ampm = 'p';
        }
    value = game_hour + minutes + ampm;
    if (game_hour >= 10)
        return (value.substring (0, 2) + ':' + value.substring (2));
    else if (game_hour == 0)
        return ('12:' + value.substring (1));
    else
        return (value.substring (0, 1) + ':' + value.substring (1));
    }
function in_team (number, team, pitcher, hand, score, status)
    {
    if ((team_counter++)%2 == 0)
        document.write ('<td class="scores-' + game_color + 'bg">' + game_date.substring (4, 6) + '/' + game_date.substring (6) + '</td>');
    else
        document.write ('<td class="scores-' + game_color + 'bg">' + string_time (game_time) + '</td>');
    document.write ('<td class="scores-' + game_color + 'bg">' + number + '</td>');
    if (league == 5 && team.length > 3 && team.charAt (3) == ' ')
        {
        document.write ('<td class="scores-' + game_color + 'bg-team" width="2%">' + team + '</td><td class="scores-' + game_color + 'bg-team">' + pitcher);
        if (hand == 'L')
            document.write ('<b>-' + hand + '</b>');
        document.write ('</td>');
        }
    else
        document.write ('<td class="scores-' + game_color + 'bg-team" colspan="2">' + team + '</td>');
    if (score == '255')
        score = '';
    document.write ('<td class="scores-' + game_color + 'bg">' + score + '</td>');
    document.write ('<td class="scores-' + game_color + 'bg">' + status + '</td>');
    }
function in_line (value)
    {
    document.write ('<td class="scores-' + game_color + 'bg">' + value + '</td>');
    }
