// Wait for the document to load
   document.observe("dom:loaded", function() {
																					 												 
																					 
      // Add the 'View all' toggle
      $$("a.view-all").each(function(a) {                   // for each anchor tag with a class of 'view-all'
         // hide all the view-all' sections
         var hiddenDIV = a.up().next().next();              // get the parent/next sibling/next sibling of the anchor tag (a DIV)
         if (hiddenDIV != null && hiddenDIV.nodeName == "DIV") {  // make sure we have one
            hiddenDIV.setStyle({display: "none"});          // Hide it (this is on page load, remember - coudl do this inline)
         }
         a.observe("click", function() {                    // listen for click events on the anchor
            Effect.toggle(hiddenDIV, 'appear');             // show/hide the DIV when clicked
         });
      });
      // Add tooltips and rollovers
      $$("a.tooltip").each(function(a) {                    // for each anchor tag with a class of tooltip
         a.observe("mouseover", function() {                // listen for mouseover events
            new Tip(a, a.title, {className: "hover-tip"});  // create a new tool tip from the title attribute
            a.original_title = a.title;                     // remember the title...
            a.title = "";                                   // ...and blank the attribute to prevent the browsers tooltip from showing
            fadeOutIn(a, a.descendants()[0]);
         });
         a.observe("mouseout", function() {                 // for each anchor tag with a class of tooltip
            a.title = a.original_title;                     // listen for mouseout events
            fadeOutIn(a, a.descendants()[0]);
         });
      });
   });
   function fadeOutIn(a, img, newSrc) {
      if (img.alt_src == undefined) {
         img.alt_src = img.src.replace(/graphics\//, "graphics\/big-");
      }
      new Effect.Opacity(a,
      {
         duration: 0.3,
         transition: Effect.Transitions.linear,
         from: 1.0, to: 0.5,
         queue: "fadeOutIn",
         afterFinish: function() {
            var temp = img.alt_src;
            img.alt_src = img.src;
            img.src = temp;
            new Effect.Opacity(a,
            {
               duration: 0.3,
               transition: Effect.Transitions.linear,
               from: 0.5, to: 1
            });
         }
      });
   }
