/**
 * JS file for slideshow
 */

(function($) {
  Drupal.behaviors.slideshow = {
    attach : function(context, settings) {
      $(window).load(function() {
        var slideshows = $(".field-name-field-rank-page-media, .field-name-field-rank-article-media, .field-name-field-rank-event-venue-media, .field-name-field-rank-calendar-event-media, .field-name-field-rank-member-media", context);
        slideshows.each(function(){
          if ($('> .field-items > div', this).length > 1) {
            $(this).append(Drupal.theme('slideshowControls'));
            $('.field-items', this).cycle({
              fx: 'fade',
              next: '.slideshow-controls a.next-slide',
              prev: '.slideshow-controls a.prev-slide',
              timeout: 5000,
              pause: 1
            });
          }
        });

      });
    }
  };

  Drupal.theme.prototype.slideshowControls = function() {
    var html = [];
    html.push('<div class="slideshow-controls-bottom">');
      html.push('<div class="slideshow-controls" style="position:relative; height:40px;">');
        html.push('<a class="prev-slide">föregående</a><a class="next-slide">nästa</a>');
      html.push('</div>');
    html.push('</div>');

    return html.join('');
  };
})(jQuery);
;
(function($) {

/*
  Drupal.behaviors.easyListSplitter = {
    attach : function(context, settings) {
      $('.pane-menu-menu-lu-navigation-secondary ul.menu', context).easyListSplitter({
        colNumber: 3,
        direction: 'horizontal'
      });
    }
  }


  Drupal.behaviors.precolumnize = {
    attach : function(context, settings) {
      $(".footer-title", context).each(function(){
        var $title = $(this);
        $($title).parent().find(".item-list  li.first").each(function(){
          var $lifirst = $(this);
          $title.wrap('<div class="footer-title-wrap" />').after("<ul><li>" + $lifirst.html() + "</li></ul>");
          $lifirst.remove();
        });
      });
    }
  }

  Drupal.behaviors.columnize = {
    attach : function(context, settings) {
      $('#lu-footer-columnize-me', context).columnize({
				columns: 4,
        dontsplit: "div.footer-title-wrap"
			})
    }
  }
*/



  Drupal.behaviors.rankBodyImageFloat = {
    attach : function(context, settings) {
      $('body.node-type-rank-article', context).each(function() {
        if (!$('.field-name-field-rank-article-body > .field-items .field-item > p > img', this).hasClass('media-image-right') &&
            $('.field-name-field-rank-article-body > .field-items .field-item > p > img', this).hasClass('media-image')) {
          $('.field-name-field-rank-article-body > .field-items .field-item > p').css({'clear':'both', 'margin':'0'});
        }
      });
    }
  }


/*
   Drupal.behaviors.staticPromosHeight = {
    attach : function(context, settings) {
      var i = 0;
      $('.field-name-field-lu-static-promo > .field-items > .field-item.even', context).each(function() {
        var even_height = $(this).height();
        var odd_height = $(this).siblings('.odd').eq(i).height();
        var height = even_height > odd_height ? even_height : odd_height;
        $(this).attr('style', 'height: ' + height + 'px');
        $(this).siblings('.odd').eq(i).attr('style', 'height: ' + height + 'px');
        i++;
      })
    }
  }
*/
})(jQuery);
;

