$(function(){

	if($('body').attr('id') == 'capa'){
	
		var _links = [];
		$('#conteudo #banner_capa a').each(function(){
			_links.push($(this).attr('href'));
		});
		
		$.addPlugin('flash');
		$('#conteudo #banner_capa').flash({
			src: defaultUrl+'swf/banner_capa.swf',
			width: '100%',
			height: '100%',
			wmode: 'transparent',
			flashvars : {
				links: _links.join('|')
			}
		});
	}

	$('a[rel~=external]').each(function(){
		$(this).attr('target','_blank');
	});

	$('.email').pMail();

	$('.paging').center();

	$('.tooltip').tooltip();

	$('#noticias.ver #conteudo ul.fotos li').each(function(){
		var _class = $(this).attr('class');
		_class = _class.split('item-')[1];
		if(_class % 4 == 0){
			$(this).css({
				'margin-right': 0,
				'padding-right': 0
			});
		}
	});

	$('#noticias.index #conteudo ul.listagem li,#produtos.index #conteudo ul.listagem li').each(function(){
		var _class = $(this).attr('class');
		_class = _class.split('item-')[1];
		if(_class % 3 == 0){
			$(this).css({
				'margin-right': 0,
				'padding-right': 0
			});
		}
	});
	
	$('#capa #conteudo .eventos ul li:even,#classificados #conteudo ul.listagem li:even').addClass('alternate');
	
	$('#capa #conteudo ul.banners li').hover(function(){
		$(this).css({
			'opacity': 0.7
		});
	},function(){
		$(this).css({
			'opacity': 1
		});
	});
	
	(function(){
		var that = $('#capa #conteudo .empresa,#classificados #conteudo ul.listagem li');
		if(that.length > 0){
			$.addPlugin('biggerlink');
			that.biggerlink();
		}
	})();
});
$(window).load(function(){
	$.fn.normalizeHeight = function(){
		var maxHeight = 0;
		$(this).each(function(){
			maxHeight = (maxHeight > $(this).outerHeight()) ? maxHeight : $(this).outerHeight();
		}).each(function(){
			$(this).css({
				'padding-bottom': maxHeight-$(this).outerHeight()+'px'
			});
		});
	}
	$.fn.normalizeHeight2 = function(){
		var maxFirstHeight = 0;
		var maxLastHeight = 0;
		$(this).each(function(){
			maxFirstHeight = (maxFirstHeight > $(this).find(':first').outerHeight()) ? maxFirstHeight : $(this).find(':first').outerHeight();
			maxLastHeight = (maxLastHeight > $(this).find(':last').outerHeight()) ? maxLastHeight : $(this).find(':last').outerHeight();
		}).each(function(){
			$(this).css({
				'padding-top': maxFirstHeight-$(this).find(':first').outerHeight()+'px',
				'padding-bottom': maxLastHeight-$(this).find(':last').outerHeight()+'px'
			});
		});
	}
	$('#noticias.index #conteudo ul.listagem li').normalizeHeight();
	/*$('#produtos.index #conteudo ul.listagem li').normalizeHeight2();*/
});