//	init from FXalgemeen->onPageLoaded()
function initCases(){
	if( $currentBlok.find('.projectBeschrijving').length != 0){
		//projectdetailpagina
		var projectId	=	$('.projectBeschrijving').attr('id').replace("Project", "")
		
		var loadUrl		=	'/_php/show_projectMedia_small.php';
		$('.projectMedia').load(loadUrl,{projectID:projectId}, 
			function(response, status, xhr) {
				//$('#mediaHolder').touchScroll()
			}
		)
	}else{
		//$('.thumbMask').touchScroll()
		var $overzicht		=	$currentBlok.find('.thumbHolder');
		var pagina			=	0;
		var pagemax			=	$('.thumbColom').length-1;
		
		$('.prevCases').hide()
		if(pagemax==0){
			$('.nextCases').hide()
		}
		
		$('.nextCases').click(function(){
			pagina++
			$('.thumbHolder').animate2({'left':-(pagina*(13+$('.thumbColom').width()))+'px'},800)
			
			pagemax			=	$('.thumbColom').length-1;
			
			$('.prevCases').show('slow')
			if(pagina==pagemax){
				$('.nextCases').hide('slow')
			}
		})
		$('.prevCases').click(function(){
			pagina--
			$('.thumbHolder').animate2({'left':-(pagina*(13+$('.thumbColom').width()))+'px'},800)
			
			$('.nextCases').show('slow')
			if(pagina==0){
				$('.prevCases').hide('slow')
			}
		})
		
		showTestimonial()
		
		if(testimonialInterval != null)		clearInterval(testimonialInterval);
		
		if(testimonialArray.length > 0 ){
			testimonialInterval			=	setInterval( "showTestimonial()", 10000 );
		}
		
		$('.projectThumb').each(function(index){
			$(this).find('img').attr('src',thumbnailArray[index])
		})
	}
	
	if($currentBlok.find('.divHoek').length > 1){
		var newWidth	=	$('.thumbMask').width()/2
		$('.thumbMask').css({width:newWidth+'px'})
		$('.thumbColom').css({width:newWidth+'px'})
		$('.divHoek').css({width:newWidth+'px','float':'left'})
		
		$('.prevCases').hide()
		$('.nextCases').hide()
		
		$('#showCases').click(showCases)
		$('#showBrands').click(showBrands)
	}
}
var testimonialInterval;

function showBrands(){
	$('.thumbMask:last,.divHoek:last').animate2({width:0,'paddingLeft':' 0 !important'},500,function(){
		$('.divHoek:last').remove()
		$('.nextCases').show('slow')
	})
	$('.thumbMask:first,.divHoek:first,.thumbColom').animate2({width:705},500)
	$('#showCases,#showBrands').hide('slow')
}
function showCases(){
	$('.thumbMask:first,.divHoek:first').animate2({width:0,'paddingLeft':' 0 !important'},500,function(){
		$('.divHoek:first').remove()
		$('.nextCases').show('slow')
	})
	$('.thumbMask:last,.divHoek:last,.thumbColom').animate2({width:705},500)
	$('#showCases,#showBrands').hide('slow')
}

function showTestimonial(){	
	var newTestimonial		=	testimonialArray.pop();
	testimonialArray.unshift(newTestimonial)
	
	$('#testimonialCompany').hide('slow',function(){
		$('#testimonialCompany').html(newTestimonial.name+'<br/>'+newTestimonial.brand)
		$('#testimonialCompany').show('slow')
	})
	
	$('.testimonialContent').hide('slow',function(){
		$('.testimonialContent').html(newTestimonial.comment)
		$('.testimonialContent').show('slow')
	})
}
