// This script is Copyright 2000-2002 TNG Consulting Inc. All rights reserved.
// You can contact us though our web site at http://www.tngconsulting.ca/
// Do not copy in part or in whole, or modify without permission!

function ThisYear(theDate)
{ var FullYear = theDate.getYear() % 100;
  FullYear += (FullYear < 38) ? 2000 : 1900;
  return FullYear;
}

// This function will return true until specified date.
// Date must be in yyyy,mm,dd format.
function isBetween(iyr1,imo1,ida1,iyr2,imo2,ida2)
{
  var isNow = false;
  var curdate = new Date();
  if (ida1 == 0) ida1 = 1; if (ida2 == 0) ida2 = curdate.getDate();
  if (imo1 == 0) imo1 = 1; if (imo2 == 0) imo2 = 12;
  if (iyr1 == 0) iyr1 = ThisYear(curdate); if (iyr2 == 0) iyr2 = ThisYear(curdate);
  ida2++; // +1 day because ends at 00:00 AM
  var startdate = new Date(iyr1,imo1-1,ida1); // month is an offset of 0=jan
  var enddate = new Date(iyr2,imo2-1,ida2); // month is an offset of 0=jan
  isNow = (startdate.getTime() <= curdate.getTime() && curdate.getTime() <= enddate.getTime());
  return (isNow);
} // isBetween(iyr1,imo1,ida1,iyr2,imo2,ida2)

// This function will only create and display the latest news box if there is something to report.
function LatestNews()
{
  var sNews = "";

  // == Put the latest news BELOW this line. Do not touch anything above! ==

  // Ascension Activities (December 2002)
  if (isBetween(2002,12,31,2003,1,21))
    sNews+='<P><a href="/Gallery/AscensionActivities2002/"><b>New Photos!</b></a><br>(2002-12-31)</P><P>Visit the photo gallery of <a href="/church.htm">Our Church</a> to see new photos of last years English Second Language (ELS) classes, Seder Meal and VBS Hotdog Roast.</P>';

  // === The rest of the latest news below repeats automatically each year ===

  // New Year
  if (isBetween(0000,1,1,0000,1,14))
    sNews+='<P><b>Happy New Year!</b></a>(Jan.1)</p><p>We hope you all enjoyed the holidays. Joining us each week for <a href="worship.htm">Sunday Morning Divide Services</a>, learn about the love of God, and make this a great year.</p>';

  // Sunday School
  if (isBetween(0000,08,15,0000,09,15))
    sNews+='<P><a href="sundayschool.htm"><b>Sunday School!</b></a></P><P>Hope you all had a great summer and took some time to have fun in the sun. Don\'t forget to register for <b>Sunday School</b> and <b>Confirmation classes</b>. Please contact <a href="contact.htm">Pastor</a> for details. It\'s fun and it\'s free!. Be sure to ask about <b>joining the choir</b> too. You will find friendly faces, learn about God make new friends. See you there!</p>';
 
  // Sunday School Volunteers
  if (isBetween(0000,07,30,0000,09,03))
    sNews+='<P><b>Volunteers Wanted!</b></a></P><P>Fancy yourself as somewhat of a handyman? Can you carry a tune? Perhaps you have an aptitude for organizing activities, teaching, crafts, writing or desktop publishing. Don\'t think you have any skills at all? Don\'t be shy. Contact <a href="contact.htm">Pastor</a> to find out how you can contribute to your church. Give it a try. It will make you feel good inside.</p>';
 
  // VBS
  if (isBetween(0000,06,15,0000,07,15))
    sNews+='<P><b>Join us at VBS...</b></a></P><P>Hey kids! Want to have fun this summer? Whether you are near or far, join us for <b>Summer Vacation Bible School</b>. You will learn about Jesus and God, make new friends, and have lots of fun participating in all kinds of activities. Please contact <a href="contact.htm">Pastor</a> for more information and to register (it\'s FREE!). See you there!</p>';

  // VBS volunteers
  if (isBetween(0000,05,15,0000,07,1))
    sNews+='<P><b>Volunteer@VBS!</b></a></P><P>Summer Vacation Bible School is almost here. If you would like to help out, please contact <a href="contact.htm">Pastor</a>. We are looking for <b>students</b> and <b>adults</b> volunteers to help prepare crafts, snacks, teach and more. Full time and part time helpers will be much appreciated.</p>';

  // Think God!
  if (isBetween(0000,04,15,0000,05,15) || isBetween(0000,9,15,0000,10,01))
    sNews+='<P><b>Think God!</b></a></P><P>Just a reminder to keep God on your mind and in your heart as you make your way though each day.</p>';

  // Halloween
  if (isBetween(0000,10,0,0000,10,0))
    sNews+='<P><a href="news.htm"><b>Halloween...</b></a><br>(Oct.1)</p><p>Reminder: Please contact <a href="contact.htm">Pastor</a> for details on this years activities.</p>';

  // Lent
  if (isBetween(0000,11,20,0000,12,20))
    sNews+='<P><a href="worship.htm"><b>Lent Services</b></a><br>(Nov.20)</p><p>Reminder: Join us each Wednesday evening in December until Christmas for Lent services.</p>';

  // Christmas
  if (isBetween(0000,12,5,0000,12,26))
    sNews+='<P><a href="worship.htm"><b>It\'s Christmas time!</b></a>(Dec.5)</p><p>Join us for a beautiful candlelight service Christmas Eve. See our <a href="worship.htm">Worship Services</a> page for time and location.</p>';


  // == Put the latest news ABOVE this line. Do not touch anything below! ==
  
  if (sNews.length > 0)
  {
    document.write('<table border="1" cellspacing="1" cellpadding="3" width="145" align="right">');
    document.write('<tr valign="middle">');
    document.write('<td width=135 class="mnuButtons"><center><img src="Images/news.gif" width="32" height="32" align="absmiddle" border="0" alt="news">');
    document.write('<span class="mnuButtons">&nbsp;Latest News</span></center>');
    document.write('</td>');
    document.write('</tr>');
    document.write('<tr valign=middle>');
    document.write('<td width=135 height=20 bgcolor="#ffffff">');
    document.write('<marquee onmouseover=this.stop() onmouseout=this.start() scrollAmount=1 scrollDelay=1 direction=up height=265 width=135>');
    document.write(sNews);
    document.write('<a href="news.htm" onMouseOver="window.status=\'More news from Ascension\'; return true;" onMouseOut="window.status=\'\'; return true;">');
    document.write('<font face="Arial,Helvetica,sans-serif" color="#000000" size=2></font><font face="Arial,Helvetica,sans-serif" color="#000000" size=2 style="font-size : x-small;">Previous news...</font></a>');
    document.write('</marquee>');
    document.write('</td>');
    document.write('</tr>');
    document.write('</table>');
  }
} // LatestNews()

LatestNews();