

//Step 2: Define a "callback" function to process the data returned by the Ajax request:
function processGetPost3(){
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('maisInfoCursoForm').innerHTML = "<div style='width: 270px; height:160px; padding-top: 80px; 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('erroInfoCurso').innerHTML = "<div style='background-color: white; color: red; width: 270px; padding: 2px; margin-top: 5px; text-align: center; font-size:10px;'>Os campos Nome, Cidade e um dado de contato, s&atilde;o obrigat&oacute;rios!</div>";
	}
	if(myajax.responseText == "email"){
	document.getElementById('erroInfoCurso').innerHTML = "<div style='background-color: white; color: red; width: 270px; 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 == "dddt"){
	document.getElementById('erroInfoCurso').innerHTML = "<div style='background-color: white; color: red; width: 270px; padding: 2px; margin-top: 5px; text-align: center; font-size:10px;'>Voc&ecirc; precisa digitar o DDD do telefone!</div>";
	}
	if(myajax.responseText == "dddc"){
	document.getElementById('erroInfoCurso').innerHTML = "<div style='background-color: white; color: red; width: 270px; padding: 2px; margin-top: 5px; text-align: center; font-size:10px;'>Voc&ecirc; precisa digitar o DDD do celular!</div>";
	}
	if(myajax.responseText == "variavel"){
	document.getElementById('erroInfoCurso').innerHTML = "<div style='background-color: white; color: red; width: 270px; 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('erroInfoCurso').innerHTML = "<div style='background-color: white; color: red; width: 270px; 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('maisInfoGeral').innerHTML == "";	
}
}
}
var info_curso_analytics;
function createpoststring3(){
info_curso_analytics = document.getElementById("maisInfoCursoForm").curso.value;
var info_curso_nome=document.getElementById("maisInfoCursoForm").maisInfoCursoNome.value
var info_curso_email=document.getElementById("maisInfoCursoForm").maisInfoCursoEmail.value
var info_curso_foneddd=document.getElementById("maisInfoCursoForm").maisInfoCursoFoneDDD.value
var info_curso_fone=document.getElementById("maisInfoCursoForm").maisInfoCursoFone.value
var info_curso_celularddd=document.getElementById("maisInfoCursoForm").maisInfoCursoCelularDDD.value
var info_curso_celular=document.getElementById("maisInfoCursoForm").maisInfoCursoCelular.value
var info_curso_cidade=document.getElementById("maisInfoCursoForm").maisInfoCursoCidade.value
var info_curso_comentarios=document.getElementById("maisInfoCursoForm").maisInfoCursoComent.value
var info_curso_curso=document.getElementById("maisInfoCursoForm").curso.value
var info_curso_unidade=document.getElementById("maisInfoCursoForm").unidade.value
var info_curso_sec=document.getElementById("maisInfoCursoForm").sec.value
var info_curso_id_curso=document.getElementById("maisInfoCursoForm").id_curso.value
var poststr3 = "nome=" + encodeURI(info_curso_nome) + "&sec=" + encodeURI(info_curso_sec) + "&email=" + encodeURI(info_curso_email) + "&dddt=" + encodeURI(info_curso_foneddd) + "&fone=" + encodeURI(info_curso_fone) + "&dddc=" + encodeURI(info_curso_celularddd) + "&celular=" + encodeURI(info_curso_celular) + "&cidade=" + encodeURI(info_curso_cidade) + "&comentarios=" + encodeURI(info_curso_comentarios) + "&curso=" + encodeURI(info_curso_curso) + "&unidade=" + encodeURI(info_curso_unidade) + "&id_curso=" + encodeURI(info_curso_id_curso);
return poststr3
}

//Step 3: Invoke the Ajax routine method to make the desired Ajax request.
function infoCurso(){
	var poststr3=createpoststring3() //Get contents to post and create query string first
	//codigo para rastrear o acesso a essa pagina via google analytics
	_gaq.push(['_trackPageview', 'cursoAnalytics/'+info_curso_analytics])
	ajaxpack.postAjaxRequest("/curso/informacoes_curso_form.php", poststr3, processGetPost3, "txt");
	
}