thisday = new Date();
var eventmessage = "" ;
var all = false ;
if ( document.URL.indexOf("#all") != -1 ) {all = true} ;

d=new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
m=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
//date=new Date();
//day=date.getDate();
//year=date.getYear();
//if (year < 2000) year=year+1900;
//TodaysDate=" "+d[date.getDay()]+" "+day+" "+m[date.getMonth()]+" "+year;
//document.write(TodaysDate);

function Event(ed, em, ey, event, preShow) {

if (preShow == undefined) {preShow = 65} ; // number of days prior to the event that it will be displayed
preShow = thisday.getTime() + (preShow * 86400000 ) ;

em = em - 1 ; // in the 'new Date()'  function the month is based on Jan = 0	
eventdate = new Date(ey,em,ed) ;	
if (((thisday - 86400000) < eventdate) && ((eventdate.getTime() <= preShow) || all )) {
eventday = eventdate.getDate();
eventyear = eventdate.getYear();
eventrealdate=d[eventdate.getDay()]+"</td><td align='right' valign='top'>"+eventdate.getDate()+"</td><td  valign='top'>"+m[eventdate.getMonth()] ;
eventmessage += "<tr><td valign='top'>" + eventrealdate  + "</td><td>&nbsp;</td><td>" + event + "</td></tr>"
}
} 

//Place EVENTS here	
// Format is Event(dd,mm,yyyy,"description",days);
// If a double quote is required in the description then it must be entered as  \"
// days is the number of days prior to the event that it will be displayed.  It may be omitted (leave out the comma as well) when it will default to 65 days




Event(20,06,2010,"8 am Holy Communion<br>10 am Mattins (Morning Prayer)<br>6 pm Evensong",100) ;
Event(22,06,2010,"7 pm Evening walk (meet at church)") ;
Event(23,06,2010,"10 am Holy Communion") ;
Event(27,06,2010,"8 am Holy Communion<br>10 am Parish Communion<br>6 pm Evensong") ;
Event(30,06,2010,"10 am Holy Communion") ;
Event(04,07,2010,"8 am Holy Communion (Prayer Book)<br>10 am All Age Worship<br>6 pm Holy Communion") ;
Event(06,07,2010,"7 pm Evening walk (meet at church)") ;





// end of list of events

if (eventmessage > ""){
document.write("<h3>Forthcoming Events</h3><table border=0 id=\"main1\" align=\"center\">" + eventmessage) ;
document.write("</table><p>Events are open to everyone, and we warmly welcome newcomers to St Anne's to come along. Please contact the Office (01276 850576) for event details.");
}
else {
document.write("<div id=\"main1\"></div>");
}

