modules = new Array('event', 'community', 'umfragemodul', 'emailmodul');
totalModules = 4;
currentModulesIndex = 0; 

function showModulInfo(modul, speed) {


	$('.animation-icon').stop(true, true).fadeOut(speed);
	$('#animation-icon-' + modul).stop(true, true).fadeIn(speed);

	$('.animation-text').stop(true, true).fadeOut(speed);
	$('#animation-text-' + modul).stop(true, true).fadeIn(speed);
	
	return false;
}

function cycleModulInfo(startWithIndex) {
	currentModulesIndex = (startWithIndex > -1) ? startWithIndex : (currentModulesIndex + 1) % totalModules;
	showModulInfo(modules[currentModulesIndex], 700);
	animationCycle = setTimeout('cycleModulInfo(-1)', 6000);
}

$('#animation-icon-' + modules[0] + '-wrapper')
	.mouseenter(function() { clearTimeout(continueCycle); clearTimeout(animationCycle); showModulInfo(modules[0], 0); })
	.mouseleave(function() { continueCycle = setTimeout("cycleModulInfo(1)", 1000); });
$('#animation-icon-' + modules[1] + '-wrapper')
	.mouseenter(function() { clearTimeout(continueCycle); clearTimeout(animationCycle); showModulInfo(modules[1], 0); })
	.mouseleave(function() { continueCycle = setTimeout("cycleModulInfo(2)", 1000); });
$('#animation-icon-' + modules[2] + '-wrapper')
	.mouseenter(function() { clearTimeout(continueCycle); clearTimeout(animationCycle); showModulInfo(modules[2], 0); })
	.mouseleave(function() { continueCycle = setTimeout("cycleModulInfo(3)", 1000); });
$('#animation-icon-' + modules[3] + '-wrapper')
	.mouseenter(function() { clearTimeout(continueCycle); clearTimeout(animationCycle); showModulInfo(modules[3], 0); })
	.mouseleave(function() { continueCycle = setTimeout("cycleModulInfo(0)", 1000); });



//Startseiten Animation starten
$(document).ready(function() { cycleModulInfo(currentModulesIndex); });


