/* Night & Day Style Switcher
 * --------------------------
 * By Rome Reginelli
 * function setActiveStyleSheet() thanks to Paul Sowden's ALA article:
 *      http://www.alistapart.com/stories/alternate/
 */

function setActiveStyleSheet(title) {
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
     if(a.getAttribute("rel").indexOf("style") != -1
        && a.getAttribute("title")) {
       a.disabled = true;
       if(a.getAttribute("title") == title) a.disabled = false;
     }
   }
}

function isNight() {
    var timenow = new Date();
    var hours = timenow.getHours();
    return (hours >= 17 || hours < 8);
}

function pickSheet() {
    if (isNight()) { setActiveStyleSheet("night"); }
}

pickSheet();