// -----------------------------------------------------------------------------------------------
//
//	Copyright 2009, Orbital Guidance Industries, Ltd. (orbitalguidance.com), All rights reserved.
//
//	This work is provided under a royalty-free, non-exclusive license in perpetuity to
//	residualzen (residualzen.com) and its clients.
//
// -----------------------------------------------------------------------------------------------
//
//	Mootools dependencies from Mootools More - Asset
//
//  <http://mootools.net/docs/more/Utilities/Assets>
//
// -----------------------------------------------------------------------------------------------

var SimpleRollover = new Class(
{
	options:
	{
		// Set of tags to add rollerover actions
		tags: null,
		
		// Suffix for images for 'over' state
		over: '-over'
	},
	
	initialize: function(options, events)
	{
		this.setOptions(options);
		
		this.options.tags.each(function(item)
		{
			var normal = $(item).getProperty('src');
			var period = normal.lastIndexOf('.');
			var over = (normal.substr(0, period) + this.options.over + normal.substr(period));
			
			Asset.images([normal, over]);
			
			$(item).addEvents(
			{
				'mouseover': function() { $(item).setProperty('src', over); },
				'mouseout':  function() { $(item).setProperty('src', normal); }
			});
		}.bind(this));
	}
});

SimpleRollover.implement(new Options, new Events);

