// JavaScript Document

function random_header() {
	var ranNum= Math.floor(Math.random()*7)+1;
	document.getElementById('header_image').src='/images/headers/'+ranNum+'.jpg';    
}

var onAfter = function(){
	var id = $(this).attr('id');
	$('img.fotoalbum').each(function(i){
		if( $(this).attr('id') == id){
			$('#current').html( i+1 );
		}
	});
	$('#total').html( $('img.fotoalbum').length);
}

	
	


$(document).ready(function() {
						   

	var start = 0;
	if( $('#cycle').attr('class') ){
		
		var id = $('#cycle').attr('class').substr( $('#cycle').attr('class').indexOf('_')+1);
		$('#cycle img').each(function(i){
			if( $(this).attr('id') == 'image_'+id ){
				start = i;
			}
		});
	}
	
	$('#cycle').cycle({ 
		fx:     'fade', 
		speed:  'fast',
		startingSlide: start,
		timeout: 0, 
		next:   '#volgende', 
		prev:   '#vorige',
		after: onAfter
	});

	
});
