function lighthouse_dateChanging() { $('.events').fadeOut(); var abbr = $('#whats-on .datestamp abbr'); abbr.css('position', 'absolute'); abbr.parent().css('overflow', 'hidden'); abbr.parent().css('position', 'relative'); abbr.parent().css('height', abbr.height() + 'px'); abbr.animate( { top: abbr.height() + 'px' }, 200 ); } function lighthouse_dateChanged(date) { var url = 'http://light-house.co.uk/wp-content/themes/lighthouse/front-ajax.php?lh_d=' + date; var dateObj = new Date(date * 1000); var abbr = $('#whats-on .datestamp abbr'); $.ajax( { url: url, dataType: 'html', success: function(data) { $('.events').html(data); $('.events').fadeIn(); text = dateObj.toDateString().split(' '); abbr.attr('title', dateObj); abbr.find('span.day-name').html(text[0]); abbr.find('span.day-number').html(text[2]); abbr.find('span.month-name').html(text[1]); abbr.css('top', '-' + abbr.height() + 'px'); abbr.animate( { top: 0 }, 200 ); } } ); } nowshowing_setHook('dateChanging', lighthouse_dateChanging); nowshowing_setHook('dateChanged', lighthouse_dateChanged);