var timerId = 0;

function goPrevImage(){
	lastIndex = currentIndex;
	currentIndex = currentIndex  - 1;
	if( currentIndex == -1 ){
		currentIndex = imageLength - 1;
	}
	//console.debug( "current index: " + currentIndex + "last index: " + lastIndex + " imageLength: " + imageLength );
	
	swapImage();
}

function goNextImage(){	
	lastIndex = currentIndex;
	currentIndex++;
	if( currentIndex == imageLength )
		currentIndex = 0;
		
	swapImage();
}


function swapImage(){	
	
	$(".slideShowItem:eq("+lastIndex+")").fadeOut("slow");
	//$(".slideShowAttr:eq("+lastIndex+")").slideUp(2000,function(){
			
	//});	
	//$(".slideShowAttr:eq("+currentIndex+")").hide();			
	$(".slideShowItem:eq("+currentIndex+")").fadeIn("slow");
	//$(".slideShowItem:eq("+currentIndex+")").fadeIn(2000,function(){	
		
	//});	
	clearTimeout ( timerId );

	
	timerId = setTimeout ( "goNextImage()", interval );	
	
}
