function sendFormInscricao(form){
	var id_evento = document.getElementById('id_evento');

	var nome = document.getElementById('nome');
	var sexo_value = getSelectedRadioValue(document.forms[form.name].sexo);
	
	var data_nascimento = document.getElementById('data_nascimento');
	
	var endereco = document.getElementById('endereco');
	var bairro = document.getElementById('bairro');
	var cep = document.getElementById('cep');
	var cidade = document.getElementById('cidade');
	var uf = document.getElementById('uf');
	
	var telefone_a = document.getElementById('telefone_a');
	var telefone_b = document.getElementById('telefone_b');
	var email = document.getElementById('email');
	
	var empresa = document.getElementById('empresa');
	var cargo = document.getElementById('cargo');

	if(nome.value==""){
		alert("O campo \"Nome completo\" precisa ser preenchido.");
		nome.focus();
		return false;
	}
	
	if(sexo_value==""){
		alert("O campo \"Sexo\" precisa ser selecionado.");
		document.getElementById('sexo_m').focus();
		return false;
	}	
	
	if(data_nascimento.value==""){
		alert("O campo \"Data de nascimento\" precisa ser preenchido.");
		data_nascimento.focus();
		return false;
	} else if(!checkDate(data_nascimento.value)){
		data_nascimento.select();
		data_nascimento.focus();
		return false;
	}
	
	if(cep.value==""){
		alert("O campo \"CEP\" precisa ser preenchido.");
		cep.focus();
		return false;
	}	
	
	if(cidade.value==""){
		alert("O campo \"Cidade\" precisa ser preenchido.");
		cidade.focus();
		return false;
	}
	
	if(uf.value=="0"){
		alert("O campo \"UF\" precisa ser selecionado.");
		uf.focus();
		return false;
	}
	
	if(telefone_a.value==""){
		alert("O campo \"Telefone 1\" precisa ser preenchido.");
		telefone_a.focus();
		return false;
	}
	
	if(email.value==""){
		alert("O campo \"E-mail\" precisa ser preenchido.");
		email.focus();
		return false;
	} else if(email.value.indexOf('@')==-1 || email.value.indexOf('.')==-1) {
		alert("O campo \"E-mail\" precisa ser preenchido corretamente.");
		email.select(); 
		return false; 
	}			

	disableEnableFields('disable', form.name);
	loading(1);
	
	var values = "";
	values+= "id_evento="+id_evento.value;
	values+= "&nome="+nome.value;
	values+= "&sexo="+sexo_value;
	values+= "&data_nascimento="+data_nascimento.value;
	values+= "&endereco="+endereco.value;
	values+= "&bairro="+bairro.value;
	values+= "&cep="+cep.value;
	values+= "&cidade="+cidade.value;
	values+= "&uf="+uf.value;	
	values+= "&telefone_a="+telefone_a.value;		
	values+= "&telefone_b="+telefone_b.value;
	values+= "&email="+email.value;
	values+= "&empresa="+empresa.value;
	values+= "&cargo="+cargo.value;
	window.resultadoEnvia = function(r){
		r = unescape(r);
		if(r=="1"){
			loading(0);
			form.reset();
			alert("Obrigado! Sua inscrição foi efetuada.");
			disableEnableFields('enable', form.name);
			return true;
		} else {
			alert("Não foi possível atender sua solicitação.\nO erro retornado foi:\n\n"+r);
			disableEnableFields('enable', form.name);
			loading(0);
			return false;
		}
	}
	saveServer(values, '?h_pg=eventos&bin=form&act=envia', 'resultadoEnvia');	
}

function hideShowForm(){
	var img = document.getElementById('icon_showhideform');
	var text = document.getElementById('textshowhideform');
	var boxform = document.getElementById('formulario_box');
	var path_image = "views/client/eventos/img/";
	if(boxform.style.display == "block"){
		img.src = path_image+"hide_form.gif";
		boxform.style.display = "none";
		text.innerHTML = "Clique aqui para se inscrever neste evento.";
		text.title = "Clique aqui para se inscrever neste evento.";
	} else {
		img.src = path_image+"normal_form.gif";
		boxform.style.display = "block";
		text.innerHTML = "Clique aqui para fechar o formulário abaixo.";
		text.title = "Clique aqui para fechar o formulário abaixo.";
	}
	
}
