$(document).ready(function(){
	$('#menuc .submenu').hide();
	$('#menuc .submenu:first').show();
	$('#menul li a:first').addClass('atual')
	$('#menul li a').click(function(){
		$('#menul li a').removeClass('atual');
		$(this).addClass('atual')
		$('#menuc .submenu').hide();
		$($(this).attr('href')).show();
		$opcao = $(this).attr('href').replace('#', '');
		if($opcao == 'sobre'){
			$('#menut').html('<a href="./curriculo"><img src="images/titulos/' + $opcao + '.png" alt="" /></a>');
		}else{
			$('#menut').html('<img src="images/titulos/' + $opcao + '.png" alt="" />');
		}
		return false;
	});
	$('#formContato').submit(function(){
		if($('#inp_nome').val() == ''){
			$('#inp_nome').focus();
			alert('Preencha o campo Nome!');
		}else if($('#inp_email').val() == ''){
			$('#inp_email').focus();
			alert('Preencha o campo E-mail!');
		}else if($('#inp_mensagem').val() == ''){
			$('#inp_mensagem').focus();
			alert('Preencha o campo Mensagem!');
		}else{
			$.ajax({
				type: 'POST',
				url: 'includes/js/email.php',
				dataType: 'html',
				data: $(this).serialize(),
				success: function(msg){
					var m = msg.split('||');
					if(m[0] == 1){
						$('#formContato .texto').each(function(){
							$(this).val('');
						});
					}
					alert(m[1]);
				}
			});
		}
		return false;
	});
	$('#botoes a').click(function(){
		$aid = $(this).attr('id');
		if($aid == 'btback'){
			history.go(-1);
		}
		if($aid == 'btprint'){
			window.print();
		}
		if($aid == 'btsubir'){
	        var target = $('a[name=' + this.hash.split('#')[1] + ']');
    	    if(target.length){
        	    var targetOffset = target.offset().top - 2;
            	$('html,body').animate({scrollTop: targetOffset}, 'slow');
    	    }
		}
		return false;
	});
	$('.light').lightBox();
	$('.light2').lightBox();
});
