function setHoursInformation() { document.getElementById('hours_today').innerHTML = todaysHoursString(); document.getElementById('hours_tomorrow').innerHTML = tomorrowsHoursString(); document.getElementById('more_hours_1').innerHTML = dateXHoursString( dateXDaysOut(2) ) document.getElementById('more_hours_2').innerHTML = dateXHoursString( dateXDaysOut(3) ) document.getElementById('more_hours_3').innerHTML = dateXHoursString( dateXDaysOut(4) ) } function toggleMoreHourInfo() { setHoursInformation(); if (document.getElementById('more_hours_1').style.display == 'block') { // more hours are showing; hide them document.getElementById('more_hours_1').style.display = 'none' document.getElementById('more_hours_2').style.display = 'none' document.getElementById('more_hours_3').style.display = 'none' document.getElementById('hide_show_hours_text').innerHTML = '+hours' } else { // more hours are hidden; show them document.getElementById('more_hours_1').style.display = 'block' document.getElementById('more_hours_2').style.display = 'block' document.getElementById('more_hours_3').style.display = 'block' document.getElementById('hide_show_hours_text').innerHTML = '-hours' } } function todaysHoursString() { if (typeof(customHoursStringForDate( today() )) != "undefined") { return customHoursStringForDate( today() ) } return "Open today " + standardHoursForWeekday( today() ) } function tomorrowsHoursString() { if (typeof(customHoursStringForDate( tomorrow() )) != "undefined") { return customHoursStringForDate( tomorrow() ) } return "Open tomorrow " + standardHoursForWeekday( tomorrow() ) } function dateXHoursString(date) { if (typeof(customHoursStringForDate( date )) != "undefined") { return customHoursStringForDate( date ) } return weekdayHoursString(date) } function weekdayHoursString(date) { var days = [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ] var dayName = days[ date.getDay() ] return 'Open ' + dayName + ' ' + standardHoursForWeekday( date ) } function standardHoursForWeekday(date) { if (date.getDay() == 0) return "8a to 6p" if (date.getDay() == 1) return "6:30a to 8p" if (date.getDay() == 2) return "6:30a to 8p" if (date.getDay() == 3) return "6:30a to 8p" if (date.getDay() == 4) return "6:30a to 8p" if (date.getDay() == 5) return "6:30a to 8p" if (date.getDay() == 6) return "6:30a to 6p" return '' } function customHoursStringForDate(date) { return undefined } function dateFromString(str) { var date = new Date() var pieces = str.split('-') date.setYear(Number(pieces[0])) date.setMonth(Number(pieces[1])-1) date.setDate(Number(pieces[2])) return date } function dateString(date) { var day = date.getDate() var month = date.getMonth() + 1 var year = date.getFullYear() if (month < 10) month = '0' + month if (day < 10) day = '0' + day return( year + '-' + month + '-' + day ) } function today() { return new Date() } function tomorrow() { var date = new Date() date.setDate( date.getDate()+1 ) return date } function dateXDaysOut(x) { var date = new Date() date.setDate( date.getDate()+x ) return date }