//javascript




function getCountdown (month, day, year, count, endMonth, endDay, endYear, cat) {
/*
Annual Occasions Count Down script- By JavaScript Kit
For this and over 400+ free scripts, visit http://www.javascriptkit.com
This notice must stay intact
*/

var today=new Date()

//Enter the occasion's MONTH (1-12) and DAY (1-31):
var theoccasion=new Date(year, month, day)
var endTheoccasion = new Date(endYear, endMonth, endDay)

//Customize text to show before and on occasion. Follow grammer below:
var beforeOccasionText="Countdown till Season Opener: "
var afterOccasionText="<b>Season Open!</b> "
var onOccasiontext="Season Opens Today!"

var monthtext=new Array("Jan","Feb","Mar","April","May","June","July","Aug","Sep","Oct","Nov","Dec")
theoccasion.setMonth(theoccasion.getMonth()-1) //change to 0-11 month format
endTheoccasion.setMonth(endTheoccasion.getMonth()-1) //change to 0-11 month format
var showdate="("+monthtext[theoccasion.getMonth()]+" "+theoccasion.getDate()+")" //show date of occasion

var one_day=1000*60*60*24
var calculatediff=""
var endCalculatediff = ""
var bpassed = 0;

calculatediff=Math.ceil((theoccasion.getTime()-today.getTime())/(one_day))
if (calculatediff<0){ //if bday already passed
	bpassed = 1;
	endCalculatediff=Math.ceil((endTheoccasion.getTime()-today.getTime())/(one_day))
	var endPluraldayornot=(endCalculatediff==1)? "day" : "days"
	if (endCalculatediff>0) {
		document.getElementById('count'+count).className = 'no_top_marg_open';
		document.getElementById(cat).className = 'season_open';
	//document.write("<b>"+calculatediff+" "+pluraldayornot+" "+beforeOccasionText+" "+showdate+"</b>")
		document.write(afterOccasionText+" "+endCalculatediff+" "+endPluraldayornot+" until close")
	
	}
	else if (endCalculatediff==0) {
	document.getElementById('count'+count).className = 'no_top_marg_open';
	document.getElementById(cat).className = 'season_open';
	document.write("<b>"+onOccasiontext+" "+showdate+"</b>")
	}
	else if (endCalculatediff<0) {
	//callculate how many days left in season or if season closed
	var nextyeartoday=new Date()
	nextyeartoday.setFullYear(today.getFullYear()+1)
	calculatediff=Math.ceil((nextyeartoday.getTime()-today.getTime())/(one_day)+calculatediff)
	}
}
//Display message accordingly
var pluraldayornot=(calculatediff==1)? "day" : "days"
if (calculatediff>0) {
	if (calculatediff<=14) {
	document.getElementById('count'+count).className = 'no_top_marg_soon';
		
	beforeOccasionText="<b>Countdown till Season Opener:</b> "
	document.write(beforeOccasionText+" "+calculatediff+" "+pluraldayornot+"</b>")
	} 
	else {
		document.getElementById('count'+count).className = 'no_top_marg_closed';
		document.write("<em>"+beforeOccasionText+" "+calculatediff+" "+pluraldayornot+"</em>")
	}
	//document.write("<b>"+calculatediff+" "+pluraldayornot+" "+beforeOccasionText+" "+showdate+"</b>")
	
	
	}
else if (calculatediff==0) {
	document.getElementById('count'+count).className = 'no_top_marg_open';
	document.getElementById(cat).className = 'season_open';
	document.write("<b>"+onOccasiontext+" "+showdate+"</b>")
}

}







