// JavaScript Document

$(function() {
	$('#menu').droppy();
});

function menu(id){
	
	submenu = $("#sub_"+id);
	varlink = $("a#mais"+id);
	
	for(i = 1; i <= 8; i++){
		if(Number(i) != Number(id)){
			$("#sub_"+i).slideUp();			
			$("a#mais"+i).attr("class", "mais");			
		}
	}
	
	if(varlink.attr("class") == "mais"){
		submenu.slideDown();
		varlink.attr("class", "menos");
	}else{
		submenu.slideUp();
		varlink.attr("class", "mais");
	}
	
}

function depoimentos(id){
	
	depoimento = $("#depo_"+id);
	varlink = $("a#abre"+id);
	
	for(i = 1; i <= 8; i++){
		if(Number(i) != Number(id)){
			$("#depo_"+i).fadeOut(0);			
			$("a#abre"+i).attr("class", "abre");			
		}
	}
	
	if(varlink.attr("class") == "abre"){
		depoimento.fadeIn();
		varlink.attr("class", "fecha");
	}else{
		depoimento.fadeOut(0);
		varlink.attr("class", "abre");
	}
	
}

function Formulario() {
	var obj = document.formulario;
	if(obj.nome.value == "") {
		alert('Preencha o campo Nome!');
		obj.nome.focus();
	}
	else if(obj.email.value == "") {
		alert('Preencha o campo E-mail!');
		obj.email.focus();
	}
	else if(obj.email.value.indexOf('@') < 1 ){
		alert('E-mail incorreto!');
		obj.email.focus();
	}
	
	else if(obj.ddd.value == "") {
		alert('Informe o ddd!');
		obj.ddd.focus();
	}	
	else if(obj.tel.value == "") {
		alert('Informe o Telefone!');
		obj.email.focus();
	}
	else if(obj.mensagem.value == "") {
		alert('Preencha o campo Mensagens!');
		obj.mensagem.focus();
	}
	else {
		obj.submit();
	}

}

function Trabalhe() {
	var obj = document.trabalhe;
	if(obj.nome.value == "") {
		alert ('Preencha o campo Nome!');
		obj.nome.focus();
	}
	else if(obj.email.value == "") {
		alert ('Preencha o campo E-mail!');
		obj.email.focus();
	}
	else if(obj.email.value.indexOf('@') < 1 ) {
		alert('E-mail incorreto!');
		obj.email.focus();
	}
	else if(obj.ddd.value == "") {
		alert('Informe o ddd!');
		obj.ddd.focus();
	}
	else if(obj.tel.value == "") {
		alert('Informe o Telefone');
		obj.tel.focus();
	}
	else if(obj.cargo.value == "") {
		alert('Informe o Cargo desejado!');
		obj.cargo.focus();
	}
	else if(obj.curriculo.value == "") {
		alert('Informe o Anexo!');
		obj.curriculo.focus();
	}
	else {
		obj.submit()
	}
}
