jQuery(document).ready(function() {

//configure and initialise jCarousel
    jQuery('#articleCarousel').jcarousel({
        // Configuration goes here
        vertical : true,
        scroll : 1
    });

//remove noJS class if JS is enabled (for non-JS version to be styled differently)
	$('#articleCarousel').removeClass('noJS');


//exchange the big image when clicked on a thumbnail
	$('#articleCarousel a').click(function (e) {
		//get src of the thumbnail
		thumb = $(this).children().attr('src');
    	thumbSrc = thumb.substr(thumb.lastIndexOf('=')+1);
		
		//get src of the big image
		bigImg = $('#machineImagesContainer .imageContainer img');
		bigImgSrc = $('#machineImagesContainer .imageContainer img').attr('src');
		bigImgPrefix = bigImgSrc.substring(0, bigImgSrc.lastIndexOf('=')+1);

		//exchange src of the big image with the src of the thumbnail
		bigImg.attr('src', bigImgPrefix + thumbSrc);
		
		//don't follow the link
		e.preventDefault();
		return false;
    });

//TODO: preloading images

});

