Changing the way items are added to the cart and and lists from the searchresults...
[koha.git] / koha-tmpl / opac-tmpl / prog / en / js / script.js
1         /**
2          * this function checks all checkbox 
3          * or uncheck all if there are already checked.
4          */
5         function CheckAll(){
6                 var checkboxes = document.getElementsByTagName('input');
7                 var nbCheckbox = checkboxes.length;
8                 var check = areAllChecked();
9                 for(var i=0;i<nbCheckbox;i++){
10                         if(checkboxes[i].getAttribute('type') == "checkbox" ){
11                                 checkboxes[i].checked = (check) ? 0 : 1;
12                         }
13                 }
14         }
15         /**
16          * this function return true if all checkbox are checked
17          */
18         function areAllChecked(){
19                 var checkboxes = document.getElementsByTagName('input');
20                 var nbCheckbox = checkboxes.length;
21                 for(var i=0;i<nbCheckbox;i++){
22                         if(checkboxes[i].getAttribute('type') == "checkbox" ){
23                                 if(checkboxes[i].checked == 0){
24                                         return false;
25                                 }
26                         }
27                 }
28                 return true;
29         }
30
31 function confirmDelete(message) {
32         return (confirm(message) ? true : false);
33 }
34
35 function Dopop(link) {
36         newin=window.open(link,'popup','width=500,height=400,toolbar=false,scrollbars=yes');
37 }
38
39 $(document).ready(function(){
40         if(basketcount){ updateBasket(basketcount,document) }   
41         $(".close").click(function(){
42                 window.close();
43         });
44 });
45         
46 YAHOO.util.Event.onContentReady("changelanguage", function () {
47                 var oMenu = new YAHOO.widget.Menu("sublangs", { zindex: 2 });
48                     function positionoMenu() {
49                     oMenu.align("bl", "tl");
50                 }
51                 oMenu.subscribe("beforeShow", function () {
52                     if (this.getRoot() == this) {
53                                                 positionoMenu();
54                     }
55                 });
56                 oMenu.render();
57                                 oMenu.cfg.setProperty("context", ["showlang", "bl", "tl"]);
58                                 function onYahooClick(p_oEvent) {
59                     // Position and display the menu        
60                     positionoMenu();
61                     oMenu.show();
62                     // Stop propagation and prevent the default "click" behavior
63                     YAHOO.util.Event.stopEvent(p_oEvent);
64                 }
65                                 YAHOO.util.Event.addListener("showlang", "click", onYahooClick);
66                                 YAHOO.widget.Overlay.windowResizeEvent.subscribe(positionoMenu);
67             });