$(document).ready(function(e) {
    
	$('a.social-link').css({opacity: 0.5});
	$('a.social-link').hover(function(){
		$(this).stop().animate({opacity: 1}, 100);
	}, function(){
		$(this).stop().animate({opacity: 0.5}, 100);
	});
	
	$('.by-keepinlabs a').css({opacity: 0.5});
	$('.by-keepinlabs a').hover(function(){
		$(this).stop().animate({opacity: 1}, 100);
	}, function(){
		$(this).stop().animate({opacity: 0.5}, 100);
	});
	
	$.each($('a.social-link'), function(){
		var qtip_content = $(this).attr('qtip-content');
		var qtip_class = 'ui-tooltip-' + $(this).attr('qtip-class');
		$(this).qtip({
			content: {
				text: qtip_content
			},
			position: {
				my: 'left center',
				at: 'center right',
			},
			style: {
				classes: 'ui-tooltip-rounded ui-tooltip-shadow ui-tooltip-faraguti ' + qtip_class,
				widget: true,
			},
		});
	});
	
	$('#a-email').click(function (e) {
		$('#modal-contato').modal();
		return false;
	});
	
	$('.success').hide();
	$('.error').hide();
	$(".submit").click(function() {
		var nome = $("#nome").val();
		var email = $("#email").val();
		var assunto = $("#assunto").val();
		var mensagem = $("#mensagem").val();
		var dataString = 'nome='+ nome + '&email=' + email + '&assunto=' + assunto + '&mensagem=' + mensagem;
		
		if(nome=='' || email=='' || assunto=='' || mensagem=='')
		{
			$('.success').hide();
			$('.error').fadeIn(200).show();
		}
		else
		{
			$('#contato').fadeOut(100);
			$('.error').fadeOut(100);
			$.ajax({
				type: "POST",
				url: "email.php",
				data: dataString,
				success: function(){
					//alert(e);
					$('.success').fadeIn(200).show();
					$('.error').fadeOut(200).hide();
				}
			});
		}
		return false;
	});
	
});
