function flop(itemid){
		
	if($('#'+itemid+'_content').css("display")=='none'){
		$('#'+itemid+'_content').css("display","inline");
	} else {
		$('#'+itemid+'_content').css("display","none");
	}
}


function topflop(itemid){
		
	if($('#'+itemid+'_content').css("display")=='none'){
		closeothers();
		$('#'+itemid+'_content').css("display","inline");
	} else {
		$('#'+itemid+'_content').css("display","none");
	}
}

function closeothers() {

	
	$('#portfolio_content').css("display","none");
	$('#nieuws_content').css("display","none");
	$('#bvb_content').css("display","none");
	$('#samenwerking_content').css("display","none");
	$('#bvb_content').css("display","none");

}

function boxshow(image,id,seriesid){
	realpath = image.replace('/thumbs','');
	currentsid = seriesid;
	currentim = realpath.replace('images/portfolio/','');
	$('#bigim').attr('src',realpath);

	$('#overlay').show();
	$('body').addClass('noscroll');

	$('#bigimcaption').html($('#caption'+id).html());
}

function getNext(){
	
	$('#bigimcaption').hide();
	$('#bigim').load(function(){$('#bigimcaption').show();$('#bigim').unbind('load');});
	
	

	var found = false;
	
	for(var key in pfseries[currentsid]) {
		
		if(found == true){
			$('#bigim').attr('src','images/portfolio/'+key);
			captionid = pfseries[currentsid][key].ID;
			$('#bigimcaption').html($('#caption'+captionid).html());
			currentim = key;
			return;
		}	
					
		if(key==currentim){
			var found = true;
		} // end if
		
	}
	
	// loop has ended but there was no break, go to first image
	for(var key in pfseries[currentsid]) {
		$('#bigim').attr('src','');
		$('#bigim').attr('src','images/portfolio/'+key);
		captionid = pfseries[currentsid][key].ID;
		$('#bigimcaption').html($('#caption'+captionid).html());
		currentim = key;
		return;
	}
	
	
} // end function getNext

function getPrevious(){

	$('#bigimcaption').hide();
	$('#bigim').load(function(){$('#bigimcaption').show();$('#bigim').unbind('load');});

	prevkey = '';
	firstimage = false;
	
	for(var key in pfseries[currentsid]) {
		
		if(key==currentim){
		
			if(prevkey !=''){
				$('#bigim').attr('src','');
				$('#bigim').attr('src','images/portfolio/'+prevkey);
				captionid = pfseries[currentsid][prevkey].ID;
				$('#bigimcaption').html($('#caption'+captionid).html());
				currentim = prevkey;
				return;
			} else {
				firstimage = true;
			}
			
		} // end if	
	
		prevkey = key;
	}

	
	// loop has ended but there was no break, go to last image
	if(firstimage == true){
		$('#bigim').attr('src','images/portfolio/'+key);
		captionid = pfseries[currentsid][key].ID;
		$('#bigimcaption').html($('#caption'+captionid).html());
		currentim = key;
		return;	
	}

} // end function getPrevious
