/**
 * @note Application level jQuery and/or javascript code
 */
jQuery(document).ready(function() {
  /**
   * @note Display a temporary notice to IE users that the site is not ready for them just yet.
   */
  /*if(jQuery.browser.msie && jQuery.browser.version >= "7.0") {
    alert("ATTENTION: This website is not yet optimized for display in Internet Explorer (IE).  For now, please choose another web browser to view this page such as Firefox, Opera, Safari or Google Chrome.");
  }*/
  
  /**
   * @note Green Tips
   */
  jQuery('#green-tip #tips').cycle({
    fx: 'fade',
    timeout: 7000,
    speed: 2000
  });
  
  /**
   * @note Sponsors
   */
  jQuery('#sponsors #sponsor').cycle({
    fx: 'fade',
    timeout: 500,
    speed: 2000
  });
  
  /**
   * @note Equalize column heights on home page events and mission
   */
  // set the tour section container boxes to equal heights
  jQuery('#cta-events .callout').equalHeights();
  
  /**
   * @note Randomly swap put the background image of the page header
   */
  // initialize some vars
  var imgPathMain = '/img/main/';
  var url         = window.location;
  var path        = url.pathname;
  var randNum     = Math.floor(Math.random()*2);
    
  // if this is the home page
  if (path == '/') {
    // change the background image based on two (2) images
    jQuery('#top').css({
      'background-image': 'url(' + imgPathMain + 'top-img_' + randNum + '.jpg)'
    });
  // all other pages...
  } else {
    // change the background image based on four (4) images
    var randNum = Math.floor(Math.random()*4);
    jQuery('#top').css({
      'background-image': 'url(' + imgPathMain + 'top-img-inner_' + randNum + '.jpg)'
    });
  }
  
});
