(function($){Drupal.behaviors.image_caption={attach:function(context,settings){$("img.caption:not(.caption-processed)").each(function(i){var imgwidth=$(this).width()?$(this).width():false;var imgheight=$(this).height()?$(this).height():false;var captiontext=$(this).attr('title');if($(this).attr('align')){var alignment=$(this).attr('align');$(this).css({'float':alignment});$(this).removeAttr('align');}else if($(this).css('float')){var alignment=$(this).css('float');}else{var alignment='normal';}
var style=$(this).attr('style')?$(this).attr('style'):'';$(this).removeAttr('width');$(this).removeAttr('height');$(this).css('width','');$(this).css('height','');$(this).removeAttr('align');$(this).removeAttr('style');$(this).wrap("<span class=\"image-caption-container\" style=\"display:inline-block;"+style+"\"></span>");$(this).parent().addClass('image-caption-container-'+alignment);if(imgwidth){$(this).width(imgwidth);$(this).parent().width(imgwidth);}
if(imgheight){$(this).height(imgheight);}
$(this).parent().append("<span style=\"display:block;\" class=\"image-caption\">"+captiontext+"</span>");$(this).addClass('caption-processed');});}};})(jQuery);;

(function ($) {

Drupal.behaviors.shortener = {
  attach: function (context) {
    //Make sure we can run context.find().
    var ctxt = $(context);
    ctxt.find('.shortener-link').not('.shortener-strict').each(function() {
      $(this).after('<a class="shortener-toggle">'+ ($(this).hasClass('shortener-short') ? Drupal.t('expand') : Drupal.t('shorten')) +'</a>');
    });
    ctxt.find('.shortener-toggle').click(function() {
      $a = $(this).prev();
      var newURL = $a.attr('title');
      var oldURL = $a.attr('href');
      $a.attr('title', oldURL);
      $a.attr('href', newURL);
      var urlLen = $a.attr('class').split(' ')[0].split('-')[2];
      if (urlLen && newURL.length > urlLen) {
        newURL = newURL.substring(0, urlLen-1) + '&hellip;';
      }
      $a.html(newURL);
      if ($a.hasClass('shortener-short')) {
        $(this).html(Drupal.t('shorten'));
      }
      else {
        $(this).html(Drupal.t('expand'));
      }
      $a.toggleClass('shortener-short shortener-long');
    });
  }
}

})(jQuery);
;

