/* New D7 Wrapper --> */(function ($) {

Drupal.behaviors.dcpl = {
  attach: function(context, settings) { //new attach function
    $("a").not('[href^="http://overdrive"]').not('[href^="http://catalog.dclibrary"]').not('[href^="http://dclibrary05.libsyn.com"]').filter(function() {
      return this.hostname &&
             this.hostname.replace(/^www\./, '') !==
                location.hostname.replace(/^www\./, '');
    }).each(function() {
       if($(this).attr('href').indexOf('catalog.dclibrary.org') == -1) { 
         $(this).attr({
             target: "_blank"
          }); //             title: "Visit " + this.href + " (click to open in a new window)"
        }
    });
    if($('body.page-calendar-month').length) {
      var $calendarPane = $('.view-library-calendar .attachment-after .calendar-calendar .month-view table tbody tr td .inner');
      $calendarPane.each(function(){
        if($(this).children().size() == 2 && !$(this).find('div.calendar-empty').length) {
          //console.log($(this));
          $(this).addClass('single-entry');
        }
        for(var $i=4; $i < $(this).children().size(); $i++) {
          $(this).find('.view-item').eq($i-1).hide();
        }
      });
      $calendarFields = $('.view-library-calendar .attachment .calendar-calendar .month-view tbody td .view-item .calendar');
      $calendarFields.each(function() {
        $(this).find('.view-field').eq(1).hide();
        $(this).find('.view-field').eq(2).hide();
        $(this).find('.view-field').eq(3).hide();
      });
      //if()
    } 
  }//attach
};//behaviors

/* New D7 Wrapper --> */ })(jQuery);
;

