// JavaScript Document
$(document).ready(function(){ 
	fotos = $('#fotosliderimg li');
	fotos.hide();
	$('#fotosliderimg li.first').show();
	foto = $('#fotosliderimg li.first');
	
	fotobtns = $('#fotosliderlist li');
	fotobtn = fotobtns.first();
	fotobtn.addClass('activ');
	
	if(fotos.length > 1) {
		setInterval("startslide()", 8000); 
	}
	$('#menuslider li').mouseover(function() {
			var i = $(this).index()+1;
			$('#mspd'+i).show();
	});
	$('#menuslider li').mouseout(function() {
			$('.mspd').hide();								   
	});
	/*$('#btnimpressum').click(function() {$('#impressum').fadeIn()});
	$('#btnimpressum').mouseout(function() {
			$('#impressum').delay(2000).fadeOut();								   
	});*/
	$('#flogo').mouseover(function() {$('#funternehmen').fadeIn()});
	$('#flogo').mouseout(function() {
			$('#funternehmen').delay(2000).fadeOut();								   
	});
});
function startslide() {
	fotobtns.removeClass('activ');
	fotobtn = foto.next().length ? fotobtn.next() : fotobtns.first();
	fotobtn.addClass('activ');
	
	current = foto;
	next = foto.next().length ? foto.next() : fotos.first();
	
	
	slideimg(current, next);
	//$('#fototitelhead').text(next.children().attr('title'));
	//$('#fototiteltext').text(next.children().attr('alt'));
	//alert(current.children().attr('title'));
	
	foto = next;
}
function slideimg(current, next) {
  if(current.index() == fotos.size()-1) {	
	next.show();
	current.fadeOut(1000, function() {current.hide();});
  } else {
	next.fadeIn(1000, function() {current.hide();});
  }
  select_img_navi(current.index());
}
function select_img_navi(id) {
	if(id != "2")	
		id++;
	else 
		id = 0;
	$('#img_navi li').removeClass('select');
	$('#img_navi_'+id).addClass('select');
}

