$(function() {
	/* Banner */
	$("#banner").easySlider( {
		auto : true,
		continuous : true,
		numeric : true,
		speed : 800,
		pause : 5000
	});

});

$(function() {
	$('.btnAcessa').click(function() {
		
		if ($('#login').val() == ''){
			alert('Informe o login.');
			$('#login').focus();
			return false;
		}
		else if ($('#senha').val() == ''){
			alert('Informe a senha.');
			$('#senha').focus();
			return false;
		}
		
		$('#formAreaAluno').submit();
	});
})
$(function() {
	$("#listaConcursos li").hover(function() {
		$("#listaConcursos li").css("cursor", "pointer");
	});
});

$(function() {
	$(".botoes li a").hover(function() {
		$(this).css("cursor", "pointer");
	});
	$(".botoes li a").click(function() {
		$("#slide div").slideUp("slow");
		$(".botoes li a").removeClass("hover");
		var abre = $(this).attr("slide");
		$(this).addClass("hover");
		$("#" + abre).slideDown("slow");
	});
});

function Valida() {
	var form = document.getElementById('form_faleconosco');
	
	if (form.nome.value == '') {
		alert('Preencha seu nome');
		form.nome.focus();
		return false;
	}
	if (form.telefone.value == '') {
		alert('Preencha seu telefone');
		form.telefone.focus();
		return false;
	}
	if (form.email.value == '') {
		alert('Preencha seu email');
		form.email.focus();
		return false;
	}
	if (form.estado.value == '') {
		alert('Preencha o seu Estado');
		form.estado.focus();
		return false;
	}
	if (form.cidade.value == '') {
		alert('Preencha o nome da sua cidade');
		form.nome.focus();
		return false;
	}
	if (form.mensagem.value == '') {
		alert('Preencha sua mensagem');
		form.mensagem.focus();
		return false;
	}

}

function pagamento() {
	$(".pagamento > form").attr('target', '_blank');
	$(".pagamento > form").submit();
}

function buscaformTopo() {
	var busca = $('#busca').val();
	if (busca.trim() == '' || busca == 'digite sua busca') {
		alert('Informe o termo da busca.');
		$('#busca').focus();
		return false;
	}
	return true;
}

function buscaFormRodape() {
	var busca = $('#termo').val();
	if (busca.trim() == '' || busca == 'digite sua busca') {
		alert('Informe o termo da busca.');
		$('#termo').focus();
		return false;
	}
	return true;
}

function busca(tema) {
	$('#categoria').val(tema);
	$('#formNovabusca').submit();

}


function getCidades() {
	estado = $('#estado').val();
	
	$.post(basepath + "principal/getCidades", {
		estado : estado
	}, function(dados) {
		$('#div_cidades').html(dados).slideDown('fast');
	});
}

function escolheCurso(){

	if($('#aluno').val() == 'não'){
		$('#qualCurso').hide();		
	}else{
		$('#qualCurso').show();	
	}
}
function limitaTextarea(valor) {
	quantidade = 500;
	total = valor.length;
		 
	if(total <= quantidade) {
		resto = quantidade- total;
		document.getElementById('contador').innerHTML = resto;
	}else{
		document.getElementById('mensagem').value = valor.substr(0, quantidade);
		alert('Limite de 500 carateres')
		'mensagem'.focus;
	}
	
}

function init(){	
	$('#telefone').mask('(99) 9999-9999');	
	$('#aluno').change(escolheCurso);
}

$(document).ready(init);

