jQuery(function() {
	jQuery('.slide img').css({
        opacity: 0
    });
    
    setTimeout(function() {
        jQuery('#homeSlide').cycle({
            random: 1,
            delay:  -5000,
			timeout: 7000
        });

	    jQuery('.slide img').css({
	        opacity: 0
	    });

    }, 1000);
});


// wait until images have loaded before starting cycle
jQuery(window).load(function() {
	// front image rotator
	jQuery('#s1').cycle({ 
		fx:     'fade', 
		timeout:  0, 
		delay:   -2000,
		speed:  'fast',
		pager:  '#thumbs',
        before: onBefore,
		pagerAnchorBuilder: function(idx, slide) { 
        // return selector string for existing anchor 
        return '#thumbs li:eq(' + idx + ') a'; 
    } 
	});
});	

// hide all but the first image when page loads
jQuery(document).ready(function() {
    jQuery('#s1 img').hide();
});

// callback fired when each slide transition begins
function onBefore(curr,next,opts) {
    var jQueryslide = jQuery(next);
    var w = jQueryslide.outerWidth();
    var h = jQueryslide.outerHeight();
    jQueryslide.css({
        marginTop: (550 - h) / 2,
        marginLeft: (530 - w) / 2
    });
};

jQuery(document).ready(function(){
    
	jQuery("h6:last").hide();
	
    jQuery("#contentEvents h5").click(function(){
	
    jQuery(this).next('#contentEvents h6').slideToggle("2000")
	.siblings("#contentEvents h6:visible").slideUp("2000");
	jQuery(this).toggleClass("active");
	jQuery(this).siblings("#contentEvents h6").removeClass("active:");

    });

});