$(document).ready(function(){


/* menu drop-down topo */
	$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)

	$("ul.topnav li.c").hover(function() { //When trigger is hover…
		$(this).css('background-color','#2e2e2e');
		
		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click

		$(this).parent().hover(function() {
		}, function(){
			$(this).parent().find("ul.subnav").slideUp('fast'); //When the mouse hovers out of the subnav, move it back up
			$("ul.topnav li.c").css('background-color','#222');
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() {
			$(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});


/* limpa texto busca */
	$(".bottom .busca input").focus(function() { 
			$(this).animate({width: "230px"}, 240 );
				$(".bottom .busca label.lupa").css('background-position','bottom');
			var valor = $(this).val();
			if (valor=='Buscar no Blog do Hugo'){ $(this).css('color','black').css('font-size','16px');  $(this).val(''); }
	});
	
	$(".bottom .busca input").blur(function() { 
			$(this).animate({width: "180px"}, 240 );
				$(".bottom .busca label.lupa").css('background-position','top');
			var valor = $(this).val();
			if (valor==''){ $(this).css('color','#999').css('font-size','13px');  $(this).val('Buscar no Blog do Hugo'); }
	});

	
/* abrir posts relacionados */
$(".related h4").click(function() { 
			 $(".related ul").slideToggle("medium");
			 $(".related h4 span").toggle(0);
});
	
/* mostrar REPLY BUTTON nos comentaros */
$(".jo").hover(function() { 
			 $(this).find(".reply a").addClass('b');
	},function() {$(this).find(".reply a").removeClass('b');});
	
/* slides */
		$(function(){
			$('#slides').slides({
				play: 5000,
				pause: 2100,
				hoverPause: false,
				animationStart: function(current){
					$('.caption').animate({
						bottom:-55
					},100);
					if (window.console && console.log) {
						// example return of current slide number
						console.log('animationStart on slide: ', current);
					};
				},
				animationComplete: function(current){
					$('.caption').animate({
						bottom:0
					},200);
					if (window.console && console.log) {
						// example return of current slide number
						console.log('animationComplete on slide: ', current);
					};
				},
				slidesLoaded: function() {
					$('.caption').animate({
						bottom:0
					},200);
				}
			});
		});



});
