/* called immediately after loading*/
jQuery.noConflict( );

/*adjust heights*/
//Event.observe(window, 'load', function() {adjustTopMenuWidth();});
//Event.observe(window, 'resize', function() {adjustLeftBarHeight();});
// jQuery.ready(adjustTopMenuWidth());


jQuery(document).ready(function() {
	adjustTopMenuWidth();
	init_jcarousel('mycarousel');
});

function init_jcarousel(carousel_id){

             jQuery('#'+carousel_id).jcarousel({
			auto: 1,
			wrap: 'null',
			scroll:1,
			animation:2000,
			initCallback: mycarousel_initCallback
		});

}

/*the top menu a elements will get width depending on their char number*/
function adjustTopMenuWidth() {			
	distance_between_top_menu_items = 40;	
	
	jQuery("#top_menu  a").each(function(idx,el) {			
		jQuery(el).width(distance_between_top_menu_items+jQuery(el).width() +'px');
		//el.style.border="1px solid red";
	});

}

function mycarousel_initCallback(carousel)
{
// 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() {
	carousel.startAuto();
});
};
