OPAC now uses combine
[koha.git] / koha-tmpl / opac-tmpl / prog / en / js / script.js
1 function confirmDelete(message) {
2         return (confirm(message) ? true : false);
3 }
4
5 function Dopop(link) {
6         newin=window.open(link,'popup','width=500,height=400,toolbar=false,scrollbars=yes,resizeable=yes');
7 }
8
9 $(document).ready(function(){
10         $(".close").click(function(){
11                 window.close();
12         });
13         $(".focus").focus();
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         YAHOO.widget.Menu.prototype.onRender = function () { };
61     $("#listsmenu").css("display","block").css("visibility","hidden");
62         $("#listsmenulink").attr("href","#");
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  });
75
76 jQuery.fn.preventDoubleFormSubmit = function() {
77     jQuery(this).submit(function() {
78         if (this.beenSubmitted)
79             return false;
80         else
81             this.beenSubmitted = true;
82     });
83 };