$.fn.cycle.transitions.scrollHorz = function($cont, $slides, opts) {
	$cont.css('overflow','hidden').width();
	opts.before.push(function(curr, next, opts, fwd) {
		if (opts.rev)
			fwd = !fwd;
		$.fn.cycle.commonReset(curr,next,opts);
		opts.cssBefore.left = fwd ? (next.cycleW-1) : (1-next.cycleW);
		opts.animOut.left = fwd ? -curr.cycleW : curr.cycleW;
	});
	opts.cssFirst = { left: 0 };
	opts.cssBefore= { top: 0 };
	opts.animIn   = { left: 0 };
	opts.animOut  = { top: 0 };
};

$.fn.cycle.transitions.scrollVert = function($cont, $slides, opts) {
	$cont.css('overflow','hidden');
	opts.before.push(function(curr, next, opts, fwd) {
		if (opts.rev)
			fwd = !fwd;
		$.fn.cycle.commonReset(curr,next,opts);
		opts.cssBefore.top = fwd ? (next.cycleH-1) : (1-next.cycleH-1);
		opts.animOut.top = fwd ? -curr.cycleH : curr.cycleH;
	});
	opts.cssFirst = { top: 0 };
	opts.cssBefore= { left: 0 };
	opts.animIn   = { top: 0 };
	opts.animOut  = { left: 0 };
};

$(document).ready(function(){

	$('.ConsoleNoticias').cycle({
		fx:'scrollVert',
		timeout:8000,
		speed: 500,
		cleartypeNoBg: true,
		next:'#btnProximoNoticias',
		prev:'#btnAnteriorNoticias'
	});

	$(".Calendario").datepicker();

	$('body').append('<div id="detalhesData"><p></p></div>');

	$("#detalhesData > a[rel=fechar]").live("click", eventos.OcultaTextoEvento);

	$(".ui-datepicker td a.DiaComEvento").live({
			mouseover: function(e){

			$("#detalhesData").css('display','block');
			$("#detalhesData").css("top",(e.pageY - 10) + "px").css("left",(e.pageX + 10) + "px");
	
		},
		  mouseout: function() {
	
			//$("#detalhesData").css('display','none');
		}
	});

if ($('.ProjetosCycle').children().length>1){

	$('.ProjetosCycle table:not(".MENUSUSPENSO-WRAP table")').wrapAll('<div class="ProjetosCycleWrap" />');

	$('.ProjetosCycle').next().append("<a href='' id='btnAnteriorProjetos'>anterior</a><a href='' id='btnProximoProjetos'>proximo</a>");
	
	$('.ProjetosCycleWrap').cycle({
		fx:'scrollHorz',
		timeout:11000,
		speed: 1000,
		cleartypeNoBg: true,
		next:'#btnProximoProjetos',
		prev:'#btnAnteriorProjetos'
	});
}else{
};

if ($('.PublicacoesCycle').children().length>1){

	$('.PublicacoesCycle table:not(".MENUSUSPENSO-WRAP table")').wrapAll('<div class="PublicacoesCycleWrap" />');

	$('.PublicacoesCycle').next().append("<a href='' id='btnAnteriorPublicacoes'>anterior</a><a href='' id='btnProximoPublicacoes'>proximo</a>");
	
	$('.PublicacoesCycleWrap').cycle({
		fx:'scrollHorz',
		timeout:10000,
		speed: 1000,
		cleartypeNoBg: true,
		next:'#btnProximoPublicacoes',
		prev:'#btnAnteriorPublicacoes'
	});
}else{
};

});
