jQuery(document).ready(function() {

  jQuery('.featured-nav').hover(
      function() {
        jQuery('.featured-nav').not(this).removeClass('on');
        jQuery(this).addClass('on');
	jQuery('#photo-box').cycle('pause');

      }, 
      function() {
        jQuery(this).removeClass('on');
	jQuery('#photo-box').cycle('resume');

      }
    );
    
 // jQuery('.featured-nav').click(
 //   function() {
 //     var photoType = this.className.split(' ')[0];
 //     jQuery('.featured-nav.'+photoType).addClass('on'); 
  //    jQuery('.featured-nav').not('.featured-nav.'+photoType).removeClass('on');
     //below assumes the featured nav divs and the photo divs are in the same order
    //  var navIndex = jQuery('.featured-nav').index(this);
   //   jQuery('#photo-box').cycle(navIndex);    
   // 
   //   return false;
  //  });

  jQuery('#photo-box').cycle({
    fx: 'fade',
    timeout: 4000,
    speed: 1500,
    before: photoBoxAfterTransition,
    pause: 1
  });
  
  // clickables
  jQuery('#get-care').click( function() { window.location = '/patient/'; } );
  jQuery('#join-us').click( function() { window.location = '/careers/'; } );
  jQuery('#support-us').click( function() { window.location = '/support/30th-anniversary-gala/'; } );

  // jQuery('#spotlight').click( function() { window.location = '/spotlight/'; } );

//  jQuery('#email-list').click( function() { window.location = 'http://visitor.constantcontact.com/manage/optin?v=001ti8yLLtrqgreAnycIE0N1wdvBeXMLZXh'; } );
//  jQuery('#email-list').click( function() { window.location = 'http://visitor.constantcontact.com/d.jsp?m=1101692149389&p=oi'; } );
  jQuery('#teens').click( function() { window.location = '/teens/'; } );
  
    

});

function photoBoxAfterTransition() { 
//window.console.log( this.className );
var photoType = this.className.split(' ')[0];
//window.console.log(photoType);
jQuery('.featured-nav.'+photoType).addClass('on');
jQuery('.featured-nav').not('.featured-nav.'+photoType).removeClass('on');
// alert('className: ' + jQuery('.staff.featured-nav-photo')[0].className );
} 

