Bug 5917 : Converted templates
[koha.git] / koha-tt / 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         $(".focus").focus();
15         // clear the basket when user logs out
16         $("#logout").click(function(){
17                 var nameCookie = "bib_list";
18             var valCookie = readCookie(nameCookie);
19                 if (valCookie) { // basket has contents
20                         updateBasket(0,null);
21                         delCookie(nameCookie);
22                         return true;
23                 } else {
24                         return true;
25                 }
26         });
27 });
28
29 // build Change Language menus
30 YAHOO.util.Event.onContentReady("changelanguage", function () {
31         $(".sublangs").each(function(){
32                 var menuid = $(this).attr("id");
33                 var menuid = menuid.replace("show","");
34
35                 var oMenu = new YAHOO.widget.Menu("sub"+menuid, { zindex: 2 });
36                 function positionoMenu() {
37                         oMenu.align("bl", "tl");
38                 }
39                 oMenu.subscribe("beforeShow", function () {
40                 if (this.getRoot() == this) {
41                         positionoMenu();
42                 }
43                 });
44                 oMenu.render();
45                 oMenu.cfg.setProperty("context", ["show"+menuid, "bl", "tl"]);
46                 function onYahooClick(p_oEvent) {
47                         // Position and display the menu        
48                         positionoMenu();
49                         oMenu.show();
50                         // Stop propagation and prevent the default "click" behavior
51                         YAHOO.util.Event.stopEvent(p_oEvent);
52                 }
53                 YAHOO.util.Event.addListener("show"+menuid, "click", onYahooClick);
54                 YAHOO.widget.Overlay.windowResizeEvent.subscribe(positionoMenu);
55                 
56         });
57 });
58                         
59 // Build lists menu
60 YAHOO.util.Event.onContentReady("listsmenu", function () {
61     $("#listsmenu").css("display","block").css("visibility","hidden");
62         $("#listsmenulink").attr("href","#").find("span:eq(0)").append("<img src=\"/opac-tmpl/prog/images/list.gif\" width=\"5\" height=\"6\" alt=\"\" border=\"0\" />");
63         var listMenu = new YAHOO.widget.Menu("listsmenu");
64                 listMenu.render();
65                 listMenu.cfg.setProperty("context", ["listsmenulink", "tr", "br"]);
66                 listMenu.cfg.setProperty("effect",{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.05});
67                 listMenu.subscribe("beforeShow",positionlistMenu);
68                 listMenu.subscribe("show", listMenu.focus);
69         function positionlistMenu() {
70                     listMenu.align("tr", "br");
71                 }
72                 YAHOO.util.Event.addListener("listsmenulink", "click", listMenu.show, null, listMenu);
73                 YAHOO.widget.Overlay.windowResizeEvent.subscribe(positionlistMenu);
74  });