
//COUNTDOWN.js
//by Andrew Willett for Team New York Aquatics
//
//MAIN FUNCTION
//to provide a live countdown to some arbitrary event (usually a meet).

//first, establish today's date. 
	today = new Date() ; 
	
// then take the new date passed by the document and call it 'meet'.
	function DaysTill(mo,dy,yr) {
		meet = new Date() ;
		meet.setFullYear(yr) ;
		meet.setMonth(mo - 1) ;
		meet.setDate(dy) ;

// find the days remaining before the meet. 		
		difference = meet.getTime() - today.getTime() ;
		difference = Math.floor(difference/(1000*60*60*24)) ;

//pass that value back to whomever requests it.
		return difference ;
	}

//print-me function writing the DaysTill number in place. if the date has passed, say "0."
	function WriteDaysTill(mo,dy,yr) {
		if (DaysTill(mo,dy,yr) > 0) {
			document.write(DaysTill(mo,dy,yr));
		} else document.write('0') ;
	}
