$(function(){

	$('a[rel~=external]').each(function(){
		$(this).attr('target','_blank');
	});

	$('.email').pMail();

	$('.paging').center();
	
	$('#BuscaProduto').initValue($('#BuscaProduto').prev('label').text());
	
	$.UtilAjax();
	$.addPlugin('treeview',null,function(){
		$('#produtos_menu ul:first').treeview({
			collapsed: true,
			animated: true,
			loadCss: false,
			persist: 'location'
		});
		$('#produtos_menu ul:first>li.expandable>div.hitarea').click();
	});
	
	if($('#capa').length>0){
		$.addPlugin('flash',null,function(){
			$('#banner-capa').flash({
				src: DEFAULT_URL + 'swf/capa/topo/banner.swf',
				width: 775,
				height: 166,
				flashVars: {
					defaultUrl: DEFAULT_URL+'swf/capa/topo/',
					links: [
					      DEFAULT_URL+'produtos/ver/1/protetor-pescoco-leatt-brace-gpx-club',
					      DEFAULT_URL+'produtos/marca/4/pirelli',
					      DEFAULT_URL+'produtos/marca/1/alpinestars',
					      DEFAULT_URL+'produtos/ver/193/capacete-ls2-ff-350-patriot'
					].join('|')
				}
			}).css({
				'margin-bottom': '25px'
			});
		});
	}
	
	$('#formNewsletter form div.input input').val('').each(function(){
		$(this).initValue($(this).prev('label').text());
	});
	
	$('#capa #conteudo ul.produtos_listagem li').normalizeHeight(null,3);
	$('#produtos.index #conteudo ul.listagem li').normalizeHeight(null,4);

});