// JavaScript Document
jQuery(function($){

	// Efeitos do menu
	$("#menu-principal li").hover(function(){
		if($(this).find('ul').length > 0){
			$("#menu-principal li").removeClass("current-menu-active")
			$(this).find('ul').slideUp("fast", function(){
				$(this).parent().addClass("current-menu-active")
				$(this).slideDown(200)
			})
		}
	}, function (){
		if($(this).find('ul').length > 0){
			$(this).find('ul').slideUp(150, function(){
				$(this).parent().removeClass("current-menu-active")
				$(this).slideDown(100)
			})
		}
	})

	// Página Sócios Abre e Fecha detalhes
	$(".socios div").click(function(){
		if($(this).find(".detalhes-socio").css("display") != "block") {
			$(this).find(".detalhes-socio").slideDown("normal")
		} else {
			$(this).find(".detalhes-socio").slideUp("normal")	
		}
	})

	// Widget do twitter
	if ($(document).find("#twitter").length == 1){
		new TWTR.Widget({ id:'twitter', version: 2, type: 'profile',rpp: 3, interval: 6000,  width: 295,  height: 300, theme: { shell: { background: '#bedeeb', color: '#0099cc'}, tweets: {  background: '#ebf6fb',  color: '#666666', links: '#0099cc'}}, features: {scrollbar: false, loop: false, live: false, hashtags: true, timestamp: true, avatars: false, behavior: 'all'}}).render().setUser('searchrh').start();
	}

	//Página Search na Mídia
	$(".listagem-search-midia li img, .listagem-search-midia li .conteudo-de-texto, .thumbs a img").css("opacity", "0.3")
	
	$(".listagem-search-midia li, .thumbs a").hover(function(){
		$(this).find("img").animate({
			opacity:1
		}, 240)
	}, function(){
		$(this).find("img").animate({
			opacity:0.3
		}, 100)
	})
	//
	if ($(".conteudo-de-texto").length >= 1) {
		$(".conteudo-de-texto").hover(function(){
			$(this).animate({
				opacity:1
			}, 240)
		}, function(){
			$(this).animate({
				opacity:0.3
			}, 100)
		})
	}
	
	//Formulários
	$("input, textarea").focus(function(){
		$(this).css("background", "#FBFFDF")
		$(this).parent().find("span").css("color", "#0099CC")
	})
	$("input, textarea").blur(function(){
		$(this).css("background", "#fff")
		$(this).parent().find("span").css("color", "#979797")
	})
	
	// Ir para o Topo da página
	$("a.topo").click(function(){
		$('html,body').animate({scrollTop: $("#rastro").offset().top}, 900)
	})
	
	$("#conteudo .conteudo-divisoria ul .rotulo").qtip({
	   content: {
		  text: function(api) {
			 return $(this).next().clone();
		  },
		  title: function(api) {
			 return $(this).html();
		  }
	   }
	});
	
	jQuery('.menu-item-object-custom a').attr("target", "_blank");

})
