$(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");
    });
});


$(function(){  
      // Pop Up for Health Assessments  
    jQuery('#HealthAssessments').popupWindow({
        centerBrowser:1, // center window over browser window? 
        centerScreen:0, // center window over entire screen? 
        height:528, // sets the height in pixels of the window.
        location:0, // determines whether the address bar is displayed 
        menubar:0, // determines whether the menu bar is displayed 
        resizable:0, // whether the window can be resized 
        scrollbars:0, // whether scrollbars appear on the window 
        status:0, // whether a status line appears at the bottom of the window 
        width:864, // sets the width in pixels of the window.
        windowName:"Online Heart Health Assessment", // name of window 
        toolbar:0 // whether a toolbar (includes the forward and back buttons) is displayed      
     });
});

