/**
 * jQuery.slideshow - Fadeshow Jquery
 * @author Jeroen Evers <jeroen@be-interactive.nl>
 * @version 0.1
 * @date 2010-12-16
 */
// -- slideshow vars en functions
	var BE_slideDuration = 10000;
	var BE_fadeDuration = 1200;
	var BE_fadeDurationFast = 300;
	var BE_nextIndex = 0;
	var BE_currentIndex = 0;
	var BE_timer = false;

	/*
	 * initSlide
	 * 
	 * Hide elements, start autoSlide.
	 */
	function initSlide(){
		//$(".slideshow li").css({opacity: 0.0});
		// set CSS for items
		autoSlide();
		$('.slideshow,.slideshow ul,.slideshow ul li').css({
			'width' : slide_w,
			'height' : slide_h
		});
	};
	
	/*
	 * autoSlide
	 * 
	 * Automatic slide function. 
	 * Sets BE_timer interval.
	 */
	function autoSlide(){
		// next slide
		BE_nextIndex = BE_currentIndex+1;
		if(BE_nextIndex > $(".slideshow li").length) {
			BE_nextIndex = 1;
		}
		
		// action
		$("'.slideshow li:nth-child("+BE_nextIndex+")'").animate({opacity: 1.0}, BE_fadeDuration).addClass('show');
		
		if (BE_nextIndex!=BE_currentIndex) {
			$("'.slideshow li:nth-child("+BE_currentIndex+")'").animate({opacity: 0.0}, BE_fadeDuration).removeClass('show');
			BE_currentIndex = BE_nextIndex;
			
			// set interval BE_timer
			if (!BE_timer) {
				BE_timer = window.setInterval('autoSlide()',BE_slideDuration);
			}
		}
	};
	
		
