document.write(todaysHours());

function todaysHours(){
	var today = new Date();
	var month = today.getMonth() + 1;
	var dayofweek = today.getDay() + 1;
	var date = today.getDate();
	var year = today.getFullYear();
	
	var monthArray = new Array(" ", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
	var monthLetters = monthArray[month];
	  today = new Date(monthLetters + " " + date + ", " + year);
	
	var hours ;
	
	var closed = 	 ("Closed");
	var hours7to7 =  ("7:00 am - 7:00 pm");
	var hours7to9 =  ("7:00 am - 9:00 pm");
	var hours7to10 = ("7:00 am - 10:00 pm");
	var hours7to11 = ("7:00 am - 11:30 pm");
	var hours8to6 =  ("8:00 am - 6:00 pm");
	var hours9to7 =  ("9:00 am - 7:00 pm");
	var hours9to9 =  ("9:00 am - 9:00 pm");
	var hours9to10 = ("9:00 am - 10:00 pm");
	var hours9to11 = ("9:00 am - 11:30 pm");
	var hours10to6 = ("10:00 am - 6:00 pm");
	var hours10to10 = ("10:00 am - 10:00 pm");
	
	var fallsem = new Date("August 13, 2008");
	var winterbreak = new Date("December 23, 2008");
	var springsem = new Date("January 5, 2009");
	var summer = new Date("May 25, 2009");
	
	//Choose correct semester
	if(today >= fallsem && today < winterbreak)
		fallhours();
	else if(today >= winterbreak && today < springsem)
		winterhours();
	else if(today >= springsem && today < summer)
		springhours();
	else if(today >= summer)
		summerhours();
	
	function fallhours(){
		if(dayofweek == 1)
			hours = hours9to11;
		else if(dayofweek > 1 && dayofweek < 6)
			hours = hours7to11;
		else if(dayofweek == 6)
			hours = hours7to10;
		else if(dayofweek == 7)
			hours = hours9to10;
		
		//Labor Day Weekend--2008
		if(month == 9 && date == 1)
			hours = hours7to9;
		else if(month == 9 && (date == 2 || date == 3))
			hours = hours9to9;
		else if(month == 9 && date ==4)
			hours = hours10to10;
			
		//Thanksgiving Hours--2008
		if(month == 11 && date == 21)
			hours = hours7to9;
		else if(month == 11 && date == 22)
			hours = hours7to7;
		else if(month == 11 && date == 23)
			hours = closed;
		else if(month == 11 && (date == 24 || date ==25))
			hours = hours10to6;
		else if(month == 11 && (date == 26))
			hours = hours10to10;	
	}
	
	function winterhours(){
		if(dayofweek == 1)
			hours = closed;
		else if(dayofweek > 1 && dayofweek < 7)
			hours = hours7to7;
		else if(dayofweek == 7)
			hours = closed;
			
		//Exceptions--2006/2007
		if(month == 12 && date == 25)
			hours = closed;
		if(month == 12 && (date > 25 && date < 30))
			hours = hours8to6;
		if(month == 1 && date == 1)
			hours = closed;
		if(month == 1 && (date > 1 && date <6))
			hours = hours8to6;
		if(month == 1 && (date == 6 || date == 7))
			hours = hours10to6;	
	}
	
	function springhours(){

		if(dayofweek == 1)
			hours = hours9to11;
		else if(dayofweek > 1 && dayofweek < 6)
			hours = hours7to11;
		else if(dayofweek == 6)
			hours = hours7to10;
		else if(dayofweek == 7)
			hours = hours9to10;
		
		//MLK--2009
		if(month == 1 && date == 17)
			hours = hours9to9;
		if(month == 1 && date == 18)
			hours = hours9to9;
		if(month == 1 && date == 19)
			hours = hours10to10;
			
		//Spring Break--2009
		if(month == 3 && date == 13)
			hours = hours7to7;
		else if(month == 3 && (date == 14 || date == 15))
			hours = hours10to6;
		else if(month == 3 && (date > 15 && date < 21))
			hours = hours7to7;
		else if(month == 3 && (date == 21 || date == 22))
			hours = hours10to6;
					
		//Easter Break--2008
		else if(month == 4 && (date == 10 || date == 11))
			hours = hours10to6;
		if(month == 4 && date == 12)
			hours = closed;

	}
	//summerhours for 2007
	function summerhours(){
		if(dayofweek == 1)
			hours = hours9to6;
		else if(dayofweek > 1 && dayofweek < 6)
			hours = hours7to9;
		else if(dayofweek == 6)
			hours = hours7to7;
		else if(dayofweek == 7)
			hours = hours9to5;
			
			
	//Memorial Day--2008
		if(month == 5 && date == 23)
			hours = hours7to7;
		if(month == 5 && (date > 23 && date < 27))
			hours = hours10to6;
			
		//July 4th - 2007
		if(month == 7 && date == 3)
			hours = hours7to7;
		else if(month == 7 && date == 4)
			hours = hours10to6;
	}
	
	return ("Library Hours Today: " + hours);
}