//Step 2: Define a "callback" function to process the data returned by the Ajax request:
function processGetPost(){
var myajax=ajaxpack.ajaxobj
var myfiletype=ajaxpack.filetype
if (myajax.readyState == 4){ //if request of file completed
if (myajax.status==200 || window.location.href.indexOf("http")==-1){ //if request was successful or running script locally
if (myfiletype=="txt")
//alert(myajax.responseText)
	if(myajax.responseText == "sucesso"){
	document.getElementById('panelSerAluno').innerHTML = "<div style='width: 250px; height:75px; padding-top: 45px; color: white; font-size: 12px; font-weight: bold; text-align:center;'>Formul&aacute;rio enviado com sucesso!<br><br>Aguarde que muito em breve estaremos entrando em contato com voc&ecirc;</div>";	
	}
	if(myajax.responseText == "campo"){
	document.getElementById('erro').innerHTML = "<div style='background-color: white; color: red; width: 250px; padding: 2px; margin-top: 5px; text-align: center; font-size:10px;'>Os campos Nome, Cidade e mais um a sua escolha (E-mail ou Fone) s&atilde;o obrigat&oacute;rios!</div>";
	}
	if(myajax.responseText == "email"){
	document.getElementById('erro').innerHTML = "<div style='background-color: white; color: red; width: 250px; padding: 2px; margin-top: 5px; text-align: center; font-size:10px;'>O E-mail que voc&ecirc; digitou &eacute; inv&aacute;lido!</div>";
	}
	if(myajax.responseText == "ddd"){
	document.getElementById('erro').innerHTML = "<div style='background-color: white; color: red; width: 250px; padding: 2px; margin-top: 5px; text-align: center; font-size:10px;'>Voc&ecirc; precisa digitar o DDD do telefone!</div>";
	}
	if(myajax.responseText == "variavel"){
	document.getElementById('erro').innerHTML = "<div style='background-color: white; color: red; width: 250px; padding: 2px; margin-top: 5px; text-align: center; font-size:10px;'>Erro no formulario - Vari&aacute;vel de seguran&ccedil;a inv&aacute;lida</div>";
	}
	if(myajax.responseText == "timer"){
	document.getElementById('erro').innerHTML = "<div style='background-color: white; color: red; width: 250px; padding: 2px; margin-top: 5px; text-align: center; font-size:10px;'>Sua &uacute;ltima mensagem est&aacute; sendo processada. Aguarde mais alguns segundos para enviar outra.</div>";
	}
else
//alert(myajax.responseXML)
//document.getElementById('panelSerAluno').innerHTML = "<div style='width: 250px; height:75px; padding-top: 45px; color: white; font-size: 12px; font-weight: bold; text-align:center;'>Formul&aacute;rio enviado com sucesso!<br><br>Aguarde que muito em breve estaremos entrando em contato com voc&ecirc;</div>";	
document.getElementById('panelSerAluno').innerHTML == "";	
}
}
}

function createpoststring(){
var quero_nome=document.getElementById("panelSerAluno").serAlunoNome.value //get value to post from a form field
var quero_ddd=document.getElementById("panelSerAluno").serAlunoDDD.value
var quero_fone=document.getElementById("panelSerAluno").serAlunoFone.value
var quero_email=document.getElementById("panelSerAluno").serAlunoEmail.value
var quero_cidade=document.getElementById("panelSerAluno").serAlunoCidade.value
var quero_curso=document.getElementById("panelSerAluno").serAlunoCurso.value
var sec=document.getElementById("panelSerAluno").sec.value
var poststr = "nome=" + encodeURI(quero_nome) + "&sec=" + encodeURI(sec) + "&ddd=" + encodeURI(quero_ddd) + "&fone=" + encodeURI(quero_fone) + "&email=" + encodeURI(quero_email) + "&cidade=" + encodeURI(quero_cidade) + "&curso=" + encodeURI(quero_curso)
return poststr
}

//Step 3: Invoke the Ajax routine method to make the desired Ajax request.
function queroSerAluno(){
	var poststr=createpoststring() //Get contents to post and create query string first
	ajaxpack.postAjaxRequest("/includes/quero_ser_aluno_form.php", poststr, processGetPost, "txt")
}