$(document).ready(function(){

$('#no-java').remove();
$('#wrapper').children().not('#menu').fadeOut(0).fadeIn(300);
//$('#wrapper').children().not('#menu').fadeOut(0, function() { $('#wrapper').children().fadeIn(300); });



//HOVER-EFFECT
//$("#menu a:hover").css("display":"none");
$("#menu div a").append('<div class="hover"></div>');
$("#menu div").hover(function() {
	$(this).not('.current').children().children().fadeIn(100);
    },function(){
	$(this).not('.current').children().children().fadeOut(200);	
});


//SLIDESHOW & IMAGE-NAV
var selectorIndex = '0';
//var numberOfImageContainers = ($('.images-container').length);

for ( i = 0; i < ($('.images-container').length); i++) {
	var numberOfChildren = $('.images-container img').length;
	$('.images-container').eq(i).css({"width":(numberOfChildren*600)});
}
$('.selector').click(function() {
	$(this).parent().children('[id=selected]').css({"background-image":"url('images/selector-inactive.png')"});
	$(this).parent().children('[id=selected]').attr('id', '');

	selectorIndex = $(this).index();
	$(this).attr('id', 'selected');
	$(this).css({"background-image":"url('images/selector-active.png')"});
	
	$(this).parent().parent().find(".shadow").animate({opacity : 0},200, function() {
		$(this).children('.shadow-container').children('.images-container').css({ marginLeft : "-" + (selectorIndex*600) + "px" });
		$(this).animate({opacity:1},200);
	});
	

});


//HISTORY
var numberOfImages = 6;
var currentImage = 0;
var historyImage;

setInterval(function() {
	$('#history').animate({"opacity":"0"},1000, function() {
		$('#history-shadow img').eq(currentImage).css({"display":"none"});
		if (currentImage == (numberOfImages-1)) {
			currentImage = 0;
		} else {
			currentImage++;
		}
		$('#history-shadow img').eq(currentImage).css({"display":"block"});
		$('#history').animate({"opacity":"1"},1000);
	});

}, 5000);

});
