$(function(){
  // adds and removes search text
  $('#site-search input[type="text"]').focus(function(){
    $(this).filter(function(){
      return $(this).val() === '' || $(this).val() === 'Search';
    }).val('');
  }).blur(function(){
    $(this).filter(function(){
      return $(this).val() === '';
    }).val('Search');
  });
  
  // news & events tabs
  $('#events-news').tabs();
  
  // Cycle the home tabs
    $('#promo-tabs-container') 
      .after('<ul id="promo-tabs-selectors">') 
      .cycle({ 
        cleartype:  1, 
        timeout: 8000, 
        effect: 'fade',
        speed: 500,
        pause: true,
        pager:  '#promo-tabs-selectors',
        pagerEvent:   'click',
        pagerAnchorBuilder: function(idx, slide) { 
          return '<li class="' + jQuery(slide).attr("id") + 1 + ' "><a href="#">' + jQuery(slide).find("div.tab-text").html() + '</a></li>'; 
        }
    });

    $('#promo ul').hover(function(){
      $('#promo-tabs-container').cycle("pause");
      }, function(){
      $('#promo-tabs-container').cycle("resume");
    });
});




$(document).ready(function() {
  
//er wait time 'mins' to 'min'
  
jQuery('.er-wait-time span.time').each(function(){
  var er_time = jQuery(this).text();
  jQuery(this).html(er_time.replace('Mins','<span>min</span>'));
});
  

});
