<!--

function ver_metodos(seminario){
  var sem_cafecomdeus = document.forms['inscricao'].sem_cafecomdeus;
  var sem_liturinclu = document.forms['inscricao'].sem_liturinclu;
  var sem_usoimagem = document.forms['inscricao'].sem_usoimagem;

  if(sem_cafecomdeus.checked && sem_liturinclu.checked && sem_usoimagem.checked){
    seminario.checked = false;
    alert("Você só pode selecionar 2 seminários. Por favor, verifique a sua seleção.");
  }
}

function ver_plantaca(seminario){
  var sem_parcerias = document.forms['inscricao'].sem_parcerias;
  var sem_grupobase = document.forms['inscricao'].sem_grupobase;
  var sem_minchaves = document.forms['inscricao'].sem_minchaves;

  if(sem_parcerias.checked && sem_grupobase.checked && sem_minchaves.checked){
    seminario.checked = false;
    alert("Você só pode selecionar 2 seminários. Por favor, verifique a sua seleção.");
  }
}

function verif_inscri(){
  var nome = document.forms['inscricao'].nome;
  var cracha = document.forms['inscricao'].cracha;
  var cpf = document.forms['inscricao'].cpf;
  var dn = document.forms['inscricao'].dn;
  var end = document.forms['inscricao'].end;
  var bairro = document.forms['inscricao'].bairro;
  var cidade = document.forms['inscricao'].cidade;
  var estado = document.forms['inscricao'].estado;
  var cep = document.forms['inscricao'].cep;
  var tel = document.forms['inscricao'].tel;
  var cel = document.forms['inscricao'].cel;
  var email = document.forms['inscricao'].email;
  var prof = document.forms['inscricao'].prof;
  var denom = document.forms['inscricao'].denom;
  var tipo = document.forms['inscricao'].tipo;

  if(nome.value && cracha.value && cpf.value && dn.value && end.value && bairro.value && cidade.value && estado.value && cep.value && tel.value && cel.value && email.value && prof.value && denom.value){
    if(tipo.value == "internet"){
      if(document.forms['inscricao'].sem_internet.checked){
        document.forms['inscricao'].submit();
      }
      else{
        alert("Existem campos obrigatórios em branco. Por favor verifique e tente novamente.");
      }
    }
    else{
      document.forms['inscricao'].submit();
    }
  }
  else{
    alert("Existem campos obrigatórios em branco. Por favor verifique e tente novamente.");
  }
}

addEvent = function(o, e, f, s){
  var r = o[r = "_" + (e = "on" + e)] = o[r] || (o[e] ? [[o[e], o]] : []), a, c, d;
  r[r.length] = [f, s || o], o[e] = function(e){
    try{
      (e = e || event).preventDefault || (e.preventDefault = function(){e.returnValue = false;});
      e.stopPropagation || (e.stopPropagation = function(){e.cancelBubble = true;});
      e.target || (e.target = e.srcElement || null);
      e.key = (e.which + 1 || e.keyCode + 1) - 1 || 0;
    }catch(f){}
    for(d = 1, f = r.length; f; r[--f] && (a = r[f][0], o = r[f][1], a.call ? c = a.call(o, e) : (o._ = a, c = o._(e), o._ = null), d &= c !== false));
    return e = null, !!d;
    }
};

removeEvent = function(o, e, f, s){
  for(var i = (e = o["_on" + e] || []).length; i;)
    if(e[--i] && e[i][0] == f && (s || o) == e[i][1])
      return delete e[i];
  return false;
};

MaskInput = function(f, m){
  function mask(e){
    var patterns = {"1": /[A-Z]/i, "2": /[0-9]/, "4": /[\xC0-\xFF]/i, "8": /./ },
      rules = { "a": 3, "A": 7, "9": 2, "C":5, "c": 1, "*": 8};
    function accept(c, rule){
      for(var i = 1, r = rules[rule] || 0; i <= r; i<<=1)
        if(r & i && patterns[i].test(c))
          break;
        return i <= r || c == rule;
    }
    var k, mC, r, c = String.fromCharCode(k = e.key), l = f.value.length;
    (!k || k == 8 ? 1 : (r = /^(.)\^(.*)$/.exec(m)) && (r[0] = r[2].indexOf(c) + 1) + 1 ?
      r[1] == "O" ? r[0] : r[1] == "E" ? !r[0] : accept(c, r[1]) || r[0]
      : (l = (f.value += m.substr(l, (r = /[A|9|C|\*]/i.exec(m.substr(l))) ?
      r.index : l)).length) < m.length && accept(c, m.charAt(l))) || e.preventDefault();
  }
  for(var i in !/^(.)\^(.*)$/.test(m) && (f.maxLength = m.length), {keypress: 0, keyup: 1})
    addEvent(f, i, mask);
};

