]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/javascript/opac/AbstractRecordResultPage.js
3014de89689133c6b4520ef3e2e422c4e085bcbc
[working/Evergreen.git] / Open-ILS / src / javascript / opac / AbstractRecordResultPage.js
1
2 AbstractRecordResultPage.prototype                                      = new Page();
3 AbstractRecordResultPage.prototype.constructor  = AbstractRecordResultPage;
4 AbstractRecordResultPage.baseClass                                      = Page.constructor;
5
6
7 /* constructor for our singleton object */
8 function AbstractRecordResultPage() {}
9
10
11 /* initialize all of the UI components and set up data structures */
12 AbstractRecordResultPage.prototype.init = function() {
13
14         debug( "Initing an AbstractRecordResultPage" );
15
16         /* included page chunks */
17         this.searchBar                  = new SearchBarChunk();
18
19         /* UI objects */
20         this.recordBox                  = getById("record_result_box");
21
22         this.authorBox = new Box();
23         this.authorBox.init("Relevant Authors", true, true, 15);
24         this.authorBox.sortByKey();
25
26         this.subjectBox = new Box();
27         this.subjectBox.init("Relevant Subjects", true, true, 15);
28         this.subjectBox.sortByCount();
29
30         this.seriesBox = new Box();
31         this.seriesBox.init("Relevant Series", true, true, 15);
32         this.seriesBox.sortByKey();
33
34         this.sidebarBox         = getById("record_sidebar_box");
35
36         this.sidebarBox.appendChild(this.buildNavBox());
37         this.sidebarBox.appendChild(elem("br"));
38
39         if(!this.hitsPerPage)
40                 this.hitsPerPage                = 10;    /* how many hits are displayed per page */
41
42         this.resetPage();
43
44         this.statusBar                  = getById("top_status_bar_table");
45         this.theadDrawn         = false;
46         this.bigOlBox                   = getById("big_ol_box");
47
48 }
49
50
51
52 /** Resets data structures for a new search */
53 AbstractRecordResultPage.prototype.resetPage = function() {
54         this.searchBar.reset();
55         var spot = getById("progress_bar_location");
56         var spot2 = getById("progress_bar_percent_location");
57         if(spot) {
58                 while(spot.lastChild) 
59                         spot.removeChild(spot.lastChild);
60
61                 /* progress items for each record and it's hit count listing */
62                 this.progressBar = new ProgressBar(parseInt(this.hitsPerPage) * 2);
63                 spot.appendChild(this.progressBar.getNode());
64         }
65         if(spot2 && this.progressBar)
66                 spot2.appendChild(this.progressBar.percentDiv);
67         this.received = 0;
68
69         RemoteRequest.cancelAll();
70
71         this.requestBatch = new RequestBatch();
72         this.finalized = false;
73         this.builtLinks = false;
74
75         this.hitsPerPageSelector = getById('hits_per_page');
76
77         var obj = this;
78         this.hitsPerPageSelector.onchange = function() {
79
80                 var hits;
81                 var hits_obj = obj.hitsPerPageSelector.options[
82                         obj.hitsPerPageSelector.selectedIndex]; 
83
84                 if(hits_obj == null)
85                         return;
86
87                 hits = hits_obj.value
88
89                 debug("Hits per page set to " + hits );
90
91                 obj.hitsPerPage = parseInt(hits);       
92
93
94                 var location = globalSelectedLocation;
95                 if(location == null) location = globalLocation.id();
96
97                 url_redirect(obj.URLRefresh());
98                 obj = null;
99         }
100
101
102         for( var i in this.hitsPerPageSelector.options ) {
103
104                 var hits_obj = obj.hitsPerPageSelector.options[i];
105                 if(hits_obj == null) continue;
106                 var hits = hits_obj.value;
107
108                 if( this.hitsPerPage == parseInt(hits) ) 
109                         this.hitsPerPageSelector.options[i].selected = true;
110         }
111
112 }
113
114
115 AbstractRecordResultPage.prototype.resetSearch = function() {
116         this.recordIDs                          = new Array();
117         this.ranks                                      = new Array();
118         this.hitCount                           = 0;                                    /* hits for the current search */
119         this.searchOffset                       = 0;                                    /* the offset for the search display */
120         this.page                                       = 0;
121
122 }
123
124 AbstractRecordResultPage.prototype.gatherIDs = function(result) {
125         if(result == null) return;
126
127         this.hitCount = parseInt(result.count);
128
129         if(result.ids.length < 1) {
130                 this.finalizePage();
131                 return false;
132         }
133         
134
135         /* the 'ids' field consist of [record, rank] */
136         /* gather all of the ID's */
137         if( result.ids  && typeof result.ids == 'object' 
138                         && result.ids[0] != null
139                         && result.ids[0].constructor == Array ) {
140
141                 for( var i in result.ids ) {
142                         if(result.ids[i]==null || result.ids[i][0] == null) break;
143                         var offset = parseInt(i) + parseInt(this.searchOffset);
144                         this.recordIDs[offset] = result.ids[i][0];
145                         var rank = parseFloat(result.ids[i][1]);
146                         if(rank == 0)
147                                 rank = 0.00000001; /* protect divide by 0 */
148                         this.ranks[offset] =  rank;
149                         /*
150                         debug("adding ranks[" + offset + "] = " + result.ids[i][1] + 
151                                         "  \nrecordIDs["+offset+"], result.ids["+i+"][0]");
152                                         */
153                 }
154
155         } else {
156
157                 for( var i in result.ids ) {
158                         if(result.ids[i]==null) break;
159                         var offset = parseInt(i) + parseInt(this.searchOffset);
160                         this.recordIDs[offset] = result.ids[i];
161                         debug("adding recordIDs["+offset+"], result.ids["+i+"]");
162                 }
163         }
164
165         return true;
166 }
167
168
169
170 AbstractRecordResultPage.prototype.complete = function() {
171
172 }
173
174
175 AbstractRecordResultPage.prototype.displayRecord = 
176         function( record, search_id, page_id ) {
177
178         if(record == null) return;
179
180         debug("Displaying record " + record.doc_id());
181
182         if(!instanceOf(record, Fieldmapper)) {
183                 debug(" * Received bogus record " + js2JSON(record));
184                 return;
185         }
186
187         if(page_id == 0)
188                 this.buildNextLinks();
189
190         this.received += 1;
191
192         this.progressBar.manualNext();
193
194         var id = parseInt(page_id);
195         var title_row = table_row_find_or_create(this.recordBox, id * 3 + 1 );
196         var author_row = table_row_find_or_create(this.recordBox, id * 3 + 2 );
197         var misc_row = table_row_find_or_create(this.recordBox, id * 3 + 3 );
198
199         add_css_class(misc_row, "record_misc_row");
200         add_css_class(title_row, "record_title_row");
201
202
203         var c = misc_row.insertCell(0);
204
205         /* shove in a div for each of the types of resource */
206         for( var i = 0; i!= 9; i++) {
207                 var div = createAppElement("div");
208                 div.innerHTML = "&nbsp;";
209                 add_css_class(div, "record_resource_div");
210                 c.appendChild(div);
211         }
212         //var options_cell = misc_row.insertCell(1);
213
214         c.className = "record_misc_cell";
215         var resources = record.types_of_resource();
216
217         for( var i in resources ) {
218
219                 var a;
220                 if(instanceOf(this,MRResultPage)) {
221                         var prefix = "http://" + globalRootURL + ":" + globalPort + globalRootPath;
222                         var res = modsFormatToMARC(resources[i]);
223                         var a = elem("a", 
224                                 {href: prefix + "?target=record_result&mrid=" +
225                                 record.doc_id() + "&format=" + res +
226                                 "&page=0&location=" + this.searchLocation +
227                                 "&depth=" + this.searchDepth} );
228                 }
229                 this.buildResourcePic( c, resources[i], a);
230         }
231
232         author_row.id = "record_result_author_row_" + id;
233         title_row.id = "record_result_title_row_" + id;
234
235         /* build the appropriate context node for this result */
236         var menu_name = "record_result_row_" + page_id;
237         var menu = globalMenuManager.buildMenu(menu_name);
238
239         this.addMenuItems( menu, record );
240
241         globalMenuManager.setContext(title_row, menu);
242         globalMenuManager.setContext(author_row, menu);
243         globalMenuManager.setContext(misc_row, menu);
244
245         getDocument().body.appendChild(menu.getNode());
246
247         //var optionsLink = this.buildExtendedLinks(record, page_id);
248         //if(optionsLink)
249         //      options_cell.appendChild(optionsLink);
250         /* ------------------------------------ */
251
252
253         var pic_cell = title_row.insertCell(0);
254         this.buildRecordImage( pic_cell, record, page_id, record.title());
255
256         var title_cell = title_row.insertCell(title_row.cells.length);
257         title_cell.id = "record_result_title_box_" + id;
258         add_css_class( title_cell, "record_result_title_box");
259
260         var author_cell = author_row.insertCell(author_row.cells.length);
261         author_cell.id = "record_result_author_box_" + id;
262         add_css_class(author_cell, "record_result_author_box");
263
264
265         /* limit the length of the title and author lines */
266         var tlength = 80;
267
268         var title = "";
269         if( record.title() ) {
270                 if(record.title().length > tlength) {
271                         record.title(record.title().substr(0,tlength));
272                         record.title(record.title() + "...");
273                 }
274                 title = normalize(record.title());
275         }
276
277
278         var author = "";
279         if( record.author() ) {
280                 if(record.author().length > tlength) {
281                         record.author( record.author().substr(0,tlength));
282                         record.author(record.author() + "...");
283                 }
284                 author = normalize(record.author());
285         }
286
287         title_cell.appendChild(this.mkLink(record.doc_id(), "title", title, record.title() ));
288         author_cell.innerHTML = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
289         author_cell.appendChild(this.mkLink(record.doc_id(), "author", author ));
290
291         /*
292         var marcd = null;
293         if(instanceOf(this, RecordResultPage)) {
294                 var span = createAppElement("span");
295                 span.style.marginLeft = "10px";
296
297                 if(record.pubdate() || record.edition())
298                         span.appendChild(createAppTextNode(" -- "));
299
300                 if(record.pubdate())
301                         span.appendChild(createAppTextNode(" " + record.pubdate()));
302
303                 if(record.edition())
304                         span.appendChild(createAppTextNode(" " + record.edition()));
305
306                 author_cell.appendChild(span);
307
308                 var marcb = elem( "a",
309                         {       href:"javascript:void(0)", 
310                                 style: "text-decoration:underline;"
311                         }, null, "View MARC" );
312
313                 debug("Setting up view marc callback with record " + record.doc_id());
314                 var func = buildViewMARCWindow(record);
315                 marcb.onclick = func;
316
317                 marcd = elem( "div", { style: "float:right;font-size:x-small;" } );
318                 marcd.appendChild(marcb);
319
320         }
321         */
322
323         var holddiv = null;
324         if(instanceOf(this, RecordResultPage)) {
325
326                 var holds = elem( "a", 
327                 { 
328                         href:"javascript:void(0)", 
329                         style: "text-decoration:underline" 
330                 }, {}, "Place Hold" );
331         
332         
333                 var type = "M";
334                 if(instanceOf(this, RecordResultPage))
335                         type = "T";
336         
337                 var win;
338                 var user = UserSession.instance();
339                 if(user.verifySession()) {
340                         win = new HoldsWindow(record.doc_id(), 
341                                 type, user.userObject, user.userObject, user.session_id);
342                 } else {
343                         win = new HoldsWindow(record.doc_id(), 
344                                 type, null, null, null);
345                 }
346         
347                 
348                 holds.onclick = function() { win.toggle(holds); }
349                 holddiv = elem("div");
350         
351                 holddiv.setAttribute("style", "float:right");
352                 holddiv.appendChild(holds);
353         }
354         
355         var tab = elem("table",{style:"float:right"});
356         var tr = tab.insertRow(0);
357         var tc = tr.insertCell(0);
358         var tc2 = tr.insertCell(1);
359         var tc3 = tr.insertCell(2);
360         tc.setAttribute("nowrap", "nowrap");
361         tc3.setAttribute("nowrap", "nowrap");
362
363         if(holddiv) tc.appendChild(holddiv);
364         tc2.appendChild(mktext(" "));
365         //if(marcd) tc3.appendChild(marcd);
366
367         c.appendChild(tab);
368
369
370
371         var classname = "result_even";
372         if((page_id % 2) != 0) 
373                 classname = "result_odd";
374
375         add_css_class(title_row, classname);
376         add_css_class(author_row, classname);
377         add_css_class(misc_row, classname);
378
379         /* now grab the record authors and subjects */
380         if( author ) {
381                 this.authorBox.addItem( this.mkAuthorLink(author) , author);
382         }
383
384         /* gather the subjects.  subjects are either a string or an array of
385                 [subject, broader topic].  currently, they're all just treated like
386                 subjects */
387         var arr = record.subject();
388         var x = 0;
389         for( var sub in arr ) {
390                 if(x++ > 5) break; /* too many subjects makes things real sluggish */
391
392                 var ss = arr[sub];
393
394                 /* only taking first part of subject (non-topic, etc.) */
395                 if( ss.constructor == Array)
396                         ss = ss[0];
397
398                 if( ss.constructor != Array )
399                         ss = [ss];
400
401                 for( var i in ss ) {
402                         var s = normalize(ss[i]);
403                         this.subjectBox.addItem( this.mkSubjectLink(s), s );
404                 }
405         }
406
407         var series = record.series();
408         for( var s in  series ) {
409                 debug("Found series entry: " + series[s] );
410                 var ss = normalize(series[s]);
411                 this.seriesBox.addItem( this.mkSeriesLink(ss), ss );
412         }
413
414         /* requestBatch will only have one request in it when the current
415                 record is the last record requested */
416         if( this.requestBatch.pending() < 2  )
417                 this.finalizePage();
418
419         debug("Finished displaying record " + record.doc_id());
420 }
421
422 AbstractRecordResultPage.prototype.mkAuthorLink = function(auth) {
423         var href = createAppElement("a");
424         add_css_class(href,"record_result_sidebar_link");
425
426         href.setAttribute("href",
427                 "?target=mr_result&mr_search_type=author&page=0&mr_search_query=" +
428                 encodeURIComponent(auth) +
429                 "&mr_search_depth=" + this.searchDepth +
430                 "&mr_search_location=" + this.searchLocation +
431                 "&location=" +  this.searchLocation +
432                 "&format=" + this.format +
433                 "&depth=" +  this.searchDepth);
434
435         href.appendChild(createAppTextNode(auth));
436         href.title = "Author search for " + auth;
437         return href;
438 }
439
440 AbstractRecordResultPage.prototype.mkSeriesLink = function(series) {
441         var href = createAppElement("a");
442         add_css_class(href,"record_result_sidebar_link");
443
444         debug("Series: " + series + " : " + encodeURIComponent(series));
445
446         href.setAttribute("href",
447                 "?target=mr_result&mr_search_type=series&page=0&mr_search_query=" +
448                 encodeURIComponent(series) +
449                 "&mr_search_depth=" + this.searchDepth +
450                 "&mr_search_location=" + this.searchLocation +
451                 "&location=" +  this.searchLocation +
452                 "&format=" + this.format +
453                 "&depth=" +  this.searchDepth);
454
455         href.appendChild(createAppTextNode(series));
456         href.title = "Series search for " + series;
457         return href;
458 }
459
460 AbstractRecordResultPage.prototype.mkSubjectLink = function(sub) {
461         var href = createAppElement("a");
462         add_css_class(href,"record_result_sidebar_link");
463         href.setAttribute("href",
464                 "?target=mr_result&mr_search_type=subject&page=0&mr_search_query=" +
465                 encodeURIComponent(sub) + 
466                 "&mr_search_depth=" + this.searchDepth +
467                 "&mr_search_location=" + this.searchLocation +
468                 "&location=" +  this.searchLocation +
469                 "&format=" + this.format +
470                 "&depth=" +  this.searchDepth);
471
472         href.appendChild(createAppTextNode(sub));
473         href.title = "Subject search for " + sub;
474         return href;
475 }
476
477 AbstractRecordResultPage.prototype.finalizePage = function() {
478
479         if( this.finalized )
480                 return;
481         this.finalized = true;
482
483
484         this.subjectBox.finalize();
485         this.authorBox.finalize();
486         this.seriesBox.finalize();
487
488         this.sidebarBox.appendChild(this.subjectBox.getNode());
489         this.sidebarBox.appendChild(createAppElement("br"));
490
491         this.sidebarBox.appendChild(this.authorBox.getNode());
492         this.sidebarBox.appendChild(createAppElement("br"));
493
494         this.sidebarBox.appendChild(this.seriesBox.getNode());
495         this.sidebarBox.appendChild(createAppElement("br"));
496
497 //      showMe(this.buttonsBox);
498
499         var ses = UserSession.instance().getSessionId();
500         var box = this.sidebarBox;
501
502         if(ses) {
503                 Survey.retrieveOpacRandom(ses, 
504                         function(sur) { 
505                                 sur.setSubmitCallback(
506                                         function() { alert("Thanks!"); return true; });
507                                 box.appendChild( sur.getNode() ); 
508                                 sur.setHidden(false);
509                         }
510                 );
511         } else {
512                 Survey.retrieveOpacRandomGlobal( 
513                         function(sur) { 
514                                 sur.setSubmitCallback(
515                                         function() { alert("Thanks!"); return true; });
516                                 box.appendChild( sur.getNode() ); 
517                                 sur.setHidden(false);
518                         }
519                 );
520         }
521
522
523         if(this.hitCount < 1) {
524                 if(this.progressBar) this.progressBar.stop();
525         }
526
527         /* in case we're hidden */
528         showMe(this.bigOlBox);
529         showMe(getById("hit_count_cell_2"));
530
531 }
532
533
534 AbstractRecordResultPage.prototype.displayCopyCounts = 
535         function(copy_counts, search_id, page_id) {
536                 
537         this.progressBar.manualNext();
538         var titlerow  = getById("record_result_title_row_" + page_id );
539         var authorrow  = getById("record_result_author_row_" + page_id );
540
541         var tcell = getById("record_result_title_box_" + page_id );
542
543         if(!this.theadDrawn) {
544                 var trow = getById("record_result_thead_row");
545                 for( var i in copy_counts) {
546                         var cell = trow.insertCell(trow.cells.length);
547                         add_css_class(cell,"record_result_thead_header");
548                         cell.innerHTML = 
549                                 findOrgType(findOrgUnit(
550                                         copy_counts[i].org_unit).ou_type()).opac_label();
551                 }
552                 this.theadDrawn = true;
553         }
554
555         for( var i in copy_counts) {
556                 var cell = createAppElement("td");
557                 add_css_class(cell, "copy_count_cell");
558                 cell.innerHTML = copy_counts[i].available + " / " + copy_counts[i].count;
559                 cell.setAttribute("rowspan","3");
560                 cell.rowSpan = 3;
561                 cell.title = " Availabie Copies / Total Copies";
562                 titlerow.appendChild(cell);
563         }
564
565         if(page_id  == (parseInt(this.hitsPerPage) - 1) ) {
566                 if(this.progressBar) this.progressBar.stop();
567                 if(this.hitCount < 1)
568                         this.noHits();
569         }
570
571         if( (page_id  == ((parseInt(this.hitCount) - 1 ) - parseInt(this.searchOffset))) ||
572                         (page_id == (parseInt(this.hitsPerPage) - 1) )) 
573                 if(this.progressBar) this.progressBar.stop();
574 }
575
576
577
578 AbstractRecordResultPage.prototype.noHits = function() {
579         var hcell = getById("hit_count_cell");
580         //hcell.appendChild(createAppElement("br"));
581         hcell.appendChild(createAppTextNode("0 hits were returned for you search"));
582 }
583
584
585 AbstractRecordResultPage.prototype.buildNextLinks = function() {
586
587         if(this.builtLinks)
588                 return;
589         this.builtLinks = true;
590
591         var obj = this;
592         var next;
593         var prev;
594
595         debug("Building links");
596         if( this.searchOffset < (parseInt(this.hitCount) - this.hitsPerPage)) {
597                 next = createAppElement("a");
598                 add_css_class(next,"record_next_button");
599                 add_css_class(next,"record_next_button_active");
600                 next.href = "javascript:globalPage.next();";
601         } else {
602                 next = createAppElement("span");
603                 add_css_class(next,"record_next_button_inactive");
604         }
605
606         if(this.searchOffset > 0) {
607                 prev = createAppElement("a");
608                 add_css_class(prev,"record_next_button");
609                 add_css_class(prev,"record_next_button_active");
610                 prev.href = "javascript:globalPage.prev();";
611         } else {
612                 prev = createAppElement("span");
613                 add_css_class(prev,"record_next_button_inactive");
614         }
615
616         next.appendChild(createAppTextNode("Next"));
617         prev.appendChild(createAppTextNode("Previous"));
618
619
620         var i = this.searchOffset;
621         var max = parseInt(i) + this.hitsPerPage;
622         if( max > this.hitCount )
623                 max = this.hitCount;
624
625         var hcell = getById("hit_count_cell");
626         var hcell2 = getById("hit_count_cell_2");
627         hideMe(hcell2);
628
629         if(hcell) {
630
631                 var ident = "Titles";
632                 if(instanceOf(this, MRResultPage))
633                         ident = "Title Groups";
634         
635                 hcell.appendChild(
636                         createAppTextNode( "Displaying " + ident + " " +
637                         ( parseInt(i) + 1 ) + " to " + max + " of " + this.hitCount));
638         
639                 hcell.appendChild(createAppTextNode(" "));
640                 hcell.appendChild(createAppTextNode(" "));
641                 hcell.appendChild(createAppTextNode(" "));
642         
643                 hcell.appendChild(prev);
644                 var span = createAppElement("span");
645                 span.appendChild(createAppTextNode(" ... "));
646                 hcell.appendChild(span);
647                 hcell.appendChild(next);
648         
649                 hcell2.innerHTML = hcell.innerHTML;
650         
651         }
652         
653 }
654
655
656 AbstractRecordResultPage.prototype.buildResourcePic = function(c, resource, parent) {
657         return buildResourcePic(c, resource, parent);
658 }
659
660 function buildResourcePic(c, resource, parent) {
661
662         var pic = createAppElement("img");
663
664         if(resource.indexOf("sound recording") != -1) 
665                 resource = "sound recording";
666         pic.setAttribute("src", "/images/" + resource + ".jpg");
667         pic.setAttribute("border", "0");
668         pic.className = "record_resource_pic";
669         pic.setAttribute("width", "20");
670         pic.setAttribute("height", "20");
671         pic.setAttribute("title", resource);
672
673
674         var index;
675
676         switch(resource) {
677
678                 case "text":
679                         index = 0;
680                         break;
681
682                 case "moving image":
683                         index = 1;
684                         break;
685
686                 case "sound recording":
687                         index = 2;
688                         break;
689
690                 case "software, multimedia":
691                         index = 3;
692                         break;
693
694                 case "still images":
695                         index = 4;
696                         break;
697
698                 case "cartographic":
699                         index = 5;
700                         break;
701
702                 case "mixed material":
703                         index = 6;
704                         break;
705
706                 case "notated music":
707                         index = 7;
708                         break;
709
710                 case "three dimensional object":
711                         index = 8;
712                         break;
713
714                 default:
715                         index = 0;
716         }
717
718         c.childNodes[index].innerHTML = "";
719
720         if(parent) {
721                 parent.appendChild(pic);
722                 c.childNodes[index].appendChild(parent);
723         } else {
724                 c.childNodes[index].appendChild(pic);
725         }
726 }
727
728 AbstractRecordResultPage.prototype.buildRecordImage = function(pic_cell, record, page_id, title) {
729
730         debug("Building record image for " + page_id);
731
732         /*
733         var isbn = record.isbn();
734         if(isbn) {
735                 isbn = isbn.replace(/^\s+/,"");
736                 var idx = isbn.indexOf(" ");
737                 if(idx > -1) {
738                         isbn = isbn.substring(0, idx);
739                 }
740
741         } else isbn = "";
742         */
743
744         pic_cell.setAttribute("rowspan","3");
745         pic_cell.rowSpan = 3;
746
747         pic_cell.noWrap = 'nowrap';
748         pic_cell.setAttribute("nowrap", "nowrap");
749
750         pic_cell.width = "60";
751         pic_cell.className = "record_image_cell";
752
753
754         var rankBox;
755         if( this.ranks.length > 0 ) {
756                 var x = (parseInt(this.page) * parseInt(this.hitsPerPage)) + parseInt(page_id);
757                 var per = parseInt(this.ranks[x] / this.ranks[0] * 100.0);
758
759                 debug("Per is " + per);
760                 per = 100 - parseInt(per);
761
762                 rankBox = createAppElement("div");
763                 add_css_class(rankBox, "relevance_box");
764
765                 var d = createAppElement("div");
766                 d.setAttribute("height", per + "%");
767                 d.style.height = per + "%";
768
769                 add_css_class(d, "relevance");
770                 rankBox.appendChild(d);
771
772                 rankBox.setAttribute("title", parseInt((100 - parseInt(per))) + "% Relevant");
773         }
774
775         /* use amazon for now */
776         //var img_src = "http://images.amazon.com/images/P/" +isbn + ".01.MZZZZZZZ.jpg";
777         //var img_src = "http://www.thecontentserver.com/bin/cntsvr.dll?GetImage&SysID=Content&CustID=Cafe&Return=1&Type=S&Key=" + isbn ;
778
779         var img_src = buildISBNSrc(cleanISBN(record.isbn()));
780         var big_div = createAppElement("div");
781         add_css_class(big_div, "record_image_big hide_me");
782
783         var big_pic = createAppElement("img");
784         var pic = createAppElement("img");
785         
786         big_pic.setAttribute("src", img_src);
787         big_pic.setAttribute("border", "0");
788         pic.setAttribute("src", img_src);
789         add_css_class(big_pic, "record_image");
790         add_css_class(pic, "record_image");
791
792         pic.setAttribute("width", "45");
793         pic.setAttribute("height", "50");
794         pic.style.width = "45";
795         pic.style.height = "50";
796
797         if(IE) 
798                 big_div.style.left = 0;
799
800
801         var anch = this.mkLink(record.doc_id(), "img", title );
802         anch.appendChild(big_pic);
803         big_div.appendChild(anch);
804         pic_cell.appendChild(big_div);
805
806         pic_cell.appendChild(pic);
807
808         if(rankBox)
809                 pic_cell.appendChild(rankBox);
810
811         pic.onmouseover = function() {showMe(big_div);}
812         big_div.onmouseout = function(){hideMe(big_div);}
813
814 }
815