window.addEvent('load', function()
{
	/*if(check_teaser_content() === true)
	{
		var m7_start = function()
		{
		//schiebt den ersten teaser nach links und dann an die letzte stelle (child)
			switch_teaser_content();
		//setzt alle teaser wieder auf ausgangsposition
			reset_teaser_content();
		}
		var start_that = function()
		{
			return m7_start.periodical(2500);
		}
		var timer;
		// or to start the periodical now:
		var timer = start_that();
		$('m7_vod_teaser_outer').addEvent('mouseenter', function()
		{
			$clear(timer);
		});
		$('m7_vod_teaser_outer').addEvent('mouseleave', function()
		{
			timer = start_that();
		});
	}
	*/
});
var check_teaser_content = function()
{//vergleich das erste und das letzte element.
	if($('m7_vod_teaser_outer').getElement('div:first-child') != $('m7_vod_teaser_outer').getElement('div:last-child'))
	{
		return true;
	}
	return false;
}
var switch_teaser_content = function()
{
	var stepindex = 1000;
	$$('.m7_vod_teaser').each(function(foo)
	{
		foo.setStyle('z-index', stepindex);
		stepindex--;
	});
	
	var teaser_first = $('m7_vod_teaser_outer').getElement('div:first-child');
	teaser_first.set('morph',
	{
		duration: 'long',
		transition: '',
		onComplete: function()
		{
			teaser_first.setStyle('z-index', 1);
		}
	});
	
	var foo_morph = $random(1, 4);
	switch(foo_morph)
	{
		case 1://beweg dich nach links
			teaser_first.morph({'left': '-200px'});
		break;
		case 2://beweg dich nach oben
			teaser_first.morph({'top': '-270px'});
		break;
		case 3://beweg dich nach rechts
			teaser_first.morph({'left': '200px'});
		break;
		case 4://beweg dich nach unten
		default:
			teaser_first.morph({'top': '270px'});
		break;
	}
	
	$('m7_vod_teaser_outer').grab(teaser_first, 'bottom');
};
var reset_teaser_content = function()
{
	$$('.m7_vod_teaser').setStyles(
	{
		'left': 0,
		'top': 0
	});
};
