var startDay = 'xxxx';
var nextDay =  'xxxx';
var startDayStamp = 0;
var nextDayStamp = 0;
var endof = 'false';

function daysLoaded( startDayP, startDayStampP, nextDayP, nextDayStampP, endofP)
{
   startDay = startDayP;
   nextDay = nextDayP;
   startDayStamp = startDayStampP;
   nextDayStamp = nextDayStampP;
   endof = endofP;

   thCss();
}

function doCss()
{                   
    var days = document.getElementsByTagName('div');
 
     for ( i=0; i<days.length; i++)
     {
         var id = days[i].id;
         if ( ! id) continue;
         if ( id.indexOf('dy20') != 0 )
             continue;
         var dte = id.substring(2);

         var beforeEnd = (dte < nextDay);
         if ( endof == 'true'  && dte == nextDay)
            beforeEnd = true;
      
         if ( (dte > startDay) && beforeEnd)
         {
             days[i].style.background = '#Ffd76C';
         }
         else if ( dte == startDay)
             days[i].style.background = 'orange';
         else
             days[i].style.background = 'white';
     }
}

function waitForEventList()
{
   pleaseWait('eventList');
}

function selectDay( dyS, dyStamp)
{
  waitForEventList();
   $('#eventList').load('listEvents.php?fromD=' + escape(dyS) + '&fromStamp=' + dyStamp );
}

function nextDays()
{
  waitForEventList();
   $('#eventList').load('listEvents.php?fromD=' + escape(nextDay) + '&fromStamp=' + nextDayStamp );
}

function allEvents()
{
  waitForEventList();
  $('#eventList').load('listEvents.php?&publicOnly=no');
  $('#publicEventsTitle').hide('slow');
  $('#eventsTitle').show('slow');
}

function publicEvents()
{
  waitForEventList();
  $('#eventList').load('listEvents.php?publicOnly=yes');
  $('#publicEventsTitle').show('slow');
  $('#eventsTitle').hide('slow');

}
