
jQuery(document).ready(function($) {

	// Botão ir para o topo
	$('a.goto-top').click(function() {
		$('body').animate({ scrollTop: 0 }, 1000);
	});

	// Menu principal
	buscafx = true;
	if($.browser.msie) {
		if($.browser.version <= 7)
			buscafx = false;
	}
	
	if(buscafx) {
		$('#header #searchform input').bind('focus', function() {
			$('#header ul.menu').animate({ width: '-=100' });
			$('#header #searchform, #header #searchform input').animate({ width: '+=100' });
		}).bind('blur', function() {
			$('#header ul.menu').animate({ width: '+=100' });
			$('#header #searchform, #header #searchform input').animate({ width: '-=100' });
		});
	
		$('#header ul.menu li:has(ul)').bind('mouseenter', function() {
			$(this).addClass('ativo');
		}).bind('mouseleave', function() {
			$(this).removeClass('ativo');
		});
	}
	
	// Formulário de comentários
	if($('#commentform').length) {

		// Buscando gravatar		
		$('#commentform #email').bind('blur', function() {
			$('#commentform .gravatar').html('<img src="http://www.gravatar.com/avatar/' + hex_md5($(this).val()) + '?s=80&d=http://www.marcelograciolli.com/wp-content/themes/marcelo/img/comentarios-gravatar.gif" alt="" />seu gravatar');
		});
		
	}

});
