/*
   SDGHoverImage
   -----------------------
   A class that handles mouseover action for a link collection.
   Assumes the following DOM structure:
   <div id="sdgLinkCollection">
      <div class="thumbs">
         <div class="thumb hidden"> .. </div>
         <div class="thumb hidden"> .. </div>
         <div class="thumb hidden"> .. </div>
      </div>

      <ul class="hidden">
         link structure
      </ul>
   </div>

   Thumbs and ul are set to hidden when the page is rendered, to
   avoid the mouseovers to trigger before the prototype class is
   in place.
   When the prototype class has loaded, the ul is made visible.
   On each li mouseover the showThumb method is called, which
   displays the correct thumb based on the index parameter.

*/
SDGHoverImage = Class.create( {
	_current: null,
	
	initialize: function() {
		// show link collection
		$('sdgLinkCollection').down('ul').removeClassName('hidden');
	},

	showThumb: function(index) {
	    // hide current thumb. show the selected thumb
	    $('sdgLinkCollection').down('div.thumb', this._current).addClassName('hidden');
	    this._current = index;
	    $('sdgLinkCollection').down('div.thumb', this._current).removeClassName('hidden');
	}
});

var sdgHoverImage;