anz = 0;
teasertimer = 4000;
cntstartteaser = 1;

$(document).ready( function() {
	anz = $('#startteaser ul li').length;
	$('.startteaser').mouseover( function() {
		pauseStartTeaserBild( this);
	});
	$('#startteaser_link_list').mouseleave( function() {
		playStartTeaser();
	});
	
	teaserinterval = setInterval( 'slideStartTeaser()', teasertimer);
});

function slideStartTeaser()
{
	if( cntstartteaser == anz)
	{
		showcounter = 1;
	}
	else 
	{
		showcounter = (cntstartteaser + 1);
	}
		
	hideClass = "teaser_bild_" + cntstartteaser ;
	showClass = "teaser_bild_" + showcounter;
	
	$('#startteaser ul li.' + hideClass ).fadeOut('slow');
	$('#startteaser ul li.' + showClass ).fadeIn('slow');
	
	if( cntstartteaser == anz)
	{
		cntstartteaser = 1;
	}
	else 
	{
		cntstartteaser++;
	}
}

function pauseStartTeaserBild( obj)
{
	clearInterval(teaserinterval);
	teaserclass = $( obj).attr('id');
	switch (teaserclass)
	{
		case 'schaltermaterial':
			$('#startteaser ul li').hide();
			$('#startteaser ul li.schaltermaterial').show();
			cntstartteaser = 2;
			break;
		case 'installationsbedarf':
			$('#startteaser ul li').hide();
			$('#startteaser ul li.installationsbedarf').show();
			cntstartteaser = 3;
			break;
		case 'sicherheitstechnik':
			$('#startteaser ul li').hide();
			$('#startteaser ul li.sicherheitstechnik').show();
			cntstartteaser = 4;
			break;
	}
}
function playStartTeaser()
{
	teaserinterval = setInterval( 'slideStartTeaser()', teasertimer);
}
