$(function () {

	$('#menu li').hover(
		function () {
			$(this).find('a span').css({'position': 'absolute', 'margin-left': '-6px;'})
		},
		function () {
			$(this).css({background: 'none'})
		}
	)
	
	$('#language-switcher li a, #navigator li a').hover(
		function () {
			$(this).find('span').stop().animate({'top': '-=10px'})
		},
		function () {
			$(this).find('span').stop().animate({'top': '0'})
		}
	)

	$('#cp').val('8')	
	$('#cp-wrapper').hide()
	
	switchImage()

	$('#product-carousel .content ul').jcarousel({
		auto: 2,
		wrap: 'last',
		initCallback: mycarousel_initCallback
	});

})

function mycarousel_initCallback(carousel)
{

	carousel.buttonNext.bind('click', function() {
		carousel.startAuto(0)
	});
	
	carousel.buttonPrev.bind('click', function() {
		carousel.startAuto(0)
	});
	
	carousel.clip.hover(function() {
		carousel.stopAuto()
	}, function() {
		carousel.startAuto()
	});
	
};


var currentShowcase = '#simg-3';

function switchImage() {
	var previousShowcase = currentShowcase
	if ($(currentShowcase).is(':last-child'))
	{
		currentShowcase = '#' + $('#showcase ul li:first-child').attr('id')
	}
	else
	{
		currentShowcase = '#' + $(currentShowcase).next().attr('id')
	}
	
	$('#showcase li a').css({'opacity': 0, 'display': 'list-item'})
	//$(previousShowcase + ' a').animate({'opacity': 0}, 'slow')
	$(currentShowcase + ' a').animate({'opacity': 1}, 1000)
	
	setTimeout('switchImage()', 3000)
	
}

