$(function(){
    $('#slider').nivoSlider({
    	effect:'fade', //Specify sets like: 'fold,fade,sliceDown'
    	slices:1,
    	animSpeed:500, //Slide transition speed
    	pauseTime:3000,
    	startSlide:0, //Set starting Slide (0 index)
    	directionNav:false, //Next & Prev
    	directionNavHide:true, //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:false, //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
    });

    
    /**
     * NAVEGAÇÃO CALENDAR
     */
     
     $anterior = $('#calendario').find('a[class="prev-month"]');
     $proximo  = $('#calendario').find('a[class="next-month"]');
     
     if ( $('#site-link-index') ){
     
        var url = $('#site-link-index').attr('href');
     
        $anterior.live('click', function(){
        
            var params = $(this).attr('title').split(':')[1];
            var params_data = params.split('/');
            
            $.post(url+'/complementos/calendarAnterior.ajax.php',{mes: params_data[0], ano: params_data[1]},function(data) {
                $('#calendario').html(data);
            });
        
        });
         
         $proximo.live('click',function(){
            
            var params = $(this).attr('title').split(':')[1];
            var params_data = params.split('/');
            
            $.post(url+'/complementos/calendarProximo.ajax.php', {mes: params_data[0], ano: params_data[1]},function(data) {
                $('#calendario').html(data);
            });
         });
    
    }

    /**
     * TOOLTIP CALENDAR
     */
	 
	$("#calendar a.evento").live('mouseover mouseout', function(event){
		if (event.type == 'mouseover') {
			$(this).append("<div class='tooltipBg'><div class='borderradius'>"+ $(this).children("span").html() +"</div></div>");
		} else {
			$(this).children("div").remove();
		}
	});	

	/**
     * NEWS TICKER
     */
	
	$(function() {
		$(".newsticker-jcarousellite").jCarouselLite({
			vertical: true,
			hoverPause:true,
			visible: 4,
			auto:1000,
			speed:1000
		});
	});


	/****
	* Accordeon DOCs
	*/

	$(".documentos table").hide();

	$(".documentos h3").click(function(){
		$(this).next("table").slideToggle("fast")
		.siblings("table:visible").slideUp("fast");
		$(this).toggleClass("active");
		$(this).siblings("h3").removeClass("active");
	});

	/****
	*   FANCYBOX
	*/

	$("a.lightbox").fancybox({
		'padding'			: '2',
		'autoScale'			: true
	});

	$("a.lightboxEntrevista").fancybox({
			'padding'			: '2',
        	'autoDimensions'	: false,
			'width'         		: 'auto',
			'height'        		: '90%',
			'scrolling'			:'auto',
			'autoScale'		: true
	});
	
	
	/****
	* muda tabela em Alunos - Notas
	*/
	
	$("input[name='nota']").live('change',function(){
		//alert($("input[name='nota']:checked").val());
		$("table.nota").toggleClass("escondida");

	});
	
});

