/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com */
var text = 0;
var ctime;

var message=new Array();
  message = [
  			  ["The March For Life 2011 will be on <strong>January 22</strong><br>in Boise, Coeur d'Alene, and Moscow.<br /><a href='http://rtli.org/legislation.html#div20110107'>Click here for more info.</a>", new Date("1/22/2011")]
  			 ,["Picnic Style <b>Parish Potluck</b> - Jan 29 after 5:30pm Mass<br>Questions: Call Theresa Holcomb 983-2856", new Date("1/29/2011")]
  			 ,["Picnic Style <b>Parish Potluck</b><br>Feb 5 after 5:30pm Mass", new Date("2/5/2011")]
  			 ,["Souper Bowl of Caring<br />February 5-6", new Date("2/6/2011")]
  			 ,["<b>Parish Potluck</b> - Feb 26 after 5:30pm Mass<br>Questions: Call Theresa Holcomb 983-2856", new Date("2/26/2011")]
  			 ,["<a href='http://icyc2011.homestead.com/'>ICYC 2011</a> - February 25-27<br>The registration deadline is January 23", new Date("2/27/2011")]
   			 ,["The 17th Annual <b>Chocolate Fantasy</b> is on March 12th<br />Questions: Teresa Groom 983-0847 (h) / 983-2182 (w)", new Date("3/12/2011")]
 			 ,["<b>Parish Potluck</b> - March 26 after 5:30pm Mass<br><span class='small'>Questions: Call Theresa Holcomb 983-2856", new Date("3/26/2011")]
  			 ,["<b>Weekend Getaway</b> - Theology of the Body Retreat<br>by Fr. Brad & Fr. Rob Cook<br />Sat, April 2nd to Sun, April 3rd - <a href='downloads/CouplesWeekendGetawayFlyerFinal.pdf'>Click for Details</a>", new Date("4/3/2011")]
  			 ,["<b>Sister Beverly - Vatican II's <i>Lumen Gentium</i></b><br><span class='small'>Thursday, April 7th at 7:15pm</span>", new Date("4/8/2011")]
  			 ,["<b>Idaho Catholic Appeal</b><br /><span class='small'>Starts March 20th - <a href='#ICA'>Details Here</a></span>", new Date("4/20/2011")]
  			 ,["<b>First Communion</b><br /><span class='small'>Sunday, May 1st, 8:00am</span>", new Date("5/2/2011")]
  			 ,["<b>4th Annual Walk for Life</b><br /><span class='small'>Saturday, May 7th at 8am at the City Park with registration at 9am</span>", new Date("5/8/2011")]
  			 ,["<b>Father Mel Sprute Memorial Mass & Dinner</b><br /><span class='small'>Saturday, May 7th at 11:30am</span>", new Date("5/8/2011")]
  			 ,["<b>Confirmation with Bishop Skylstad</b><br /><span class='small'>Wednesday, May 11, at 7:00pm</span>", new Date("5/12/2011")]
 			 ,["<b>Pinochle Marathon Party/Potluck</b><br /><span class='small'>Sunday, May 15th, from 5pm to 8pm in the Entry Hall", new Date("5/16/2011")]
 			 ,["<b>Parish Yard & Bake Food Sale</b><br /><span class='small'>Saturday, May 21, from 7am to 7pm in the Gym", new Date("5/22/2011")]
 			 ,["<b>Parish High School Senior's Breakfast</b><br /><span class='small'>Sunday, May 22, from 9am to 10am in the Entry Hall", new Date("5/23/2011")]
 			 ,["<b>Marriage Encounter Weekend</b><br /><span class='small'>June 3rd to 5th at Nazareth Retreat Center in Boise", new Date("6/6/2011")]
 			 ,["<b>Steubenville Northwest - Youth Conference</b><br /><span class='small'>July 29th to 31st in Spokane", new Date("7/31/2011")]
  			];


function changeText() {
	var d = new Date();
	var curr_date = d.getDate();
	var curr_month = d.getMonth();
	var curr_year = d.getFullYear();
	d = new Date(curr_year, curr_month, curr_date);
	var x;
	
	if (message.length > 0) {
		for (x=message.length-1; x>=0; x--) {
			if (message[x][1] < d) {
				message.splice(x,1);
			}
		}
	}  
	changeTextHelper();                                           
} 

function changeTextHelper() {
	if (message.length > 0) {
		if (text < 0 ) {text = message.length - 1;}  // change the # 4 at the left to the maximum # of message lines you want included
		if (text >= message.length  ) {text = 0;}  // change the # 4 at the left to the maximum # of message lines you want included
		clearTimeout(ctime);
		//document.change.descript.value=message[text];
		document.getElementById("announcements").style.display="block";
		document.getElementById("announcementsText").innerHTML = message[text][0];
		text++;
		if (text == message.length ) {text = 0;}  // change the # 4 at the left to the maximum # of message lines you want included
		ctime = window.setTimeout("changeTextHelper()", 5000);  // change the # on the left to adjust the speed of the
	}                                               // scroll. The smaller the # the faster the speed
} 

function prevText() {
	if (text == 0 ) {text = message.length ;}  // change the # 4 at the left to the maximum # of message lines you want included
	text=text-2; 
	changeTextHelper();
}

// Multiple onload function created by: Simon Willison
// http://simon.incutio.com/archive/2004/05/26/addLoadEvent
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(function() {
  changeText();
});

