/*
/*	Dynamic design functions and onLoad events
/*	----------------------------------------------------------------------
/* 	Creates added dynamic functions and initializes loading.
*/


// ======================================================================
//
//	On document ready functions
//
// ======================================================================

$(document).ready(function() {
	
	$('.tip[title]').qtip({
			position: { target: 'mouse' },
			style: { 
				name: 'blue',
				lineHeight: '24px',
				fontSize: '12px',
				tip: 'topLeft'
			},
		});
		
		$('.tip2[title]').qtip({
			position: { target: 'mouse' },
			style: { 
				name: 'light',
				lineHeight: '12px',
				fontSize: '10px',
				tip: 'topLeft'
			},
		});
		
		

	// Elementi form
	// -------------------------------------------------------------------			
	$("input.cf_upload").filestyle({ 
          image: "http://scuolesancarlo.org/wp-content/themes/images/carica.png",
          imageheight : 25,
          imagewidth : 80,
          width : 205
      });

	// Menu superfish
	// --------------------------------------------------------------------
	$('ul.menu_oriz').superfish(); 
	
	
	// SELETTORRE DELLE SEDI
	$('span.attuale').click(function () {
    $('ul.menu_sedi').slideToggle('medium');
    });
	
	
	// SELETTORRE DEI BLOG
	$('span.attuale_blog').click(function () {
    $('ul.menu_blog').slideToggle('medium');
    });
	
	
	
	// TABS
	// --------------------------------------------------------------------
	//Default Action
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content
	
	//On Click Event
	$("ul.tabs li").click(function() {
		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});




	$(window).load(function() {
		$('#slider').nivoSlider({
			effect:'fade', //Specify sets like: 'fold,fade,sliceDown'
			slices:15,
			animSpeed:500, //Slide transition speed
			pauseTime:8000,
			startSlide:0, //Set starting Slide (0 index)
			directionNav:true, //Next & Prev
			directionNavHide:false, //Only show on hover
			controlNav:true, //1,2,3...
			controlNavThumbs:false, //Use thumbnails for Control Nav
			controlNavThumbsFromRel:false, //Use image rel for thumbs
			controlNavThumbsSearch: '.jpg', //Replace this with...
			controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
			keyboardNav:true, //Use left & right arrows
			pauseOnHover:true, //Stop animation while hovering
			manualAdvance:false, //Force manual transitions
			captionOpacity:0.8, //Universal caption opacity
			beforeChange: function(){},
			afterChange: function(){},
			slideshowEnd: function(){}, //Triggers after all slides have been shown
			lastSlide: function(){}, //Triggers when last slide is shown
			afterLoad: function(){} //Triggers when slider has loaded
		});
	});
	
});
