function tvaoficial() {
	$("#twitter").getTwitter({
		userName: "tvaoficial",
		numTweets: 4,
		loaderText: "Carregando tweets...",
		slideIn: true,
		slideDuration: 750,
		showHeading: true,
		headingText: "acompanhe a programa&ccedil;&atilde;o",
		showProfileLink: true,
		showTimestamp: true
	});
};
function tvaprogramacao() {
	$("#twitter").getTwitter({
		userName: "tvaprogramacao",
		numTweets: 4,
		loaderText: "Carregando tweets...",
		slideIn: true,
		slideDuration: 750,
		showHeading: true,
		headingText: "acompanhe a programa&ccedil;&atilde;o",
		showProfileLink: true,
		showTimestamp: true
	});
};
function showCreditos() {
	$(".mask").show();
	$(".creditos").show();
};
function hideCreditos() {
	$(".mask").hide();
	$("div.creditos").hide();
};
function validaForm(){
	with (document.commentform) {
	
		if (!aceito.checked) {
			$('.termo-de-uso').remove();
			$('#body').append('<a href="javascript:fechar();" class="termo-de-uso" style="display:block; border:6px solid #ddd;background:#fff;height:38px;width:319px;position:absolute;text-align:center;padding-top:24px;bottom:80px; left:100px; z-index:90; cursor:pointer">Para comentar &eacute; preciso concordar com o termo de uso</a>')
			return false;
		}
	}
};
function fechar() {
	$('.termo-de-uso').fadeOut();
};
$(function(){
	$("#twitter").getTwitter({
		userName: "tvaoficial",
		numTweets: 4,
		loaderText: "Carregando tweets...",
		slideIn: true,
		slideDuration: 750,
		showHeading: true,
		headingText: "acompanhe a programa&ccedil;&atilde;o",
		showProfileLink: true,
		showTimestamp: true
	});
	$('.filtro p a').click(function(){
		$('.filtro p a').removeClass('ativo');
		$(this).addClass('ativo');
	});
	$('.sidebar>ul').css('margin-left','17px');
	
	$('.arquivosLista li').hide();
	var ano = null;
	
	var t = window.location.href;
	t = t.split('/');
	var l = t.length;
	var y = l - 3;
	if (t[y] == '2009'){
		ano = '2009';
		$('.blogBar.arquivos span').text('2009');
	} else if (t[y] == '2010'){
		ano = '2009';
		$('.blogBar.arquivos span').text('2010');
	} else if (t[y] == '2011'){
		ano = '2009';
		$('.blogBar.arquivos span').text('2011');
	} else if (t[y] == '2012'){
		ano = '2009';
		$('.blogBar.arquivos span').text('2012');
	} else if (t[y] == '2013'){
		ano = '2009';
		$('.blogBar.arquivos span').text('2013');
	} else {
		ano = $('.blogBar.arquivos span').text();	
	};
	ano = $('.blogBar.arquivos span').text();
	var b = null;
	$('.arquivosLista li a').each(function(){
		var a = $(this).attr('title');
		a = a.split(' ');
		if (a[1] != b) {
			$('.paginacao').append('<a href="'+a[1]+'">'+a[1]+'</a>');
			b = a[1];
		};
		if(a[1] == ano){
			$(this).parent('li').show();
		};
		var m = a[0];
        m = m.replace(new RegExp('[ç]', 'gi'), 'c');
		$(this).parent('li').addClass(m);
		$(this).text(a[0]);
	});
	var mn = l - 2;
	var month = new Array('janeiro','fevereiro','março','abril','maio','junho','julho','agosto','setembro','outubro','novembro','dezembro');
	var monthN = new Array('01','02','03','04','05','06','07','08','09','10','11','12');
	var mesAtivo = null;
	for (var i = 0; i < month.length; i++){
		if(monthN[i] == t[mn]){
			mesAtivo = month[i];
		};
	};
	$('.arquivosLista li a').each(function(){
		if($(this).text() == mesAtivo){
			if($(this).parent('li').attr('style') == 'display: list-item;'){
				$(this).parent('li').addClass('ativo');
			};
		};
	});
	
	$('.paginacao a').live('click', function(){
		var x = $(this).text();
		$('.blogBar.arquivos span').text(x);
		$('.arquivosLista li').hide();
		$('.arquivosLista li a').each(function(){
			var a = $(this).attr('title');
			a = a.split(' ');
			if(a[1] == x){
				$(this).parent('li').show();
			};
		});
		return false;
	});
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
});
