
// List holidays and closed dates for Library below //


var myHolidays = new Array("5/29", "5/30", "5/31", "7/3", "7/4", "7/5", "8/20", "9/4", "9/5", "9/6", "11/5", "11/25", "12/24", "12/25", "12/26", "12/31", "1/1", "1/2");

  
$(document).ready(function(){
  // Date Functions
	$reghours = "open from 9am - 9pm";
	$shorthours = "open from 9am - 6pm";
	$sunhours = "closed for the day.";
  
	$dname = (Date.today().toString('ddd')).toLowerCase();
	$("#" + $dname).addClass("dweeksel");
	
	$dtext = Date.today().toString('MMMM d, yyyy');
	
	
	$toddate = Date.today();
	//$toddate = Date.parse("6/14/2009");
	if (check_closed($toddate)) {
		$dtext += ": The library is closed for the day.";
	} else {
		$dtext += ": We are ";
		if ($dname == "sun") {
			$dtext += $sunhours;
		} else if ($dname == "fri") {
			$dtext += $shorthours;
		} else if ($dname == "sat") {
			$dtext += $shorthours;
		} else {
			$dtext += $reghours;
		}
	}
		$("#dtime").html($dtext);
  });

function check_closed(dt_date) {
	dfound = false;
	// check simple dates (month/date - no leading zeroes)
		var n_date = dt_date.getDate(),
		n_month = dt_date.getMonth() + 1;
		var s_date1 = n_month + '/' + n_date;
		
	for (i=0; i<= myHolidays.length+1; i++) {
		//done = Date.parse(myHolidays[i])
		if (s_date1 == myHolidays[i]) {
			dfound = true;
			break;
		};
	}
	if (dfound) {
		return true;
	} else {
		return false;
	}

}  
  
  