

window.addEvent('domready', function() {	

	$$('#articles div.article').each(function(article) {
		article.addEvents({
			'mouseenter': function() {
				image = article.getElement('span.image');
		
				if(!image) return;		
				
				exampleFx = new Fx.Tween(image, {
					property: 'opacity',
					duration: 300, 
					transition: Fx.Transitions.Linear
				}).start(1, 0);
			},
			'mouseleave': function() {
				image = article.getElement('span.image');
		
				if(!image) return;		
				
				exampleFx = new Fx.Tween(image, {
					property: 'opacity',
					duration: 300, 
					transition: Fx.Transitions.Linear
				}).start(0, 1);
			}
		});
	});
	
	$$('.image_container a').each(function(thumb) {

		thumb.addEvents({
			'click': function(btn) {
				btn.stop();
			},
			'mouseenter': function() {
				thumb.tween('opacity', 0.4);

				var image_src = thumb.get('href');
				var largeImage = $$('#projectimage');

				if(!image_src) return;		
				if(!largeImage) return;		

				var newImage = new Asset.image(image_src, {id: thumb.get('id'), title: thumb.get('name'), alt: thumb.get('name')});
				
				
				largeImage.set('src', newImage.get('src'));
			},
			'mouseleave': function() {
				thumb.tween('opacity', 1);
			}
		});
	});
});