Drupal.behaviors.roblib_search_eds = { attach: function (context, settings) { $url = settings.roblib_search_eds.search_url; profile = settings.roblib_search_eds.eds_profile; proxy_url = "http://proxy.library.upei.ca/login?url="; jQuery.getJSON($url, function (data) { var items = []; var numberOfDocs = 0; try { numberOfDocs = data.numFound; } catch (err) { // do nothing leave docLength at 0 } if (numberOfDocs < 1) { jQuery('#' + 'roblib-search-content-eds').empty().append('No Results'); jQuery('.' + 'pane-roblib-search-eds-roblib-search-eds-results').hide(); } else { var counter = 0; var divs = new Array(); var content = new Array(); var queries = []; jQuery.each(data.queries, function (key7, query) { queries.push(query.query); }) var query_str = data.queries[0].query; var href_str = 'https://search.ebscohost.com/login.aspx?direct=true&site=eds-live&scope=site&type=1&custid=uprince&groupid=main&profid=lite&mode=bool&lang=en&bquery='; jQuery.each(data.documents, function (key, val) { id = 'roblib-search-eds-' + counter; divs[counter++] = id; if (typeof val.Items !== 'undefined') { items.push('