function nextSlide(i,turn){
	if(turn==1){
	var element;
	var L = $(".image_thumb ul li").length;
	if(i>L){
		var y = Math.floor((i-1)/L);
		for(var a=1;a<=L;a++){
			if(L*y+a==i){
				i = a;
			}
		}
	}
	var element = $(".image_thumb ul li").eq(i-1);
	
	var imgAlt = element.find('img').attr("alt"); //Get Alt Tag of Image
	var imgTitle = element.find('.loadimage').text(); //Get Main Image URL
	var imgDesc = element.find('.lien').html(); 	//Get HTML of block
	var imgDesc2 = element.find('.block2').html(); 	//Get HTML of block
	var imgDescHeight = $(".main_image").find('.block').height();	//Calculate height of block	
	
	if ($(this).is(".active")) {  //If it's already active, then...
		return false; // Don't click through
	} else {
		//Animate the Teaser				
			$(".main_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
			$(".main_image .block").html(imgDesc).animate({ opacity: 1,	marginBottom: "0" }, 250 );
			$(".texteblock2").html(imgDesc2).animate({ opacity: 1,	marginBottom: "0" }, 250 );
			$(".bigimage").fadeOut("slow",function(){$(this).empty().append('<img src="'+imgTitle+'" alt="'+imgAlt+'" />').fadeIn("slow");});		
		});
	}
	
	$(".image_thumb ul li").removeClass('active'); //Remove class of 'active' on all lists
	element.addClass('active');  //add class of 'active' on this list only
	return false;
	}
}

$(document).ready(function() {	
/*
	turn=1;
    $(document).everyTime(5000, function(i) {
      	nextSlide(i,turn);
    }, 0);*/
    
    

	//Show Banner
	$(".main_image .desc").show(); //Show Banner
	$(".main_image .block").animate({ opacity: 1 }, 1 ); //Set Opacity

	//Click and Hover events for thumbnail list
	/*$(".image_thumb ul li:first").addClass('active'); 
	$(".image_thumb ul li").hover(function(){ 
		turn=0;
		//Set Variables
		var imgAlt = $(this).find('img').attr("alt"); //Get Alt Tag of Image
		var imgTitle = $(this).find('.loadimage').text(); //Get Main Image URL
		var imgDesc = $(this).find('.lien').html(); 	//Get HTML of block
		var imgDesc2 = $(this).find('.block2').html(); 	//Get HTML of block
		var imgDescHeight = $(".main_image").find('.block').height();	//Calculate height of block	
		
		if ($(this).is(".active")) {  //If it's already active, then...
			return false; // Don't click through
		} else {
			//Animate the Teaser	
				$(".bigimage").fadeOut("slow",function(){$(this).empty().append('<img src="'+imgTitle+'" alt="'+imgAlt+'" />').fadeIn("slow");});			
				$(".main_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
				$(".main_image .block").html(imgDesc).animate({ opacity: 1,	marginBottom: "0" }, 250 );
				$(".texteblock2").html(imgDesc2).animate({ opacity: 1,	marginBottom: "0" }, 250 );
			});
		}
		
		$(".image_thumb ul li").removeClass('active'); //Remove class of 'active' on all lists
		$(this).addClass('active');  //add class of 'active' on this list only
		return false;
		
	}) .hover(function(){
		$(this).addClass('hover');
		}, function() {
		$(this).removeClass('hover');
	});
			
	//Toggle Teaser
	$("a.collapse").click(function(){
		$(".main_image .block").slideToggle();
		$("a.collapse").toggleClass("show");
	});*/
	
});//Close Function
