$(document).ready(function() { 	
		
		$.ajax({
		url: "imprensa_js.php",
		cache: false,
		success: function(data) {

			$monthInt = data;
								
			$date = new Date();
			$activeMonth = 12;
			$activeYear = 2009;
			//$activeMonth = $date.getMonth();
			//$activeYear = $date.getFullYear();
			
			
			$url = location.search;
			$pageNum = $.query.get('pageNum');
			$activeMonth = $.query.get('month');
			$activeYear = $.query.get('year');
			//alert($activeMonth+" "+$activeYear)

			if ($url == "" || $url == null && (!$pageNum) && (!$activeMonth) && (!$activeYear)) 
			{
				$('[rel="listYear"]:first a').css( {color:'#8EB92B'} );
				//$('[rel="listMonths"]:first li a[id='+($date.getMonth()+1)+']').css( {color:'#F66113'} );
				$('[rel="listMonths"]:first li a[id='+$monthInt+']').css( {color:'#F66113'} );
				$('[rel="listMonths"]:first').show();
			}
			else 
			{
				switch($activeMonth)
				{
					case "Janeiro": $activeMonth=1; break;
					case "Fevereiro": $activeMonth=2; break;
					case "Março": $activeMonth=3; break;
					case "Abril": $activeMonth=4; break;
					case "Maio": $activeMonth=5; break;
					case "Junho": $activeMonth=6; break;
					case "Julho": $activeMonth=7; break;
					case "Agosto": $activeMonth=8; break;
					case "Setembro": $activeMonth=9; break;
					case "Outubro": $activeMonth=10; break;
					case "Novembro": $activeMonth=11; break;
					case "Dezembro": $activeMonth=12; break;
				}
				
				$('#'+$activeYear).show();
				$('#title_'+$activeYear+' a').css( {color:'#8EB92B'} )
				$('#'+$activeYear+' a[id='+$activeMonth+']').css( {color:'#F66113'} )
			}	
		
			//
			
			$('[rel="listYear"]').click(function() {
				if ($('[rel="listYear"]').size() > 1) {
					$('[rel="listMonths"]:visible').slideUp("fast");  //ACTIVA OU DESACTIVA O SLIDE
				}
				$(this).next().slideDown("fast");  
				return false;  
			});
			
			//
			$('#arquivoImprensa .activeMonth').click(function(event) {
				if (!$activeYear) {$activeYear = 2009;}
				//if (!$activeYear) {$activeYear = $date.getFullYear();}
				$activeMonth = $(event.target).attr('id');
				window.location.href = this+"?pageNum=1&year="+$activeYear+"&month="+$activeMonth;
			});
		
			$('#arquivoImprensa h4 a').click(function(event) {
				$activeYear = $(event.target).text();
			});
	
	
			//---
		},
	});
		
});  