function ajax_post_send_msg()
{
	document.getElementById("id_ajax_loading").style.display = "";
	
	document.getElementById("id_error_msg").innerHTML = "";
	document.getElementById("id_error_msg").style.display = "none";
	
	var complete_name = document.form_contact.str_nome.value+" "+document.form_contact.str_nome_last.value; 
	
	str_msg = "ajax=true&";
	str_msg = str_msg + "option=send_msg&";
	str_msg = str_msg + "str_nome="    + complete_name + "&";
	str_msg = str_msg + "str_empresa=" + document.form_contact.str_empresa.value + "&";
	str_msg = str_msg + "str_cargo="   + document.form_contact.str_cargo.value + "&";
	str_msg = str_msg + "str_email="   + document.form_contact.str_email.value + "&";
	str_msg = str_msg + "str_fone="    + document.form_contact.str_fone.value + "&";
	str_msg = str_msg + "str_estado="  + document.form_contact.str_estado.value + "&";
	str_msg = str_msg + "str_cidade="  + document.form_contact.str_cidade.value + "&";
	str_msg = str_msg + "str_msg="     + document.form_contact.str_msg.value;
	
	url = 'contact.php';
	postDataAjax(url, str_msg, ajax_set_send_msg, "N");
}

function ajax_set_send_msg(str_retorno)
{
  //esse eh uma protecao doida que do nada
  //esta vindo 2 caracteres estranhos no franes
  if(str_retorno.substring(2, 10) == "ERROR#@#")
  {
  	str_retorno = str_retorno.substr(2);
  }
	
  if(str_retorno.substring(0, 8) == "ERROR#@#")
  {
  	str_erro = str_retorno.substring(8);
  	arr_erro = str_erro.split("#@#");
  	
  	str_erro = "";
  	for(it=0; it<arr_erro.length; it++)
  	{
  		if(arr_erro[it] != "")
  		{
  			str_erro = str_erro + arr_erro[it] + "<br />";
  		}
  	}
  	document.getElementById("id_error_msg").innerHTML = str_erro + "<br />";
  	document.getElementById("id_error_msg").style.display = "";
  	
  	document.getElementById("id_ajax_loading").style.display = "none";
  }else
  {
  	if(str_retorno.substring(0, 5) == "OK#@#")
  	{
  		document.getElementById("id_ok_msg").style.display = "";
  		document.getElementById("id_ok_msg").innerHTML     = str_retorno.substring(5) + "<br /><br />";
  		
  		document.getElementById("id_ajax_loading").style.display = "none";
	
		document.getElementById("id_error_msg").innerHTML = "";
		document.getElementById("id_error_msg").style.display = "none";
		
		document.form_contact.str_nome.value    = "";
		document.form_contact.str_empresa.value = "";
		document.form_contact.str_cargo.value   = "";
		document.form_contact.str_email.value   = "";
		document.form_contact.str_fone.value    = "";
		document.form_contact.str_estado.value  = "";
		document.form_contact.str_cidade.value  = "";
		document.form_contact.str_msg.value     = "";
  	}
  }
}
