<!-----



function popUp(docID,flag){
	//docID is an array of elements
	var strDocIDs = new String(docID);
	var arIDs = strDocIDs.split(',');
	var i;
	var browser = navigator.appName;
	var element;
	var ID;
	for (i=0; i < arIDs.length; i++){
		ID = arIDs[i];
		element = document.getElementById(ID);

		if (flag == 1){
			element.style.visibility='visible';
			if (browser == "Netscape") {
				element.visibility="visible";
			}
		}
		if (flag == 0) {
			element.style.visibility='hidden';
			if (browser == "Netscape"){
				element.visibility='hidden';
			}
		}
	}
}


function getSchoolYear(){
	var date = new Date();
	var year = date.getFullYear();
	var month = date.getMonth();
	if (month >= 5 && month < 12) {
		//it is later than Sept and less than or equal to Dec, 
		//then we want last year to be returned
		year = year + "-" + (year + 1);
	} else if (month < 8) {
		year = (year-1) + "-" + year;
	}
	return year;
}

/*list the date of the last day of each tally sheet.
-updated 7/15/08 with new dates
-month is zero-based
-year, month, date, tally sheet name
-the file is named with the month that the dates are entered.
*/
var arTallyMonths = [
["2009","10","6","october_first.doc"],
["2009","11","4","november_second.doc"],
["2010","0","8","december_third.doc"],
["2010","1","5","january_fourth.doc"],
["2010","2","5","february_fifth.doc"],
["2010","3","9","march_sixth.doc"]
];	

//make sure that the new folder "2009-10" has the above tally sheets in them
function getTallySheet(){

	var tallyDate = new Date();
	var sheet = "<a href='EagerReader/2009-10/";
	var today = new Date();
	var i = 0;
	//there are 6 tally sheets per year

	for (i=0; i < arTallyMonths.length; i++){
		tallyDate.setFullYear(arTallyMonths[i][0],arTallyMonths[i][1],arTallyMonths[i][2]);
		tallyDate.setHours(23,59,59);
		if (today < tallyDate){		
			sheet = sheet + arTallyMonths[i][3] + "' target=_blank>Current Eager Reader Tally Sheet</a>";
			break;
		} else {
			//sheet = "";
		}
	}
	return sheet;
}

function getNextTallyDay(){	
	var tallyDate = new Date();
	var str;
	var today = new Date();
	var i = 0;
	//there are 6 tally days per year
	for (i=0; i < arTallyMonths.length; i++){
		tallyDate.setFullYear(arTallyMonths[i][0],arTallyMonths[i][1],arTallyMonths[i][2]);
		tallyDate.setHours(23,59,59);
		if (today < tallyDate){		
			str = tallyDate.toDateString();
			break;
		} else {
			str = "wait for next year!"
		}	
	}
	return str;
}

//global so that other functions can use the dates
//change the 0 to a 1 when the minutes for that meeting are available.
//set these meeting dates each year.  month is zero-based
//I think that they will have to change some of thet board meetings to "general" meetings.
var arMtgDates = [
["2009","8","14","September 14th, Board",1],
["2009","9","12","October 12th, General",1],
["2009","10","16","November 16th, Board",1],
["2009","11","14","December 14th, Board",1],
["2010","0","11","January 11th, Board",1],
["2010","1","8","February 8th, Board",0],
["2010","2","15","March 15th, Board",0],
["2010","3","12","April 12th, General",0],
["2010","4","17","May 17th, Board",0],
["2010","5","7","June 7th, General",0]
];

function getMeetingDate(){
	//list the date of each pta meeting.
	//year, month, date, nice date display
	
	var mtgDate = new Date();
	var str;
	var today = new Date();
	var i = 0;
	//there are 9 meetings per year
	for (i=0; i < arMtgDates .length; i++){
		mtgDate .setFullYear(arMtgDates [i][0],arMtgDates [i][1],arMtgDates [i][2]);
		if (today < mtgDate ){		
			str= "- " + arMtgDates [i][3] + " Meeting";
			break;
		} else {
			str = "";
		}
	}
	return str;
}

