/**
 * Start all the scripts that require initializing when jQuery is ready
 * For exclusive use with the Magzimus theme
 *
 
**/

// Initialise the Superfish Menu (http://users.tpg.com.au/j_birch/plugins/superfish/)
// Secondary Navigation
$(document).ready(function() { 
        $('#secondary-nav ul').superfish({ 
            delay: 100,
            animation: {opacity:'show', height:'show'},
            speed: 'fast',
            autoArrows: false,
            dropShadows: false
        }); 
    });
    
$(document).ready(function() { 
        $('#primary-nav ul').superfish({ 
            delay: 200,
            animation: {opacity:'show', height:'show'},
            speed: 'slow',
            autoArrows: false,
            dropShadows: false
        }); 
    });

jQuery(document).ready(function($) {
	
	// Start the sliders
	var slides = $('.slider_thumbnail').size() - 1;
	var ts_slider_speed = $('#ts_slider_speed').attr('value') * 1000;
	
	
		$('.slider_thumbnail[rel=0]').animate({
			opacity: 0.8,
		}, 600);
	
	
	$('#slider').nivoSlider({
		effect: 'fold, fade, sliceUpDownLeft, sliceUpDown',  
		animSpeed: 1200,
		pauseTime: ts_slider_speed,
		pauseOnHover: false, 
		controlNav: false, 
		directionNav: false, 
		beforeChange: function() {
			$('.current_slide').animate({
				opacity: 1,
			}, 1000);
		}, 
		afterChange: function() {
			$('.slider_thumbnail[rel=' + currentSlide + ']').animate({
				opacity: 0.8,
			}, 600);
			$('.current_slide').removeClass('current_slide');
			$('.slider_thumbnail[rel=' + currentSlide + ']').addClass('current_slide');
		}
	});
	
	// Start Cufon
	Cufon.now();
	
	// Start the gallery 
	$(".gallery a").attr('rel', 'gallery');
	$("a[rel^='gallery']").prettyPhoto({
				animationSpeed: 'normal', 
				opacity: 0.75, 
				showTitle: false, 
				allowresize: true, 
				counter_separator_label: '/', 
				theme: 'dark_rounded', 
				hideflash: false, 
				modal: false, 
				changepicturecallback: function(){}, 
				callback: function(){} 
			});	

});
