var jserror;

function mycarousel_initCallback(carousel) {
	jQuery('#prev').bind('click', function() {
		carousel.prev();
		checkbuttons(carousel);
		return false;	
	});
	jQuery('#next').bind('click', function() {
		carousel.next();
		checkbuttons(carousel);
		return false;												  
	});
	checkbuttons(carousel);

};

function checkbuttons(carousel) {
if (document.getElementById('prev')) {
		if (carousel.last == carousel.size()) { 
			// End of list
			document.getElementById('prev').style.display='block';
			document.getElementById('next').style.display='none';
		} else if (!carousel.first) {
			// Start of List
			document.getElementById('prev').style.display='none';
			document.getElementById('next').style.display='block';
		} else {  
			// Middle
			document.getElementById('prev').style.display='block';
			document.getElementById('next').style.display='block';
		}
	}
}

jQuery(document).ready(function() {
    jQuery("#mycarousel").jcarousel({
        scroll: 1,
        initCallback: mycarousel_initCallback,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
	if (jserror) { alert(jserror); }
});

function requirelogin() {
	alert('Sorry, but downloads are only available to account holders.\n\nIf you have an account then please login on the left, \notherwise please contact us.');
	return false;
}
