function reload_brief_listings()
{
    if (ready_to_accept())
    {
        sCommand = '/ajax_commands/reload_brief_listings.php';
        xmlHttp.open('GET', sCommand);
        xmlHttp.onreadystatechange = function myFunction()
        {
            if (ready_to_process())
            {
                document.getElementById('brief_listings_box').innerHTML = '';
                
                aEvents = xmlHttp.responseText.split('*');
                
                for (a = 0; a < aEvents.length; a++)
                {
                    aCurrentEvent = aEvents[a].split('|');
                    document.getElementById('brief_listings_box').innerHTML += '<b><a class="listing_links" href="/find_listings.php?selected=' + aCurrentEvent[0] + '">' + aCurrentEvent[5] + '</a></b><br>';
                    document.getElementById('brief_listings_box').innerHTML += '<b>What:</b> ' + aCurrentEvent[2] + '<br>';
                    document.getElementById('brief_listings_box').innerHTML += '<b>When:</b> ' + aCurrentEvent[19] + ' to ' + aCurrentEvent[20] + '<br>';
                    
                    if (aCurrentEvent[16] != '')
                    {
                        document.getElementById('brief_listings_box').innerHTML += '<b>Who:</b> ' + aCurrentEvent[16] + '<br>';
                    }
                    document.getElementById('brief_listings_box').innerHTML += '<b>Where:</b> ' + aCurrentEvent[17] + '<br>';
                    document.getElementById('brief_listings_box').innerHTML += '<b>Frequency:</b> ' + aCurrentEvent[21] + '<br><br>';
                }
                setTimeout('reload_brief_listings()', 30 * 1000);
            }
        }
        xmlHttp.send(null);
    }
    else
    {
        setTimeout('reload_brief_listings()', 250);
    }
}
setTimeout('reload_brief_listings()', 30* 1000);

function loadStateFilter(sCountry)
{
    xmlHttp.open('GET', '/ajax_commands/get_country_filter.php?country=' + sCountry, false);
    xmlHttp.send(null);
    
    aStates = xmlHttp.responseText.split(',');
    
    droplist = document.getElementById('state_filter');
    droplist.options.length = 0;
    
    var newOption = document.createElement('OPTION');
    newOption.text = 'Choose One';
    droplist.options.add(newOption);
    
    if (aStates.length != 0)
    {
        for (a = 0; a < aStates.length; a++)
        {
            var newOption = document.createElement('OPTION');
            newOption.text = aStates[a];
            newOption.value = aStates[a];
        droplist.options.add(newOption);
        }
    }
}

function loadCityFilter(sState)
{
    sCountry = document.getElementById('country_filter').options[document.getElementById('country_filter').selectedIndex].value;
    
    xmlHttp.open('GET', '/ajax_commands/get_city_filter.php?country=' + sCountry + '&state=' + sState, false);
    xmlHttp.send(null);
    
    aStates = xmlHttp.responseText.split(',');
    
    droplist = document.getElementById('city_filter');
    droplist.options.length = 0;
    
    var newOption = document.createElement('OPTION');
    newOption.text = 'Choose One';
    droplist.options.add(newOption);
    
    if (aStates.length != 0)
    {
        for (a = 0; a < aStates.length; a++)
        {
            var newOption = document.createElement('OPTION');
            newOption.text = aStates[a];
            newOption.value = aStates[a];
        droplist.options.add(newOption);
        }
    }
}
