// Conn Library 2009 Hours
//Written by William Van Arsdale for Wayne State College Library
//Modified by Alex Smith on 11/17/2008
// Purpose: Displays the day's current hours

function writeHours() {
  
  var cDate = new Date();
  var cDay = cDate.getDate(); // Day of the month
  var cDOW = cDate.getDay();  // Day of the week, 0=Sunday
  var cMonth = cDate.getMonth(); // Month number, 0=January
  var cYear = cDate.getFullYear();  // 4-digit year
  var strHours = "";
 
 // Trap for current year
 
 if(cYear == 2009) {
 
   // Set default hours based on day of the week
 
   if( cDOW == 0 ) {
     strHours = "3:00 PM to Midnight"; 
   } else if( cDOW >= 1 && cDOW <=4 ) {
     strHours = "7:30 AM to Midnight"; 
   } else if( cDOW == 5 ) {
     strHours = "7:30 AM to 5:00 PM"; 
   } else if( cDOW == 6 ) {
     strHours = "1:00 PM to 6:00 PM";
   } else {
     strHours = "Err 1" };  // error trap for unknown DOW
   
   
   // Adjust for exceptions
   
    if( cMonth == 0 ) { // January
	  if( cDay == 1 ) {
	    strHours = "Closed";
	  } else if(cDay == 2 ) {
		  strHours= "Closed";
	  } else if( cDay >= 3 && cDay <= 4 ) {
		  strHours = "Closed";
	  } else if( cDay >= 10 && cDay <= 11 ) {
	      strHours = "Closed";
	  } else if( cDay == 5 ) {
	      strHours = "8:00AM to 5:00PM";
	  } else if(cDay == 6 ) {
		  strHours = "10:00AM to 5:00PM";
	  } else if(cDay >= 7 && cDay <= 9 ) {
		  strHours = "8:00AM to 5:00 PM";
	  }
	}

    if( cMonth == 1) { // February
	}

    if( cMonth == 2 ) {  // March
      if( cDay >= 7 && cDay <= 8 ) {
        strHours = "Closed"; 
	  } else if( cDay >= 9 && cDay <= 13 ) {
 	    strHours = "8:00 AM to 5:00 PM";
	  } else if( cDay == 14 ) {
	    strHours = "Closed"; 
	  }
    }
	
	if(cMonth == 3 ) { //April
	  if( cDay >= 11 && cDay <=12 ) {
	    strHours = "Closed";
	} else if( cDay >= 20 && cDay <= 23) {
		 strHours = "7:30AM to 1:00AM";
	} else if(cDay >= 27 && cDay <= 30 ) {
		 strHours = "7:30AM to 1:00AM";
	} else if(cDay ==26) {
		 strHours = "3:00PM to 1:00AM";
	} else if(cDay == 13) {
		srtHours = "8:00AM to Midnight";
	}
}

    if ( cMonth == 4 ) { //May
	  if ( cDay == 1 ) {
	    strHours = "7:30 AM to 5:00 PM";
	  } else if ( cDay == 2 ) {
	    strHours = "1:00 PM to 6:00 PM";
	  } else if (cDay == 3 ) {
		strHours = "3:00 PM to 1:00 AM";
	  } else if (cDay >=4 && cDay <=7 ) {
		strHours = "7:30 AM to 1:00 AM";
	  } else if (cDay >=11 && cDay <=14 ) {
		strHours = "7:00 AM to 7:30 PM";
	  } else if (cDay >=18 && cDay <=21 ) {
		strHours = "7:00 AM to 7:30 PM";
	  } else if (cDay >=25 && cDay <=28 ) {
		strHours = "7:00 AM to 7:30 PM";
	  } else if (cDay == 15 || cDay == 22 || cDay == 29 ) {
		strHours = "7:00 AM to 4:00 PM";
	  } else if (cDay == 9 || cDay == 10 || cDay == 16 || cDay == 23 || cDay == 30 || cDay == 17 || cDay == 24 || cDay == 31 || cDay == 25 ) {
		strHours = "Closed";
	  }
	}
	
	if ( cMonth == 5 ) { //June
	  if ( cDOW == 0 ) {
	    strHours = "Closed";
	  } else if ( cDOW >= 1 && cDOW <= 3 ) {
	    strHours = "7:00 AM to 7:30 PM";
	  } else if ( cDOW == 4 ) {
	  	strHours = "7:00 AM to 6:00 PM";
	  } else if ( cDOW == 5 ) {
	    strHours = "7:00 AM to 1:30 PM";
	  } else if ( cDOW == 6 ) {
	    strHours = "Closed";
	  }
	};

    if ( cMonth == 6 ) { //July
	  if ( cDay == 3 ) {
	    strHours = "7:30 AM to 4:00 PM";
	  } else if ( cDay == 4 ) {
	    strHours = "Closed";
	  } else if ( cDOW == 0 ) {  //Summer Hours
	    strHours = "Closed";
	  } else if ( cDOW >= 1 && cDOW <= 3 ) {
	    strHours = "7:00 AM to 7:30 PM";
	  } else if ( cDOW == 4 ) {
	    strHours = "7:00 AM to 6:00 PM";
	  } else if ( cDOW == 5 ) {
	    strHours = "7:00 AM to 1:30 PM";
	  } else if ( cDOW == 6 ) {
	    strHours = "Closed";
	  } else {
	    strHours = "Error";
	  }
	};
	
	  
	if ( cMonth == 7 ) { // August
	  if( cDay >= 4 && cDay <=8 ) {
	    if ( cDOW == 0 ) {
		  strHours = "Closed";
		} else if ( cDOW >= 1 && cDOW <= 2 ) {
		  strHours = "7:00 AM to 7:30 PM";
		} else if ( cDOW >= 3 && cDOW <= 4 ) {
		  strHours = "7:00 AM to 4:00 PM";
		} else if ( cDOW == 5 ) {
			strHours = "7:00 AM to 1:30 PM";
		} else if ( cDOW == 6 ) {
		  strHours = "Closed";
		}
	  } else if (cDay >= 9 && cDay <= 23 ) {
	    if ( cDOW == 0 ) {
		  strHours = "Closed";
		} else if ( cDOW >= 1 && cDOW <= 5 ) {
		  strHours = "7:30 AM to 5:00 PM";
		} else if ( cDOW == 6 ) {
		  strHours = "Closed";
		} 
	  } else if ( cDay >= 24 && cDay <= 31 ) {
		if (cDOW ==0 ) {
		  strHours = "3:00 PM to Midnight";
	    } else if ( cDOW >= 1 && cDOW<=4 ) {
		  strHours = "7:30 AM to Midnight";
		} else if ( cDOW == 5 ) {
		  strHours = "7:30 AM to 5:00 PM";
		} else if ( cDOW == 6 ) {
		  strHours = "1:00 PM to 6:00 PM";
	   }
	  }
	};  

    if( cMonth == 8 ) {  // September
      if( cDay >=5 && cDay <= 7 ) {
        strHours = "Closed"; 
	  }
    }

    if( cMonth == 9 ) {  // October
      if( cDay >= 17 && cDay <= 18 ) {
        strHours = "Closed"; 
	  } else if( cDay == 20 ) {
 	    strHours = "8:00 AM to 5:00 PM";
	  }
    }
	  
    if( cMonth == 10 ) {  // November
      if( cDay >= 16 && cDay <= 19 ) {
		  strHours = "7:15AM to Midnight";
	  } else if ( cDay == 24 ) {
		strHours = "7:30 AM to 5:00 PM";
	  } else if ( cDay == 25 ) {
		strHours = "7:30 AM to 5:00 PM";
	  } else if ( cDay >= 26 && cDay <= 28 ) {
		strHours = "Closed";
	  }
	}
	  
  
	if( cMonth == 11 ) { // December  
	  if( cDay >= 1 && cDay <=18 )  {
	    if( cDOW == 0 ) { //Extended hours for finals
		  strHours = "3:00 PM to 1:00 AM"; 
		  } else if( cDOW >= 1 && cDOW <=4 ) {
            strHours = "7:30 AM to 1:00 AM"; 
	      } else if( cDOW == 5 ) {
            strHours = "1:00 PM to 6:00 PM"; 
          } else if( cDOW == 6 ) {
            strHours = "3:00 PM to 1:00 AM";
		  }
	    } else if( cDay >= 19 && cDay <=24 ) {
		  if( cDOW == 0 ) { //Short Hours Post-finals
		    strHours = "Closed"; 
		    } else if( cDOW >= 1 && cDOW <=2 ) {
              strHours = "8:00 AM to 5:00 PM"; 
	        } else if( cDOW >= 3 && cDOW <= 5 ) {
              strHours = "Closed"; 
            } else if( cDOW == 6 ) {
              strHours = "Closed";
		    }
		  } else {
		    strHours = "Reopening Jan. 4";
		  }
		}
	  
 } else {
   strHours="Reopening Jan. 4"  // error trap for incorrect year
 }
//   document.write("Date = " + cDay +"<br>Month = " + cMonth + "<br>Year = " + cYear + "<br>Day of Week = " + cDOW + "<br>");
  document.write(strHours);
}

writeHours();
//updated to this point by Alex Smith on 07/09/2008
<!-- end script -->