/*
	Thumbnail Image Flipper 
	Copyright 2008 Digital Slingshot
	Requires: Prototype
	Usage: Use an "a" link to the fullsized image.  Give link classname you associate with rellink. Defaults to thumbs.
*/

var dsThumbFlipper = Class.create({
		initialize: function(mainImgID) {
			this.options = $H({
			  rellink: 'thumbs'
			}).update(arguments[1] || {});
			this.rellink = this.options.get('rellink');
			this.image = $(mainImgID);
			this.thumblinks = $$('a.'+this.rellink);
			this.thumblinks.each(this.addHandler.bind(this));
		},
		
		addHandler: function(linky) {
			Event.observe(linky, 'mouseover', this.showThumb.bind(this,linky) );
		},
		
		showThumb: function(linky) {
			this.image.src = linky.href;
		}
});

Event.observe(window, 'load', function(){
	new dsThumbFlipper('prodImg',{rellink:'thumbs'});
});