/*7/15/08 - probably won't use this as we are discontinuing passport program.
we call pull the calling code for this fx on the programs.asp page.

*/
function getCheckDays(){
	//list the date of the check or recheck
	//year, month, date, check or recheck
	//months are zero based. january = 0, etc...
	var arCheckDays = [
	["2007","9","19","Check Day"],
	["2007","9","26","Re-Check Day"],
	["2007","10","16","Check Day"],
	["2007","10","30","Re-Check Day"],
	["2007","11","14","Check Day"],
	["2008","0","4","Re-Check Day"],
	["2008","0","18","Check Day"],
	["2008","0","25","Re-Check Day"],
	["2008","1","15","Check Day"],
	["2008","1","29","Re-Check Day"],
	["2008","2","20","Check Day"],
	["2008","2","28","Re-Check Day"],
	["2008","3","18","Check Day"],
	["2008","3","25","Re-Check Day"],
	["2008","4","16","Check Day"],
	["2008","4","23","Re-Check Day"]
	];	
	var checkDate = new Date();
	var str;
	var today = new Date();
	var i;

	for (i=0; i < arCheckDays.length; i++){
		checkDate.setFullYear(arCheckDays[i][0],arCheckDays[i][1],arCheckDays[i][2]);
		if (today < checkDate){		
			//str = arCheckDays[i][3] + " " + checkDate.toDateString();
			str = checkDate.toDateString();
			break;
		} else {
			str = "wait for next year!"
		}
	}
	return str;
}


function getMonthName(i){
	var str;
	switch (i) 
	{ 
	   case "0" : 
	      str = "January"; 
	      break; 
	   case "1" : 
	      str = "February"; 
	      break; 
	   case "2" : 
	      str = "March"; 
	      break; 
	   case "3" : 
	      str = "April"; 
	      break; 
	   case "4" : 
	      str = "May"; 
	      break; 
	   case "5" : 
	      str = "June"; 
	      break; 
	   case "6" : 
	      str = "July"; 
	      break;
	   case "7" : 
	      str = "August"; 
	      break; 
	   case "8" : 
	      str = "September"; 
	      break; 
	   case "9" : 
	      str = "October"; 
	      break; 
	   case "10" : 
	      str = "November"; 
	      break; 
	   case "11" : 
	      str = "December"; 
	      break; 
	   default : 
	      str = "not a month"; 
	} 
	return str;
}
function getAllMtgs(){
	/*this fx will get all the items from the getMeetingDate() function 
	if displayLink is 1, then the mtg minutes are ready for posting because
	the secretary has emailed them
	*/
	var i;
	var a1Start = "<a href=docs/mtgMins/" + getSchoolYear() + "/";
	var a2Start = ".doc>";
	var aStart = "";
	var aEnd = "</a>";
	var link;
	var tblStart = "<tr><td align=center>";
	var tblEnd = "</td></tr>"
	var str = tblStart;
	var mtgDate = new Date();
	for (i=0; i < arMtgDates .length; i++){
		mtgDate.setFullYear(arMtgDates [i][0],arMtgDates [i][1],arMtgDates [i][2]);
		if (arMtgDates [i][4] == "1") {
			aStart = a1Start + getMonthName(arMtgDates[i][1]) + a2Start;
			link = aStart + arMtgDates[i][3] + aEnd;
		}
		else {
			link = arMtgDates[i][3];
		}
		str = str + tblStart + link + tblEnd;
	}		
	return str;
}

function FP_preloadImgs() {//v1.0
 var d=document,a=arguments; if(!d.FP_imgs) d.FP_imgs=new Array();
 for(var i=0; i<a.length; i++) { d.FP_imgs[i]=new Image; d.FP_imgs[i].src=a[i]; }
}
//body onload="FP_preloadImgs('/*url goes here, multiple separated by commas*/')"
//-->


