Overhaul of cover images. Replaces Amazon's "no cover" image with styled text, addres...
[koha.git] / koha-tmpl / opac-tmpl / prog / en / js / script.js
1 function _(s) { return s } // dummy function for gettext
2 function confirmDelete(message) {
3         return (confirm(message) ? true : false);
4 }
5
6 function Dopop(link) {
7         newin=window.open(link,'popup','width=500,height=400,toolbar=false,scrollbars=yes,resizeable=yes');
8 }
9
10 $(document).ready(function(){
11         $(".close").click(function(){
12                 window.close();
13         });
14         // clear the basket when user logs out
15         $("#logout").click(function(){
16                 var nameCookie = "bib_list";
17             var valCookie = readCookie(nameCookie);
18                 if (valCookie) { // basket has contents
19                         updateBasket(0,null);
20                         delCookie(nameCookie);
21                         return true;
22                 } else {
23                         return true;
24                 }
25         });
26 });
27
28 // build Change Language menus
29 YAHOO.util.Event.onContentReady("changelanguage", function () {
30         $(".sublangs").each(function(){
31                 var menuid = $(this).attr("id");
32                 var menuid = menuid.replace("show","");
33
34                 var oMenu = new YAHOO.widget.Menu("sub"+menuid, { zindex: 2 });
35                 function positionoMenu() {
36                         oMenu.align("bl", "tl");
37                 }
38                 oMenu.subscribe("beforeShow", function () {
39                 if (this.getRoot() == this) {
40                         positionoMenu();
41                 }
42                 });
43                 oMenu.render();
44                 oMenu.cfg.setProperty("context", ["show"+menuid, "bl", "tl"]);
45                 function onYahooClick(p_oEvent) {
46                         // Position and display the menu        
47                         positionoMenu();
48                         oMenu.show();
49                         // Stop propagation and prevent the default "click" behavior
50                         YAHOO.util.Event.stopEvent(p_oEvent);
51                 }
52                 YAHOO.util.Event.addListener("show"+menuid, "click", onYahooClick);
53                 YAHOO.widget.Overlay.windowResizeEvent.subscribe(positionoMenu);
54                 
55         });
56 });
57                         
58 // Build lists menu
59 YAHOO.util.Event.onContentReady("listsmenu", function () {
60     $("#listsmenu").css("display","block").css("visibility","hidden");
61         $("#listsmenulink").attr("href","#").find("span:eq(0)").append("<img src=\"/opac-tmpl/prog/images/list.gif\" width=\"5\" height=\"6\" alt=\"\" border=\"0\" />");
62         var listMenu = new YAHOO.widget.Menu("listsmenu");
63                 listMenu.render();
64                 listMenu.cfg.setProperty("context", ["listsmenulink", "tr", "br"]);
65                 listMenu.cfg.setProperty("effect",{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.05});
66                 listMenu.subscribe("beforeShow",positionlistMenu);
67                 listMenu.subscribe("show", listMenu.focus);
68         function positionlistMenu() {
69                     listMenu.align("tr", "br");
70                 }
71                 YAHOO.util.Event.addListener("listsmenulink", "click", listMenu.show, null, listMenu);
72                 YAHOO.widget.Overlay.windowResizeEvent.subscribe(positionlistMenu);
73  });