var isNN = (navigator.appName.indexOf("Netscape")!=-1);

function autoTab(input,len, e) {
  var keyCode = (isNN) ? e.which : e.keyCode; 
  var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
  if(input.value.length >= len && !containsElement(filter,keyCode)) {
    input.value = input.value.slice(0, len);
    input.form[(getIndex(input)+1) % input.form.length].focus();
  }

  function containsElement(arr, ele) {
    var found = false, index = 0;
    while(!found && index < arr.length)
    if(arr[index] == ele)
    found = true;
    else
    index++;
    return found;
  }

  function getIndex(input) {
    var index = -1, i = 0, found = false;
    while (i < input.form.length && index == -1)
    if (input.form[i] == input)index = i;
    else i++;
    return index;
  }
  return true;
}

function enviar_anotacoes() {
  //verifica se o browser tem suporte a ajax
  var ajax;

  try {
    ajax = new XMLHttpRequest();
  }
  catch(e) {
    try {
      ajax = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch(e) {
      try {
        ajax = new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch(e) {
        alert("Esse browser não tem recursos para uso do Ajax");
        ajax = null;
      }
    }
  }
  //se tiver suporte ajax
  if(ajax) {
    email = document.getElementById('email').value;
    var oEditor = FCKeditorAPI.GetInstance('anotacoes') ;
    anotacoes = utf8_encode(proc_texto(oEditor.GetXHTML()));
    parms = "email="+email+"&anotacoes="+anotacoes;
    //deixa apenas o elemento 1 no option, os outros são excluídos
    ajax.onreadystatechange = function() {
      //após ser processado - avisa enviado ou não
      if(ajax.readyState == 4 ) {
        if(ajax.responseText) {
          var texto = ajax.responseText;
          texto = texto.replace(/\+/g," ");
          texto = unescape(texto);
          alert(texto);
        }
        else {
          //caso não seja um arquivo texto emite a mensagem abaixo
          alert("Erro ao tentar enviar o e-mail! Por favor, tente novamente ou entre em contato.");
        }
      }
    }
    ajax.open("POST", "inc/env_anot.php", true);
    ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    ajax.setRequestHeader("charset", "utf-8");
    ajax.send(parms);
  }
}

function utf8_encode ( string ) {
    string = (string+'').replace(/\r\n/g, "\n").replace(/\r/g, "\n");

    var utftext = "";
    var start, end;
    var stringl = 0;

    start = end = 0;
    stringl = string.length;
    for (var n = 0; n < stringl; n++) {
        var c1 = string.charCodeAt(n);
        var enc = null;

        if (c1 < 128) {
            end++;
        } else if((c1 > 127) && (c1 < 2048)) {
            enc = String.fromCharCode((c1 >> 6) | 192) + String.fromCharCode((c1 & 63) | 128);
        } else {
            enc = String.fromCharCode((c1 >> 12) | 224) + String.fromCharCode(((c1 >> 6) & 63) | 128) + String.fromCharCode((c1 & 63) | 128);
        }
        if (enc != null) {
            if (end > start) {
                utftext += string.substring(start, end);
            }
            utftext += enc;
            start = end = n+1;
        }
    }

    if (end > start) {
        utftext += string.substring(start, string.length);
    }

    return utftext;
}

function proc_texto(texto){
  texto = str_replace("&Aacute;", "Á", texto);
  texto = str_replace("&Acirc;", "Â", texto);
  texto = str_replace("&Agrave;", "À", texto);
  texto = str_replace("&Atilde;", "Ã", texto);
  texto = str_replace("&Auml;", "Ä", texto);
  texto = str_replace("&Eacute;", "É", texto);
  texto = str_replace("&Ecirc;", "Ê", texto);
  texto = str_replace("&Egrave;", "È", texto);
  texto = str_replace("&Euml;", "Ë", texto);
  texto = str_replace("&Iacute;", "Í", texto);
  texto = str_replace("&Icirc;", "Î", texto);
  texto = str_replace("&Igrave;", "Ì", texto);
  texto = str_replace("&Iuml;", "Ï", texto);
  texto = str_replace("&Oacute;", "Ó", texto);
  texto = str_replace("&Ocirc;", "Ô", texto);
  texto = str_replace("&Ograve;", "Ò", texto);
  texto = str_replace("&Otilde;", "Õ", texto);
  texto = str_replace("&Uuml;", "Ö", texto);
  texto = str_replace("&Uacute;", "Ú", texto);
  texto = str_replace("&Ucirc;", "Û", texto);
  texto = str_replace("&Ugrave;", "Ù", texto);
  texto = str_replace("&Uuml;", "Ü", texto);
  texto = str_replace("&Yacute;", "Ý", texto);
  texto = str_replace("&Ccedil;", "Ç", texto);
  texto = str_replace("&Ntilde;", "Ñ", texto);
  texto = str_replace("&aacute;", "á", texto);
  texto = str_replace("&acirc;", "â", texto);
  texto = str_replace("&agrave;", "à", texto);
  texto = str_replace("&atilde;", "ã", texto);
  texto = str_replace("&auml;", "ä", texto);
  texto = str_replace("&eacute;", "é", texto);
  texto = str_replace("&ecirc;", "ê", texto);
  texto = str_replace("&egrave;", "è", texto);
  texto = str_replace("&euml;", "ë", texto);
  texto = str_replace("&iacute;", "í", texto);
  texto = str_replace("&icirc;", "î", texto);
  texto = str_replace("&igrave;", "ì", texto);
  texto = str_replace("&iuml;", "ï", texto);
  texto = str_replace("&oacute;", "ó", texto);
  texto = str_replace("&ocirc;", "ô", texto);
  texto = str_replace("&ograve;", "ò", texto);
  texto = str_replace("&otilde;", "õ", texto);
  texto = str_replace("&ouml;", "ö", texto);
  texto = str_replace("&uacute;", "ú", texto);
  texto = str_replace("&ucirc;", "û", texto);
  texto = str_replace("&ugrave;", "ù", texto);
  texto = str_replace("&uuml;", "ü", texto);
  texto = str_replace("&yacute;", "ý", texto);
  texto = str_replace("&yuml;", "ÿ", texto);
  texto = str_replace("&ccedil;", "ç", texto);
  texto = str_replace("&ntilde;", "ñ", texto);
  texto = str_replace("&ordm;", "º", texto);
  texto = str_replace("&ordf;", "ª", texto);
  texto = str_replace("&acute;", "´", texto);
  texto = str_replace("&circ;", "^", texto);
  texto = str_replace("&grave;", "`", texto);
  texto = str_replace("&tilde;", "~", texto);
  texto = str_replace("&uml;", "¨", texto);
  texto = str_replace("&#39", "'", texto);
  texto = str_replace("&quot;", '"', texto);
  texto = str_replace("&", "E", texto);

  return texto;
}

function str_replace(search, replace, subject) {
  var s = subject;
  var ra = r instanceof Array, sa = s instanceof Array;
  var f = [].concat(search);
  var r = [].concat(replace);
  var i = (s = [].concat(s)).length;
  var j = 0;
    
  while (j = 0, i--) {
    if (s[i]) {
      while (s[i] = (s[i]+'').split(f[j]).join(ra ? r[j] || "" : r[0]), ++j in f){};
    }
  }

  return sa ? s : s[0];
}

function playmedia(url) {
  html = '<OBJECT id="Player" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" type="application/x-oleobject" width="320" height="300" standby="Loading Microsoft® Windows® Media Player components...">';
  html += '  <PARAM NAME="AutoStart" VALUE="True">';
  html += '  <PARAM NAME="FileName" VALUE="'+url+'">';
  html += '  <PARAM NAME="ShowControls" VALUE="True">';
  html += '  <PARAM NAME="ShowStatusBar" VALUE="True">';
  html += '  <EMBED';
  html += '   SRC="'+url+'" width="320" height="300"';
  html += '   autostart=1 type="application/x-mplayer2"';
  html += '   pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"';
  html += '   showcontrols="1"';
  html += '   showstatusbar="1">';
  html += '  </EMBED>';
  html += '</OBJECT>';
  document.getElementById('mediaplayer').innerHTML = html;
}

-->
