window.addEvent
(
	'load', function()
	{
		var companies = $('view-contents-companies-home');

		if (companies)
		{
			(function() {

			var slideContainer = companies.getElement('ul');
			var browsePrevious = companies.getElement('a.previous');
			var browseNext = companies.getElement('a.next');
			var updateTarget = companies.getFirst('div.description');

			if (!slideContainer)
			{
				return;
			}

			function update(li)
			{
				updateTarget.innerHTML = li.getElement('div.description').get('html');
			}

			update(slideContainer.getFirst());

			if (companies.getElements('li').length < 2)
			{
				return;
			}

			var slideshow = new WdSlideshow
			(
				slideContainer,
				{
					autopause: true,

					browse:
					{
						previous: browsePrevious,
						next: browseNext
					},

					duration: 'normal'
				}
			);

			slideshow.addEvent
			(
				'changed', function(ev)
				{
					update(ev.active);
				}
			);

			slideshow.play();

			}) ();
		}
	}
);
