/**
 * Start all the scripts that require initializing when jQuery is ready
 * For exclusive use with the Magzimus theme
 *
 * Author: Oscar Alcala
 * Website: http://www.themeforest.net?ref=BioXD
**/

jQuery(document).ready(function($) {
	
	// This allows the sidebar widgets to display properly, do not remove or the layout will break!
	$('.widget_title').each(function(){ $(this).prependTo(this.parentNode.parentNode); });
	
	// Start the sliders
	var slides = $('.slider_thumbnail').size() - 1;
	var ts_slider_speed = $('#ts_slider_speed').attr('value') * 1000;
	
	

	
	$('#slider').nivoSlider({
		effect: 'fade',  
		        slices: 1, // For slice animations
        boxCols: 1, // For box animations
        boxRows: 1, // For box animations
        animSpeed: 900, // Slide transition speed
        pauseTime: 3000, // How long each slide will show
        startSlide: 0, // Set starting Slide (0 index)
		controlNavThumbs: false, // Use thumbnails for Control Nav
        controlNavThumbsFromRel: false, // Use image rel for thumbs
		controlNav: false, 
		directionNav: false
	});
	
		$('.ngg-widget').nivoSlider({
		effect: ' fade',  
		animSpeed: 1200,
		pauseTime: ts_slider_speed,
		pauseOnHover: false, 
		controlNav: false, 
		directionNav: false, 
		
	});
	$('.ngg-widget .nivo-caption').remove();
		$('#slider-container .nivo-caption').remove();

	// Start Cufon
	Cufon.now();
	Cufon.refresh();
	
	$("#categories_menu li").hover(function(event) {
		$('.sub-menu', this).slideToggle(300);
	});
	
	// 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(){} 
			});	

});
