$(function(){

	$('a[rel~=blank],a[rel~=external]').each(function(){
		$(this).attr('target','_blank');
	});
	
	$('#conteudo .paging:first').center();

	$('.email').pMail();
	
	$.UtilAjax();

	$.addPlugin('flash',null,function(){
		links = [];
		$('#topo #menu li a').each(function(){
			links.push($(this).attr('href'));
		});
		links = encodeURI(links.join(','));
		$('#topo').flash({
			src: DEFAULT_URL + 'swf/topo.swf',
			width: '100%',
			height: 226,
			wmode: 'transparent',
			flashVars: {
				links: links
			}
		}).css({
			position: 'absolute',
			width: '100%',
			left: 0,
			top: 0
		}).next().css({
			'margin-top': '226px'
		});
		
		if($.browser.msie && $.browser.version < 7){
			$(window).resize();
		}
		
		links = [];
		$('#capa #conteudo div#menu_secundario ul li h2 a').each(function(){
			links.push($(this).attr('href'));
		});
		links = encodeURI(links.join(','));
		
		var arvore = $('#capa #conteudo div#menu_secundario ul li.item-arvore-ultima');
		
		$('#capa #conteudo div#menu_secundario').flash({
			src: DEFAULT_URL + 'swf/conteudo.swf',
			width: 990,
			height: 372,
			wmode: 'transparent',
			flashVars: {
				links: links,
				arvore_img: escape(arvore.find('img:first').attr('src')),
				arvore_name: escape(arvore.find('h3:first').text()),
				arvore_endereco: arvore.find('p:first').text()
			}
		});
	});
	if($('#arvores.index #conteudo ul.listagem').length > 0){
		$.addPlugin('biggerlink',null,function(){
			$('#arvores.index #conteudo ul.listagem li').biggerlink({follow:false});
		});
	}
});
if($.browser.msie && $.browser.version < 7) {
	$(window).resize(function(){
		$('#corpo #topo').width($(window).width());
	});
}

$(window).load(function(){
	$('#arvores.index #conteudo ul.listagem li').normalizeHeight('margin');	
	if($.browser.msie && $.browser.version < 7){
		$(window).resize();
	}
});