function mycarousel_initCallback(carousel) {
    jQuery('.jcarousel-control a').bind('click', function() {
		carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
		//jQuery(this).css("background-color","eeeeee")
		//$(".jcarousel-control a").css("background-color","eeeeee");
		//$(this).css("background-color","eeeeee");
		return false;
    });

    jQuery('.jcarousel-scroll select').bind('change', function() {
        carousel.options.scroll = jQuery.jcarousel.intval(this.options[this.selectedIndex].value);
        return false;
    });


  // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });


};

function mycarousel_changeNummer(p1,p2,p3,p4) {
	//p3
	jQuery('.jcarousel-control a').removeClass('selected')
	
	jQuery('.jcarousel-control a').each(function(i) {
		if($(this).html() == p3) {
			$(this).addClass('selected')
		}
	})
	//jQuery('.jcarousel-control a:contains(\''+p3+'\')').addClass('selected')
	
}


jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
	scroll: 1,
     visible: 1,
	auto: 5,
	wrap: 'last',
	initCallback: mycarousel_initCallback,
	itemVisibleInCallback: mycarousel_changeNummer,
     buttonNextHTML: null,
     buttonPrevHTML: null
    });
});