Drupal.behaviors.roblib_search_islandscholar = { attach: function (context, settings) { url = settings.roblib_search_islandscholar.search_url; jQuery.getJSON(url, function (data) { var items = []; var numberOfDocs = 0; try { numberOfDocs = data.response.docs.length; } catch (err) { // do nothing leave docLength at 0 } if (numberOfDocs < 1) { jQuery('#' + 'roblib-search-content-islandscholar').empty().append('No Results'); jQuery('.' + 'pane-roblib-search-islandscholar-roblib-islandscholar-results').hide(); } else { var counter = 0; var divs = new Array(); var content = new Array(); jQuery.each(data.response.docs, function (key, val) { id = 'roblib-search-islandscholar-' + counter; content[counter] = ''; if (typeof val['mods_abstract_s'] !== 'undefined') { content[counter] = val['mods_abstract_s'][0]; } else { content[counter] = 'No abstract available'; } divs[counter++] = id; items.push('