$(function(){
	
	$.fn.normalizeHeight = function(){
		var maxheaderheight = 0;
		var maxpheight = 0;
		$(this).each(function(){
			maxheaderheight = (maxheaderheight > $(this).find(':header').outerHeight()) ? maxheaderheight : $(this).find(':header').outerHeight();
			maxpheight = (maxpheight > $(this).find('p').outerHeight()) ? maxpheight : $(this).find('p').outerHeight();
		}).each(function(){
			$(this).css({
				'padding-top': maxheaderheight-$(this).find(':header').outerHeight()+'px',
				'padding-bottom': maxpheight-$(this).find('p').outerHeight()+'px'
			});
		});
	}
	
	if($('#capa').length > 0){
		var links = [];
		$('#capa #conteudo div.produtos ul li a').each(function(){
			links.push($(this).attr('href'));
		});
		$('#banner').flash({
			src: defaultUrl + 'swf/banner_capa.swf?1',
			width: '100%',
			height: '100%',
			wmode: 'transparent',
			flashvars: {
				'defaultUrl': defaultUrl,
				'links': links.join(',')
			}
		});
	}else{
		$('#banner h2').flash({
			src: defaultUrl + 'swf/titulo.swf',
			width: '562',
			height: '60',
			wmode: 'transparent',
			flashvars: {
				'titulo': $('#banner h2').html()
			}
		});
	}
	
	$('#topo h2').flash({
		src: defaultUrl + 'swf/mini_banner.swf',
		width: '86',
		height: '85',
		wmode: 'transparent',
			flashvars: {
				'link': defaultUrl2+'produtos'
			}
	});
	
	$('ul.paging').center('h');
	
	$('.email').pMail();
	
	$('#capa #conteudo .col1,#capa #conteudo .col2').biggerlink();
	
	$('#conteudo-auxiliar ul.produtos li').biggerlink();
	$('#conteudo-auxiliar.noticias ul.noticias li.destaque').biggerlink();
	
	$('#noticias.index #conteudo .destaque').biggerlink();
	$('#noticias.index #conteudo .listagem li').biggerlink();
	$('#noticias.lista #conteudo .listagem li').biggerlink();
	
	$('#portfolio.index ul.items li').biggerlink();
	
	$('#produtos.index #conteudo #prodComSub ul li ul li').biggerlink();
	$('#produtos.index #conteudo #prodSemSub div.clearfix div').biggerlink();
	$('#produtos.categoria #listaCategorias ul li ul li').biggerlink();
	$('#produtos.categoria #listaProdutos ul li').biggerlink().normalizeHeight();
	
	$('#portfolio.index ul.items li').normalizeHeight();
	
});
