var $j = jQuery.noConflict();

$j(document).ready(function() {
	$j('#slider').cycle({ 
		fx: 'fade', 
		timeout: 7000,
		speed: 1000,
		slideExpr: 'div.slide',
		after:   onAfter
	});
	
function onAfter(curr,next,opts) { 
    if (opts.currSlide==0 || opts.currSlide==1) {
		$j('.button1').addClass('bactive');
		$j('.button2').removeClass('bactive');
		$j('.button3').removeClass('bactive');
		}
	else if (opts.currSlide==2 || opts.currSlide==3) {
		$j('.button1').removeClass('bactive');
		$j('.button2').addClass('bactive');
		$j('.button3').removeClass('bactive');
		}
	else {
		$j('.button1').removeClass('bactive');
		$j('.button2').removeClass('bactive');
		$j('.button3').addClass('bactive');
		}
}

	$j('.button1').click(function() { 
		$j('#slider').cycle(0);
		$j('.button1').addClass('bactive');
		$j('.button2').removeClass('bactive');
		$j('.button3').removeClass('bactive');
		return false; 
	});
	$j('.button2').click(function() { 
		$j('#slider').cycle(2);
		$j('.button1').removeClass('bactive');
		$j('.button2').addClass('bactive');
		$j('.button3').removeClass('bactive');
		return false; 
	}); 
	$j('.button3').click(function() { 
		$j('#slider').cycle(4);
		$j('.button1').removeClass('bactive');
		$j('.button2').removeClass('bactive');
		$j('.button3').addClass('bactive');
		return false;
	});

$j('ul.bottomliste li:last').addClass('last');	
$j('.button3').addClass('lasttexte');	
	$j('#boxes').movingBoxes({
		startPanel   : 2,      // start with this panel
		width        : 520,    // overall width of movingBoxes (not including navigation arrows)
		imageRatio   : 1,      // Image ration set to 1:1 (square image)
		wrap         : true,   // if true, the panel will "wrap" (it really rewinds/fast forwards) at the ends
		buildNav     : false,   // if true, navigation links will be added
		panelType    : '> div' // selector to find the immediate ">" children "li" of "#slider-one" in this case
	});
	$j('#boxes_product').movingBoxes({
		startPanel   : 2,      // start with this panel
		width        : 520,    // overall width of movingBoxes (not including navigation arrows)
		imageRatio   : 1,      // Image ration set to 1:1 (square image)
		wrap         : true,   // if true, the panel will "wrap" (it really rewinds/fast forwards) at the ends
		buildNav     : false,   // if true, navigation links will be added
		panelType    : '> div' // selector to find the immediate ">" children "li" of "#slider-one" in this case
	});
});
