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

	// Define accordion 
	var accordion = new Accordion($$('.toggler'),$$('.element'), {
		start: 'all-closed',
		opacity: 50,
		onActive: function(toggler) { toggler.setStyle('color', '#b3b3b3'); },
		onBackground: function(toggler) { toggler.setStyle('color', '#4c4b35'); }
	});

	$$('ul#services-thumbnails li').each(function(li) 
	{
		// defaults
		var images = $(li).getElements('img');
		var defaultContent = $('services-content').get('html');
		var swapContent = $(li).getElement('div.content').get('html');
		
		// hide second image
		images[1].setStyle('visibility', 'hidden');

		// events
		li.addEvent('mouseenter', function() 
		{
			// swap image
			images[1].fade('in');
			// swap content
			$('services-content').set('html', swapContent);
		});
		// 
		li.addEvent('mouseleave', function() 
		{
			// swap image
			images[1].fade('out');
			// swap content
			$('services-content').set('html', defaultContent);
		});
	});
});
