$=jQuery.noConflict();

$(function(){
	$('input[type=submit]').addClass("botao");  
	$('input[type=text]').addClass("input");
	$('input[type=textarea]').addClass("textarea");
	/* PNGs */
	var badBrowser = (/MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32");
	if (badBrowser) $('img[src$=.png]').each(function() {
		if (!this.complete) this.onload = function() { fixPng(this) };
		else fixPng(this);
	});
	
	$('#slider').scrollable({
		items:'.items',
		size: 1,
		circular:true,
		keyboard: false,
		next:".pro",
		prev:".ant"
	}).autoscroll({interval:8000}).navigator(".navi");


	$('#slider2').scrollable({
		items:'.items2',
		size: 1,
		circular:true,
		keyboard: false,
		next:".pro",
		prev:".ant"
	}).autoscroll({interval:6000}).navigator(".navi2");
	
	$('.silverheader .submenu').hide();
	$('.silverheader a').click(function(){
		$(this).parent().next().slideToggle('normal');
	});
	
	//Botao Indique
	$('#itemIndique').click(function() {
		$('#topoBoxIndique').slideToggle();
	});
	//carrega no calendário os eventos. Exemplo:
	$.ajax({
		url: '/jseventos/',
		success: function(data){
			eval(data);
			//Calendário de eventos (lembrar que tem q carregar os eventos antes de chamar isso aqui. Pode ser um cb de um ajax
			$.datepicker.setDefaults( $.datepicker.regional['pt-BR'] );
			$('#calendario').datepicker({ minDate: new Date(), maxDate: '+7m', showOtherMonths: true, selectOtherMonths: true,
				beforeShowDay: function(data) {
					if (arrEventos[data.getMonth()+1])
						if (arrEventos[data.getMonth()+1][data.getDate()]) return [true,'temEvento',data.toString()];
						else return [false];
					return [false];
				},
				onSelect: function() { return false; },
				onChangeMonthYear: function() { $('#calendarioEventosPopup').remove(); }
			});
			$('.temEvento').live('mouseenter', function() {
				if ($(this).attr('title') != '') $(this).attr({ rel: $(this).attr('title'), title: '' });
				$('#calendarioEventosPopup').remove();
				var data = new Date($(this).attr('rel'));
				$('body').append('<div id="calendarioEventosPopup">' + arrEventos[data.getMonth()+1][data.getDate()] + '</div>');
				$('#calendarioEventosPopup').css({ width: $('#calendarioEventosPopup').width(), position: 'absolute', top: $(this).offset().top + $(this).height(),
					left: ($(this).offset().left + $('#calendarioEventosPopup').width() < $(window).width()) ? $(this).offset().left : ($(this).offset().left + $(this).width()) - $('#calendarioEventosPopup').width() });
			});
			$('#calendarioEventosPopup').live('mouseleave', function() { $(this).remove(); });
		}
	});
	//
});


	
	
