$(function(){
	
	// Menu Dropdown
	$(".jd_menu > li").hover(
		function() {
			$(this).addClass("ahover").fadeTo(0, 0.1, function() {
				$(this).fadeTo("slow", 1);
			});
		},

		function() {
			$(this).fadeTo("fast", 0.1, function() {
				$(this).removeClass("ahover");							
				$(this).fadeTo("fast", 1);					   												
			});
			
		}
		
	);
	
	var $div = $("#cxfones");
	var height = $div.height();
	$div.hide().css({ height : 0 });

	$("#toggler").click(function() {
	
		if ( $div.is(":visible") )
		{
			$div.animate({height: 0}, {duration: "slow", complete: function(){
				$div.hide();																					  
			}});
			$("#toggler").text("+ mais");
		}
		else
		{
			$div.show().animate({height: height}, {duration: "slow"});
			$("#toggler").text("- menos");
		}
	
	});
	
	// whois
	$("#whois_lk").click(function(){
		
		mostra = $("#info");
		mostra.html('<img src="/media/loading.gif" align="absmiddle" hspace="3" /> Carregando...');
		title = $(this).attr("title");
		
		cxRetorno = $("#retorno");
		pagina = 'http://tophospedagem.com.br/componentes/whois/whois.php?';
		url = pagina + 'dominio=' + title + '&SESSION_ID='+(Math.random() * 123456789);									  
								  
		$.get(url, function(data){
			cxRetorno.css("background-color", "#efefef");
			cxRetorno.css("border", "1px solid #ccc");
			cxRetorno.html(data);
			mostra.html("");
			mostra.hide();
		});
	});

	// icones do suporte
	$(".opac").css("opacity", 0.5).hover(
		function() {
			$(this).fadeTo("fast", 1);	
		},
		function() {
			$(this).fadeTo("fast", 0.5);	
		}									 
		
	);


	// smooth scroll
	$('a.anchor').click(function() {
	
	if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') 
		&& location.hostname == this.hostname) {
		
			var $target = $(this.hash);
			
			$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
			
			if ($target.length) {
			
				var targetOffset = $target.offset().top;
				
				$('html,body').animate({scrollTop: targetOffset}, 1000);
					
				return false;
				
			}
			
		}
		
	});	
	
	
	$('a[rel*=lightbox]').lightBox();
	
});