(function ($) {
  Drupal.behaviors.olympusSlideshow = {
    attach: function(context) {
    //jquery.cycle used for front page slideshow
       //http://jquery.malsup.com/cycle/
      $('#block-views-slideshow-front-page-slideshow .view-content')
      .after('<div id="slide-nav">')
      .cycle({
        //fx: 'scrollDown'
        timeout: 6000,
        fx:      'fade',
        pager: '#slide-nav',
        speed: 500,
        pause: 1

      });
      
      // replacing the default numbering added by jquery.cycle pager method to blank
      // so my squares can bee see through.
      $('#slide-nav a').html('&nbsp;');
      
      //make the entire text block in the slideshow a link
      $('.slide-text').click(function() {
        var page = $(this).find('.field-name-field-link a').attr('href');
        if (page) {
          window.location = page; 
        }
      });
      
      if ($.browser.msie) {
        if ($.browser.version <= 8.0) {
          
        $('.slide-text.black-style, .slide-text.white-style').css('opacity', '0.8');

        $('.slide-text.black-style').hover(function() {
        $(this).css({
          'opacity' : '1',
          'cursor' : 'pointer'
          });
      }, function() {
        $(this).css({
            'opacity' : '0.8'
        });
      });
      
      $('.slide-text.white-style').hover(function() {
        $(this).css({
          'opacity' : '1',
          'cursor' : 'pointer'
          });
      }, function() {
        $(this).css({
            'opacity' : '0.8'
        });
      });
      
        }
      }
      else {
      
      $('.slide-text.black-style').hover(function() {
        $(this).css({
          'background' : 'rgba(0, 0, 0, 1)',
          'cursor' : 'pointer'
          });
      }, function() {
        $(this).css({
          'background' : 'rgba(0, 0, 0, 0.8)'
        });
      });
      
      $('.slide-text.white-style').hover(function() {
        $(this).css({
          'background' : 'rgba(255, 255, 255, 1)',
          'cursor' : 'pointer'
          });
      }, function() {
        $(this).css({
          'background' : 'rgba(255, 255, 255, 0.8)'
        });
      });
      
      }
      
    }
  };
})(jQuery);;

