/* Initialize everything, to be called on domready */
 function init_gallery() {
 
-       /* List of lists of img variations. Each image variation is a three-element
-        * array: [width, height, url]. Index of the outer array is the global ID.
+       /* List of lists of img variations. Each image variation is
+        * a three-element array: [width, height, url]. Index of the
+        * outer array is the global ID.
         *
         * [
         *  [ id, title, [
 
        $$('div.varimages').each(function(el,i){
                rimgs[el.id] = i;
-               vimgs[i] = [];
+               vimgs[i] = [el.id, el.title, []];
                el.getElements('a').each(function(ael,j){
                        dim = /(\d+)[^\d](\d+)/.exec(ael.text);
                        w = dim[1];
                        h = dim[2];
-                       vimgs[i][j]=[w,h,ael.href,el.id,el.title];
+                       vimgs[i][2][j]=[w,h,ael.href];
                });
        });
 
 
                this.controls.registershow(this);
 
                window.addEvent('resize', this.resizer.bind(this))
-               window.addEvent('scroll', this.scroller.bind(this))
        },
 
+       /* event handler for window resize */
+
        resizer: function(){
                alert('show.resizer called');
        },
 
-       scroller: function(){
-               alert('show.scroller called');
-       },
+       /* prev, play, stop, next, exit, comm are methods for button presses */
 
        prev: function(){
                this.controls.info(-1,this.vimgs.length,
                                '<ref>','next called');
        },
 
-       start: function(id, play){
-               this.options.cbStart();
-               /* real job here */
-               return false; /* tao make it usable from href links */
-       },
-
        exit: function(){
                this.options.cbExit();
        },
 
        comm: function(){
-               alert('show.comm called, do nothing');
+               /* alert('show.comm called, do nothing'); */
        },
 
+       /* Entry point: called to start doing things */
+
+       start: function(id, play){
+               this.options.cbStart();
+               alert('starting at '+id+', play='+play);
+               /* real job here */
+               return false; /* to make it usable from href links */
+       },
+
+       /* "Private" methods to do the real job */
+
 });
 Show.implement(new Options);
 Show.implement(new Events);
 
 
        show: function(){
                if (this.options.tohide) {
-                       this.options.tohide.setStyle('display', 'none');
+                       this.hiddenstyles = this.options.tohide.getStyles(
+                               'display'
+                       );
+                       this.options.tohide.setStyles({
+                               display: 'none',
+                       });
                }
+               this.bodystyles = document.body.getStyles(
+                       'overflow', 'overflow-x', 'overflow-y'
+               );
+               document.body.setStyles({
+                       overflow: 'hidden',
+                       'overflow-x': 'hidden',
+                       'overflow-y': 'hidden',
+               });
                this.container.setStyle('display', 'block');
        },
 
        hide: function(){
                if (this.options.tohide) {
-                       this.options.tohide.setStyle('display', 'block');
+                       this.options.tohide.setStyles(this.hiddenstyles);
                }
+               document.body.setStyles(this.bodystyles);
                this.container.setStyle('display', 'none');
        }
 })