MTJax.WoodSelect = new Class();
MTJax.WoodSelect.prototype = {
	initialize: function(el)
	{
		el.getElements('.timber').each(function(el)
		{
			el.Fx = new Fx.Morph(el, {wait: false, duration: 300, transition: Fx.Transitions.Cubic.easeOut});
			el.setStyles({
				cursor: 'pointer'
			});
			
			TheLink = $(el.id.replace(/timber_/, 'timber_link_'));
			TheLink.Fx = new Fx.Morph(TheLink, {wait: false, duration: 300, transition: Fx.Transitions.Cubic.easeOut});
			TheLink.Timber = el;
			
			el.TheLink = TheLink;
			
			TheLink.addEvents({
				'show': function()
				{
					this.Fx.start({
						color: '#000000'
					});
				}
				,'hide': function()
				{
					this.Fx.start({
						color: '#bbbbbb'
					});
				}
				,'mouseenter': function(){this.fireEvent('show');this.Timber.fireEvent('show');}
				,'mouseleave': function(){this.fireEvent('hide');this.Timber.fireEvent('hide');}
			});
			
			
			el.addEvents({
				'click': function()
				{
					document.location.href = this.getProperty('rel');
				}
				,'show': function()
				{
					this.Fx.start({
						left: 0
						,top: 0
						,width: 100
						,height: 100
						,'background-position': '-10 -10'
					});
				}
				,'hide': function()
				{
					this.Fx.start({
						left: 10
						,top: 10
						,width: 80
						,height: 80
						,'background-position': '-20 -20'
					});
				}
				,'mouseenter': function(){this.fireEvent('show');this.TheLink.fireEvent('show');}
				,'mouseleave': function(){this.fireEvent('hide');this.TheLink.fireEvent('hide');}
			});
		});
	}
};

window.addEvent('domready', function()
{
	document.getElements('.woodselect').each(function(el)
	{
		new MTJax.WoodSelect(el);
	});
});