var $j = jQuery.noConflict();
var cCounter = 0;
var cSpeed = 2000;
$j(document).ready(function(){
	// adds the wooden frame on top of the fading pics
	$j('div#content div.wrapper').prepend('<div id="frame"></div>');
	
	// init slider states
	$j('div.f1, div.f2, div.f3, div.f4, div.f5, div.f6, div.f7').css({'display' : 'none'});
	$j('ul#slider').cycle({
		fx: 'aplss',
		//pager: '#jujaju',
		slideExpr: 'img',
		timeout: 8000,
		speed: cSpeed,
		before:  onBefore
	});
	// add ornaments to lower boxes
	$j('div.highlight.range, div.highlight.policy, div.highlight.twitter').prepend('<p class="ornament"></p>');
});
function onBefore(curr, next, opts) {
    var cCurr = opts.currSlide;
    var cNext = opts.nextSlide;
    var theCurrentClass = 'f' + cCurr;
	var theNextClass = 'f' + cNext;
	if(cCounter > 0) {
		$j('div.' + theCurrentClass).fadeOut(cSpeed);
		$j('div.' + theNextClass).fadeIn(cSpeed);
	}
	cCounter++;
}

