var name = "#floatMenu";
var menuYloc = null;

$(document).ready(function(){
	//setInterval ( "slideSwitch(2000, 'slideshow_home_1')", 5000 );
	
	//show addthis buttons
	$('#addthis_div').show();
	
	$(".article_img_thumb a[rel=group], .article_img_lowres a[rel=group]").fancybox({
		'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'titlePosition' 	: 'over',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Imagem ' + (currentIndex + 1) + ' / ' + currentArray.length + ' - ' + (title.length ? ' ' + title : '') + '</span>';
		}
	});
	
	//datepicker
	$(".datepicker").datepicker({ dateFormat: 'yy-mm-dd' });
});

function slideSwitch(switchSpeed) {
	var $active = $('.slideshow_home img.active');
	
	if ( $active.length == 0 ) $active = $('.slideshow_home img:last');

	var $next =  $active.next('img').length ? $active.next('img')
		: $('.slideshow_home img:first');

	$active.addClass('last-active');
	
	$next.css({opacity: 0.0})
		.addClass('active')
		.animate({opacity: 1.0}, switchSpeed, function() {
			$active.removeClass('active last-active');
		});
}

$(function() {
	setInterval ( "slideSwitch(2000)", 5000 );
});


/* Portuguese initialisation for the jQuery UI date picker plugin. */
jQuery(function($){
	$.datepicker.regional['pt'] = {
		clearText: 'Limpar', clearStatus: '',
		closeText: 'Fechar', closeStatus: '',
		prevText: ' &lsaquo&lsaquo ', prevStatus: '',
		prevBigText: '&#x3c;&#x3c;', prevBigStatus: '',
		nextText: ' &rsaquo&rsaquo ', nextStatus: '',
		nextBigText: '&#x3e;&#x3e;', nextBigStatus: '',
		currentText: '- Hoje -', currentStatus: '',
		monthNames: ['Janeiro','Fevereiro','Mar&ccedil;o','Abril','Maio','Junho',
		'Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],
		monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun',
		'Jul','Ago','Set','Out','Nov','Dez'],
		monthStatus: '', yearStatus: '',
		weekHeader: 'Sm', weekStatus: '',
		dayNames: ['Domingo','Segunda-feira','Ter&ccedil;a-feira','Quarta-feira','Quinta-feira','Sexta-feira','Sabado'],
		dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sab'],
		dayNamesMin: ['Dom','Seg','Ter','Qua','Qui','Sex','Sab'],
		dayStatus: 'DD', dateStatus: 'D, M d',
		dateFormat: 'dd/mm/yy', firstDay: 0, 
		initStatus: '', isRTL: false};
	$.datepicker.setDefaults($.datepicker.regional['pt']);
});
