var initialised = false;
var infoPaused = false;

function mycarousel_initCallback(carousel)
{
    // enable thumbnail-control functionality
	jQuery('.jcarousel-control a').bind('click', function() {
        carousel.stopAuto();
		var cnt = jQuery.jcarousel.intval(jQuery(this).children('.pgcnt').text());
        carousel.scroll(cnt,true);
        return false;
    });
	
	// Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });
 
    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });
 
    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
    //  Continue autoscrolling after thumbnavigation was used.
        carousel.startAuto(4);
    });

	var initLength = 7;

		var count = 0;
		$("#viewscarousel-wall-of-fame-block li").each(function() {
			count++;
		});
		var lastItem = '.jcarousel-item-'+count;
		$(lastItem).addClass('last-item');
		var container = $('#viewscarousel-wall-of-fame-block');
		container.width(container.width()+500);
};

jQuery(document).ready(function() {
	var listlength = $('#viewscarousel-wall-of-fame-block li').length;
	//zet size op 25 (= 24 inzendingen + info-item.)
	//zonder voorgedefiniëneerde lengte werkt carousel.add() niet in itemLoadCallbackFunction.
    jQuery('#viewscarousel-wall-of-fame-block').jcarousel({
    auto: 10,
    wrap: 'last',
		scroll:1,
		animation:400,
		size:listlength,
		easing:'linear',
    initCallback: mycarousel_initCallback
    });
// plaats gordijnen binnen het jcarousel ivm z-index bug ie8 (volgende en vorige button verdwijnen anders achter gordijnen) 
$('#curtainleft-wof').insertAfter('.jcarousel-clip');
$('#curtainright-wof').insertAfter('#curtainleft-wof');
});
