var _HTTP_PATH_ = "http://" + document.domain + "/cedaspy/";

// *********************************
// ADD_RESPOSTA - ENQUETES
// *********************************
function add_imgGaleria(){
  elDiv = document.getElementById('fotos_js');
	nDiv = document.createElement( 'td' );
	nDiv.innerHTML = 'Imagem:&nbsp;<input type="file" name="galeria_imagem[]" size="30"  />';
  elDiv.appendChild( nDiv );
  total_imgs++;
}


function add_resposta(){
  elDiv = document.getElementById('respostas_js');
	nDiv = document.createElement( 'td' );
	nDiv.innerHTML = 'Alternativa&nbsp;<input type="text" name="enquetealt_titulo[]" value="" size="50" maxlength="100" onfocus="this.className=\'input_over\'" onblur="this.className=\'input\'" />';
  elDiv.appendChild( nDiv );
  total_resp++;
}

//onKeyPress="return submitenter(this,event)"
function submitOnEnter(myfield,e){
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

if (keycode == 13)
   {
   myfield.form.submit();
   return false;
   }
else
   return true;
}

function removeImagem (name,imagem,tipo){
    if ( confirm("A imagem será excluída imediatamente.\nDeseja continuar?")){
        div = document.getElementById( name );
        div.innerHTML = '&nbsp;<span style="color:#888;">Imagem excluída com sucesso!</span>';
		if (tipo == 'banners'){
			loadXMLDoc ( 'aj_removeimagem.php?', imagem + '&banners');
		}else if (tipo == 'slideshow'){
			loadXMLDoc ( 'aj_removeimagem.php?', imagem + '&slideshow');
		}else if (tipo == 'galeria'){
			loadXMLDoc ( 'aj_removeimagem.php?', imagem + '&galeria');
		}else{
			loadXMLDoc ( 'aj_removeimagem.php?', imagem );
		}
    }
}

function deleteArquivo(path){
    if ( confirm("O arquivo será excluído imediatamente.\nDeseja continuar?")){
		loadXMLDoc ('aj_removeimagem.php', 'path=' + path);
		return true;
    }
	return false;
}

function deleteImg(path,fileName){
    if ( confirm("A imagem será excluída imediatamente. Deseja continuar?")){
		img_grande = path + '' + fileName;
		img_thumb = path + 't_' + fileName;
		loadXMLDoc ('aj_removeimagem.php', 'path='+img_grande);
		loadXMLDoc ('aj_removeimagem.php', 'path='+img_thumb);
		return true;
    }
	return false;
}

function removeAlternativa(name,id) 
{
    if ( confirm ( "A alternativa será excluída imediatamente.\nDeseja continuar?" ) )
    {
        input = document.getElementById( name );
        input.innerHTML = '&nbsp;<span style="color:#888;">Alternativa excluída com sucesso!</span>';
		loadXMLDoc ( 'aj_removeAlternativa.php?id=', id );
    }
}

function removeImagemGaleria(source, imagem) {
    $.get(
    	'aj_removeimagem.php?' + imagem + '&' + 'galeria',
    	null,
    	function(response) {
    		if ($.trim(response) == "ok")
    			$(source).parent().remove();
    		else
    			alert(response);    		
    	}    	
    );
    return false;
}



var arr_banco_alternativa = new Array();

var n_banco_alternativas = 0;
var qtd_banco_alternativas = 0;
var n_banco_alternativas_max = 5;
var resp_correta_checked = false;
var arr_banco_altern = Array();

function add_banco_alternativa(titulo, ecorreta){
	if (qtd_banco_alternativas >= (n_banco_alternativas_max)){
		alert('Você atingiu o número máximo de alternativas.');
		return false;
	}
	elDiv = document.getElementById('respostas_js');
	nDiv = document.createElement('div');
	if (titulo == undefined) titulo = '';
	htmlTemp = '<a href="#" onclick="remover_banco_alternativa(\'alternativa'+ n_banco_alternativas +'\');return false;"><img src="imgs/icons/delete.gif" width="16" height="16" alt="Excluir alternativa" border="0"/></a> Alternativa&nbsp;<input type="text" name="banco_alternativa_titulo[]" id="banco_alternativa_titulo'+ n_banco_alternativas +'" value="'+ htmlEncode(titulo) + '" style="width:410px;" maxlength="100"  onfocus="this.className=\'input_over\'" onblur="this.className=\'input\'" /> <label><input type="radio" name="banco_alternativa_ecorreta[]" id="banco_alternativa_ecorreta" onclick="setRespCorreta();" value="'+ n_banco_alternativas + '"';
	
	if (ecorreta == true || ecorreta == 1 || ecorreta == '1'){
		htmlTemp += 'checked';
		setRespCorreta();
	}
	htmlTemp += '>Esta é a correta</label>';
	
	nDiv.innerHTML = htmlTemp;
	nDiv.id = 'alternativa'+n_banco_alternativas;
	elDiv.appendChild(nDiv);
	arr_banco_altern.push(n_banco_alternativas);
	n_banco_alternativas++;
	qtd_banco_alternativas++;
}

function remover_banco_alternativa(tmpalternativa){
	qtd_banco_alternativas--;
	temp_div = document.getElementById(tmpalternativa);
	temp_div.innerHTML = '';
	removeFromBancoAlternByValue(parseInt(tmpalternativa));
}

function removeFromBancoAlternByValue(val){
	var ind = -1;
	for (var i = 0; i < arr_banco_altern.length; i++){
		if (arr_banco_altern[i] == val) ind = i;
	}
	if (ind >= 0) arr_banco_altern.splice(ind,1);
}

function removeFromBancoAlternByIndex(ind){
	if (ind >= 0) arr_banco_altern.splice(ind,1);
}
function setRespCorreta(){
	resp_correta_checked = true;
}
function getRespCorreta(){
	return resp_correta_checked;
}
function validateFillAltern(){
	var filled = true;
	for (var i = 0; i < arr_banco_altern.length; i++){
		if (document.getElementById('banco_alternativa_titulo' + arr_banco_altern[i]).value == '') filled = false;
	}
	return filled;
}

function print_arr_banco_alternativa(){
	for (i=0; i < arr_banco_alternativa.length ;i++){
		titulo = arr_banco_alternativa[i][0];
		ecorreta = arr_banco_alternativa[i][1];
		add_banco_alternativa(titulo,ecorreta);
	}
}
/**
 * HTML-Encode the supplied input
 * 
 * Parameters:
 *
 * (String)  source    The text to be encoded.
 * 
 * (boolean) display   The output is intended for display.
 *
 *                     If true:
 *                     * Tabs will be expanded to the number of spaces 
 *                       indicated by the 'tabs' argument.
 *                     * Line breaks will be converted to <br />.
 *
 *                     If false:
 *                     * Tabs and linebreaks get turned into &#____;
 *                       entities just like all other control characters.
 *
 * (integer) tabs      The number of spaces to expand tabs to.  (Ignored 
 *                     when the 'display' parameter evaluates to false.)
 */
function htmlEncode(source, display, tabs){
	var i, s, ch, peek, line, result,
		next, endline, push,
		spaces;
	
	// Stash the next character and advance the pointer
	next = function () {
		peek = source.charAt(i);
		i += 1;
	};
	
	// Start a new "line" of output, to be joined later by <br />
	endline = function () {
		line = line.join('');
		if (display) {
			// If a line starts or ends with a space, it evaporates in html
			// unless it's an nbsp.
			line = line.replace(/(^ )|( $)/g, '&nbsp;');
		}
		result.push(line);
		line = [];
	};
	
	// Push a character or its entity onto the current line
	push = function () {
		if (ch < ' ' || ch > '~') {
			line.push('&#' + ch.charCodeAt(0) + ';');
		} else {
			line.push(ch);
		}
	};
	
	// Use only integer part of tabs, and default to 4
	tabs = (tabs >= 0) ? Math.floor(tabs) : 4;
	
	result = [];
	line = [];

	i = 0;
	next();
	while (i <= source.length) { // less than or equal, because i is always one ahead
		ch = peek;
		next();
		
		// HTML special chars.
		switch (ch) {
		case '<':
			line.push('&lt;');
			break;
		case '>':
			line.push('&gt;');
			break;
		case '&':
			line.push('&amp;');
			break;
		case '"':
			line.push('&quot;');
			break;
		case "'":
			line.push('&#39;');
			break;
		default:
			// If the output is intended for display,
			// then end lines on newlines, and replace tabs with spaces.
			if (display) {
				switch (ch) {
				case '\r':
					// If this \r is the beginning of a \r\n, skip over the \n part.
					if (peek === '\n') {
						next();
					}
					endline();
					break;
				case '\n':
					endline();
					break;
				case '\t':
					// expand tabs
					spaces = tabs - (line.length % tabs);
					for (s = 0; s < spaces; s += 1) {
						line.push(' ');
					}
					break;
				default:
					// All other characters can be dealt with generically.
					push();
				}
			} else {
				// If the output is not for display,
				// then none of the characters need special treatment.
				push();
			}
		}
	}
	endline();
	
	// If you can't beat 'em, join 'em.
	result = result.join('<br />');

	if (display) {
		// Break up contiguous blocks of spaces with non-breaking spaces
		result = result.replace(/ {2}/g, ' &nbsp;');
	}
	
	// tada!
	return result;
};

// TEXTCOUNTER - LIMITA TEXTAREAS
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit)
field.value = field.value.substring(0, maxlimit);

else
countfield.value = maxlimit - field.value.length;
}

// *********************************
// FORMATA CAMPOS - MASCARAS
// *********************************
formataCampo = function ( tecla, obj, tipo ) {
  var key;
  var keyNum;
  if ( navigator.userAgent.indexOf( "MSIE" ) > 0 ) key = tecla.keyCode;
  if ( navigator.userAgent.indexOf( "Gecko" ) > 0 ) key = tecla.which;
  if ( ( key == 8 ) || ( key == 0 ) ) return true;
  keyNum = key;
  key = String.fromCharCode(key);
  
  if ( tipo == 'numero' )
    var erNum = /[0-9\,]/i;
  else
    var erNum = /[0-9]/i;

  if (erNum.test(key)) {
    /**** NÚMERO ****/
    if (tipo == 'numero') {
      if ( key == "," )
      {
        if ( strpos ( obj.value, ',') !== false )
          return false;
        else
          return true;
      }
      return true; }
      
    /**** CEP ****/
    if (tipo == 'cep') {
      if (obj.value.length == 4) { obj.value = obj.value + key + '-'; return false; }
      else return true;

    /**** CPF ****/
    } else if (tipo == 'cpf') {
      if ((obj.value.length == 2) || (obj.value.length == 6)) { obj.value = obj.value + key + '.'; return false; }
      else if (obj.value.length == 10) { obj.value = obj.value + key + '-'; return false; }
      else if (obj.value.length > 13) { return false }
      else return true;

    /**** Fone ****/
    } else if (tipo == 'fone') {
      if ((obj.value.length == 0)) { obj.value = '(' + key ; return false; }
      else if (obj.value.length == 2) { obj.value = obj.value + key + ') '; return false; }
      else if (obj.value.length == 8) { obj.value = obj.value + key + '-'; return false; }
      else return true;

    /**** CNPJ ****/
    } else if (tipo == 'cnpj') {
      if ((obj.value.length == 1) || (obj.value.length == 5)) { obj.value = obj.value + key + '.'; return false; }
      else if (obj.value.length == 9) { obj.value = obj.value + key + '/'; return false; }
      else if (obj.value.length == 14) { obj.value = obj.value + key + '-'; return false; }
      else return true;

    /**** MOEDA ****/
    } else if (tipo == 'moeda') {
        
        objTextBox = obj ;
        SeparadorMilesimo = '' ;
        SeparadorDecimal = '.' ;
        e = tecla ;
            //-----------------------------------------------------
            //Funcao: MascaraMoeda
            //-----------------------------------------------------
            var sep = 0;
            var key = '';
            var i = j = 0;
            var len = len2 = 0;
            var strCheck = '0123456789';
            var aux = aux2 = '';
            var whichCode = (window.Event) ? e.which : e.keyCode;
            if (whichCode == 13) return true;
            key = String.fromCharCode(whichCode); // Valor para o código da Chave
            if (strCheck.indexOf(key) == -1) return false; // Chave inválida
            len = objTextBox.value.length;
            for(i = 0; i < len; i++)
                if ((objTextBox.value.charAt(i) != '0') && (objTextBox.value.charAt(i) != SeparadorDecimal)) break;
            aux = '';
            for(; i < len; i++)
                if (strCheck.indexOf(objTextBox.value.charAt(i))!=-1) aux += objTextBox.value.charAt(i);
            aux += key;
            len = aux.length;
            if (len == 0) objTextBox.value = '';
            if (len == 1) objTextBox.value = '0'+ SeparadorDecimal + '0' + aux;
            if (len == 2) objTextBox.value = '0'+ SeparadorDecimal + aux;
            if (len > 2) {
                aux2 = '';
                for (j = 0, i = len - 3; i >= 0; i--) {
                    if (j == 3) {
                        aux2 += SeparadorMilesimo;
                        j = 0;
                    }
                    aux2 += aux.charAt(i);
                    j++;
                }
                objTextBox.value = '';
                len2 = aux2.length;
                for (i = len2 - 1; i >= 0; i--)
                objTextBox.value += aux2.charAt(i);
                objTextBox.value += SeparadorDecimal + aux.substr(len - 2, len);
            }
            return false;        
        
    /**** DATA ****/
    } else if (tipo == 'data') {
      if ((obj.value.length == 1) || (obj.value.length == 4)) { obj.value = obj.value + key + '/'; return false; }
      else return true;

    /**** HORA ****/
    } else if (tipo == 'hora') {
      if (obj.value.length == 1) { obj.value = obj.value + key + ':'; return false; }
      else return true;

    } else { return false; }
  } else if ( keyNum == 13 ) {
    return true;
  }
  else return false;
}

// Colocar no campo onKeyUp="formataData(this,event);"
function formataData(Campo, teclapres){
	var tecla = teclapres.keyCode;
	var vr = new String(Campo.value);
	vr = vr.replace("/", "");
	vr = vr.replace("/", "");
	vr = vr.replace("/", "");
	tam = vr.length + 1;

	if (tecla != 8 && tecla != 111){
		if (tam > 0 && tam < 2)
			Campo.value = vr.substr(0, 2) ;
		if (tam > 2 && tam < 4)
			Campo.value = vr.substr(0, 2) + '/' + vr.substr(2, 2);
		if (tam > 4 && tam < 7)
			Campo.value = vr.substr(0, 2) + '/' + vr.substr(2, 2) + '/' + vr.substr(4, 7);
	}
}

// Colocar no campo onKeyUp="allowNumbers(this);"
function allowNumbers(cmp) {
	var check = true;
	var value = cmp.value;
	var new_value = '';
	
	for(var i=0;i < cmp.value.length; ++i){
	   var new_key = value.charAt(i);
	   if(((new_key < "0") || (new_key > "9")) &&
			!(new_key == ""))
	   {
			check = false;
			break;
	   }else{
		   new_value += new_key;
	   }
	}
	if (!check){
        alert("Ops! Este campo permite apenas a digitação de números.");
		cmp.value = new_value;
	}
}

function bodyOnReady(func){
//by Micox - based in jquery bindReady and Diego Perini IEContentLoaded
        //flag global para indicar que já rodou e function que roda realmente
        done = false
        init = function(){ if(!done) { done=true; func() } }
        var d=document; //apelido para o document
        //pra quem tem o DOMContent (FF)
        if(document.addEventListener){ d.addEventListener("DOMContentLoaded", init, false );}
        
        if( /msie/i.test( navigator.userAgent ) ){ //IE
                (function () {
                        try { // throws errors until after ondocumentready                              
                                d.documentElement.doScroll("left");
                        } catch (e) {
                                setTimeout(arguments.callee, 10); return;
                        }
                        // no errors, fire
                        init();
                })();
        }
        if ( window.opera ){
                d.addEventListener( "DOMContentLoaded", function () {
                        if (done) return;
                        //no opera, os estilos só são habilitados no fim do DOMready
                        for (var i = 0; i < d.styleSheets.length; i++){
                                if (d.styleSheets[i].disabled)
                                        setTimeout( arguments.callee, 10 ); return;
                        }
                        // fire
                        init();
                }, false);
        }
        if (/webkit/i.test( navigator.userAgent )){ //safari's
                if(done) return;
                //testando o readyState igual a loaded ou complete
                if ( /loaded|complete/i.test(d.readyState)===false ) {
                        setTimeout( arguments.callee, 10 );     return;
                }
                init();
        }
        //se nada funfou eu mando a velha window.onload lenta mesmo
        if(!done) window.onload = init
}

function lockForms_setup(){
	var obj_array = document.getElementsByTagName('form');
	for (i = 0; i < obj_array.length; i++){
		var tempobj = obj_array[i];
		var script = tempobj.getAttributeNode("onSubmit");
		if (script) script = script.nodeValue;
		if (script){
			var end_pos;
			var return_pos = script.indexOf('return');
			if (return_pos >= 0){
				var temp_rest = script.substr(return_pos);
				var temp_script = temp_rest.substr(0,temp_rest.indexOf(';'));
				temp_script = temp_script.replace('return ','');
				
				var new_script = "if (" + temp_script +" != false) lockForms(this); else return false;";
				tempobj.setAttribute("onSubmit", new_script);
			}else{
				var new_script = script + " lockForms(this);";
				tempobj.setAttribute("onSubmit", new_script);
				/*
				var tempFunction = new Function(new_script);
				var ret = tempobj.attachEvent("onSubmit", testeDaniel);
				*/
			}
		}else{
			var new_script = "lockForms(this);";
			tempobj.setAttribute("onSubmit", new_script);
		}
	}
}


bodyOnReady(lockForms_setup);

function lockForms(formObj){
	if (document.all || document.getElementById){
		for (i = 0; i < formObj.length; i++){
			var tempobj = formObj.elements[i];
			if (tempobj.type.toLowerCase() == "submit"){
				tempobj.value = 'Enviando...';
				tempobj.style = 'background:#CCCCCC; color:#333333;';
				tempobj.disabled = true;
			}
		}
	}
}

// FUNÇÕES PARA PAGINAÇÃO
	var paginacao_novofiltro_flag = false;
	function paginacao_novofiltro(){
		paginacao_novofiltro_flag = true;
	}
	
	function paginacao_atualizar(){
		var formulario = document.getElementById("form1");
		//var formulario = document.form1;
		if (formulario == null){
			alert('Objeto form1 não encontrado pela função de paginação.');
			return false;
		}
		if (!formulario.num_pagina) return false;
		if (paginacao_novofiltro_flag) paginacao_mudarPagina(1);
		if (parseInt(formulario.num_pagina.value) > parseInt(formulario.ult_pagina.value)){
			alert('Ops! A página solicitada não existe. Solicite uma página entre 1 e ' + formulario.ult_pagina.value +'.');
			formulario.num_pagina.value = formulario.num_pagina_original.value;
			formulario.num_pagina.focus();
			return false;
		}
		formulario.submit();
	}
	
	function paginacao_mudarPagina(nova_pagina){
		var formulario = document.getElementById("form1");
		if (formulario == null){
			alert('Objeto form1 não encontrado pela função de paginação.');
			return false;
		}
		formulario.num_pagina.value = nova_pagina;
	}
// *********************************
// FUNÇÕES PARA CADASTRO DE PERFIS  
// *********************************

function atualizarCombos(){
	var post_funcionalidade = document.getElementsByName("post_funcionalidade[]");
	for (i=0;i<post_funcionalidade.length;i++){
		var select_restricao = "select_restricao" + post_funcionalidade.item(i).value;
		select_restricao = document.getElementById(select_restricao);
		select_restricao.disabled = true;
	}
	
	for (i=0;i<post_funcionalidade.length;i++){
		if (post_funcionalidade.item(i).checked){
			var select_restricao = "select_restricao" + post_funcionalidade.item(i).value;
			select_restricao = document.getElementById(select_restricao);
			select_restricao.disabled = false;
		}
	}
}

	// *********************************
	// PULA-CAMPOS
	// *********************************

	function pula1(){
		if (document.getElementById('aluno_ddd1').value.length == 2){
			document.getElementById('aluno_telefone1').focus();
		}
	}

	function pula2(){
		if (document.getElementById('aluno_ddd2').value.length == 2){
			document.getElementById('aluno_telefone2').focus();
		}
	}

	// *********************************
  
	 function checkedAll (id, checked) {
		var el = document.getElementById(id);
		for (var i = 0; i <el.elements.length; i++) {
		   el.elements[i].checked = checked;
		}
	 }


function loading(id){
var item = document.getElementById(id);
  if (item.style.display == 'none'){
    item.style.display = '';
	item.focus();	
  }  
  else if (item.style.display == ''){
    item.style.display='none';
  }   
}


function show(){
var item = document.getElementById('busca_pag');
  if (item.style.display == 'none'){
    item.style.display = '';
	item.focus();	
  }  
  else if (item.style.display == ''){
    item.style.display='none';
  }   
}

var g=0;
function AjaxRequest(url, elemento){
	var ajax = objAjax();
	if(ajax == null){
		alert("Impossível concluir a operação");
	}
	
	url2 = url+Math.random();

	ajax.open("GET",url2,true);
	ajax.onreadystatechange = function(){
		if(ajax.readyState == 4){
			document.getElementById(elemento).src = url+'&amp;' + (g++);
		}
	}
	
	ajax.send(null);
}

function objAjax(){
	var xmlHttp=null;
	try{
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e){
	  // Internet Explorer
	  try{
	    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	    }
	  catch (e){
	    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	    }
	  }
	return xmlHttp;
}


// {
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function validaemail(email) {
  var objRegExp  = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/i;
  return objRegExp.test(email);
}

function envia(param) {
  if (param == 1) {
    if (document.f1.nome.value.length < 3) {
      alert("Preencha o campo NOME!");
      document.f1.nome.focus();
    }
    else {
      if (!validaemail(document.f1.emai.value)) {
        alert("Preencha o campo E-MAIL!");
              document.f1.emai.focus();
      }
      else {
        document.f1.submit();
      }
    }
  }
  else if (param == 2) {
    if (!validaemail(document.f2.emai.value)) {
      alert("Preencha o campo E-MAIL!");
      document.f2.emai.focus();
    }
    else {
      document.f2.submit();
    }
  }
  else if ( param == 3 ) {
    if (document.f1.nome.value.length < 3) {
        alert("Preencha o campo CONTATO!");
        document.f1.nome.focus();
    }
    else if (!validaemail(document.f1.emai.value)) {
        alert("Preencha o campo E-MAIL!");
        document.f1.emai.focus();
    }
    else if ( ! validaCPF( document.f1.cpf.value ) )
    {
        alert("Preencha corretamente o campo CPF!");
        document.f1.cpf.focus();
    }
    else if ( ! validaCNPJ( document.f1.cnpj.value ) )
    {
        alert("Preencha corretamente o campo CNPJ!");
        document.f1.cnpj.focus();
    }
    else if ( document.f1.mensagem.value.length < 3 ){
        alert("Preencha o campo MENSAGEM!");
        document.f1.mensagem.focus();
    } else {
        document.f1.submit();
    }
  }
}


function validaCPF( cpf )
{
    // Tira os pontos e o traço
    exp = /[^0-9]/g;
    cpf = cpf.replace( exp, '' );
    
    // Verifica se o campo é nulo
    if (cpf == '')
        return false;

    // Aqui começa a checagem do CPF
    var posicao, i, soma, dv, dv_informado;
    var digito = new Array(10);
    dv_informado = cpf.substr(9, 2); // Retira os dois últimos dígitos do número informado

    // Desemembra o número do CPF na array DIGITO
    for (i=0; i<=8; i++)
        digito[i] = cpf.substr( i, 1);

    // Calcula o valor do 10º dígito da verificação
    posicao = 10;
    soma = 0;
    for (i=0; i<=8; i++)
    {
        soma    = soma + digito[i] * posicao;
        posicao = posicao - 1;
    }
    digito[9] = soma % 11;
    if (digito[9] < 2)
        digito[9] = 0;
    else
        digito[9] = 11 - digito[9];

    // Calcula o valor do 11º dígito da verificação
    posicao = 11;
    soma = 0;
    for (i=0; i<=9; i++)
    {
        soma    = soma + digito[i] * posicao;
        posicao = posicao - 1;
    }
    digito[10] = soma % 11;
    if (digito[10] < 2)
        digito[10] = 0;
    else
        digito[10] = 11 - digito[10];

    // Verifica se os valores dos dígitos verificadores conferem
    dv = digito[9] * 10 + digito[10];
    
    if (dv != dv_informado)
        return false;
    else
        return true;
}

function validaCNPJ( cnpj ) {
    
    // Tira os pontos e o traço
    exp = /[^0-9]/g;
    cnpj = cnpj.replace( exp, '' );
    
    if (cnpj.length < 14) 
        return false;
    
    var a = [];
    var b = new Number;
    var c = [6,5,4,3,2,9,8,7,6,5,4,3,2];
    
    for (i=0; i<12; i++){
        a[i] = cnpj.charAt(i);
        b += a[i] * c[i+1];
    }
    
    if ((x = b % 11) < 2)
        a[12] = 0;
    else
        a[12] = 11-x;
    
    b = 0;
    for (y=0; y<13; y++)
        b += (a[y] * c[y]);
    
    if ((x = b % 11) < 2)
        a[13] = 0;
    else
        a[13] = 11-x;
    
    if ((cnpj.charAt(12) != a[12]) || (cnpj.charAt(13) != a[13]))
        return false;
    
    return true;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}


var res = screen.height;
	if (res <= 600)
	{
		document.write('<style type="text/css">#geral{min-height:86%;_height:86%;}<\/style>')
	}
	else if ( res == 768 )
	{
		document.write('<style type="text/css">#geral{min-height:85%;_height:85%;}<\/style>')
	}
	else if ( res == 864 )
	{
		document.write('<style type="text/css">#geral{min-height:88%;_height:88%;}<\/style>')
	}
	else if ( res == 1024 )
	{
		document.write('<style type="text/css">#geral{min-height:91%;_height:91%;}<\/style>')
	}
	else if ( res == 1200 )
	{
		document.write('<style type="text/css">#geral{min-height:93%;_height:93%;}<\/style>')
	}
	else
	{
		document.write('<style type="text/css">#geral{min-height:95%;_height:95%;}<\/style>')
	}


/*
    COMO USAR
    EX: onkeypress="return Mascaras ( event, 'FONE', 'nome_id' );"
*/
function Mascaras ( e, formato, objeto )
{
    var key;

    if ( window.event ) keyPressed = window.event.keyCode; // IE hack
    else keyPressed = e.which; // <B>standard method</B>

    if ( keyPressed >= 48 && keyPressed <= 57 )
    {
        var campo = document.getElementById(objeto);
        
        /*
            DATA
            FORMATO: 00/00/0000
        */
        if ( formato == 'DATA' )
        {
            separador = '/'; 
            conjunto1 = 2;
            conjunto2 = 5;
            if ( campo.value.length == conjunto1 )
                campo.value = campo.value + separador;
            
            if ( campo.value.length == conjunto2 )
                campo.value = campo.value + separador;
            
            return true;
        }
        
        /*
            HORA
            FORMATO: 00:00
        */
        if (formato == 'HORA')
        {
            separador = ':';
            conjunto1 = 2;
            if ( campo.value.length == conjunto1 )
                campo.value = campo.value + separador;
            
            return true;
        }
        
        /*
            CEP
            FORMATO: 00000-000
        */
        if (formato == 'CEP')
        {
            separador = '-';
            conjunto1 = 5;
            if (    campo.value.length == conjunto1 )
                campo.value = campo.value + separador;
            
            return true;
        } 
        
        /*
            CPF
            FORMATO: 000.000.000-00
        */
        if (formato == 'CPF')
        {
            separador = '.';
            separador1 = '-';
            conjunto1 = 3;
            conjunto2 = 7;
            conjunto3 = 11;
            if ( campo.value.length == conjunto1 )
                campo.value = campo.value + separador;

            if ( campo.value.length == conjunto2 )
                campo.value = campo.value + separador;

            if ( campo.value.length == conjunto3 )
                campo.value = campo.value + separador1;
            
            return true;
        }
        
        /*
            CNPJ
            FORMATO: 00.000.000/0000-00
        */
        if (formato == 'CNPJ')
        {
            separador1 = '.';
            separador2 = '/';
            separador3 = '-';
            conjunto1 = 2;
            conjunto2 = 6;
            conjunto3 = 10;
            conjunto4 = 15;
            if ( campo.value.length == conjunto1 )
                campo.value = campo.value + separador1;
            
            if ( campo.value.length == conjunto2 )
                campo.value = campo.value + separador1;
            
            if ( campo.value.length == conjunto3 )
                campo.value = campo.value + separador2;
            
            if ( campo.value.length == conjunto4 ) 
                campo.value = campo.value + separador3;
            
            return true;
        }
        
        /*
            FONE
            FORMATO: (00) 0000-0000
        */
        if ( formato == 'FONE' )
        {
            separador1 = '(';
            separador2 = ') ';
            separador3 = '-';
            conjunto1 = 0;
            conjunto2 = 3;
            conjunto3 = 9;
            if ( campo.value.length == conjunto1 )
                campo.value = campo.value + separador1;
            
            if ( campo.value.length == conjunto2 )
                campo.value = campo.value + separador2;
            
            if ( campo.value.length == conjunto3 )
                campo.value = campo.value + separador3;
            
            return true;
        }
        
        /*
            FONE2
            FORMATO: 0000-0000
        */
        if ( formato == 'FONESIMPLES' )
        {
            separador1 = '-';
            conjunto1 = 4;
            if ( campo.value.length == conjunto1 )
                campo.value = campo.value + separador1;
            
            return true;
        }
    }
    else if ( keyPressed == 8 || keyPressed == 13 || keyPressed == 0 )
        return true;
    else
        return false;
}

/*
    COMO USAR
    EX: onkeypress="return TextoSimples ( event );"
*/
function TextoSimples ( e )
{
    if ( window.event ) keyPressed = window.event.keyCode; // IE hack
    else keyPressed = e.which; // <B>standard method</B>

    if ( keyPressed == 8 || keyPressed == 95  || keyPressed == 13  || keyPressed == 0 ) return true;
    else if ( ( keyPressed >= 48 && keyPressed <= 57 ) || (keyPressed > 96 && keyPressed < 123) || keyPressed == 95 ) return true;
    else if ( ( keyPressed > 191 && keyPressed < 221 ) || ( keyPressed > 223 && keyPressed < 253 ) ) return true;
    
    return false;
}

/*
    COMO USAR
    EX: onkeypress="return Numeros ( event );"
*/
function Numeros ( e )
{
    if ( window.event ) keyPressed = window.event.keyCode; // IE hack
    else keyPressed = e.which; // <B>standard method</B>
    
    if ( keyPressed == 8 || keyPressed == 13 || keyPressed == 0 ) return true;
    else if ( keyPressed >= 48 && keyPressed <= 57 ) return true;
              
    return false;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit)
		field.value = field.value.substring(0, maxlimit);
	else
		countfield.value = maxlimit - field.value.length;
}

function changeImg ( dir, galeria, imagem )
{
    var src_grande = dir+galeria+"/grande_"+imagem+'.jpg';
    var src_ampli  = dir+galeria+"/ampli_"+imagem+'.jpg';
    
    document.getElementById ( 'url_foto_ampli' ).value = src_ampli;
    
    document.getElementById('foto_grande').src = src_grande;
    document.getElementById('foto_grande').removeAttribute('width');
    document.getElementById('foto_grande').removeAttribute('height');
}

/**
 * Abrir foto da galeria, utilizando jQuery
  */
function abreFotoGaleria(galer_id, foto) {
	var regex = new RegExp(foto + '$');
	if (!$('img#galeria_foto').attr('src').match(regex)) {
		$('span#loading-animation').show();	
		$('img#galeria_foto')
			.fadeOut('slow', function() {
				var oSrc = this.src, img = null;
				img = $(document.createElement('img'))
								.load(function(){
									$('img#galeria_foto')
										.attr({
											src: this.src,  
											oSrc: oSrc,     
											alt: foto,      
											title: foto     
										})
										.fadeIn('slow');
									$('span#loading-animation').hide();
                                    $('a#link_download')
								})
								.attr('src', (_HTTP_PATH_ || "") + "imgs/galeria/" + galer_id + "/" + foto)
			});
	}
}

function setHiddenValue(objHidden, objSelect){
	objHidden = document.getElementById(objHidden);
	
	if (objSelect.value == ''){
		objHidden.value = "";
		return false;
	}
	
	var objSelect_label = objSelect[objSelect.selectedIndex].innerHTML;
	objSelect_label = objSelect_label.split("-");
	objSelect_label_cod = objSelect_label[0];
	objHidden.value = objSelect_label_cod.replace("&nbsp;","");
}



function select_innerHTML(objeto,innerHTML){
	objeto.innerHTML = "";
	var selTemp = document.createElement("micoxselect");
	var opt;
	selTemp.id="micoxselect1";
	document.body.appendChild(selTemp);
	selTemp = document.getElementById("micoxselect1");
	selTemp.style.display="none";
	
	if(innerHTML.toLowerCase().indexOf("<option")<0){
		innerHTML = "<option>" + innerHTML + "</option>"
	}
	
	//innerHTML = innerHTML.toLowerCase().replace(/<option/g,"<span").replace(/<\/option/g,"</span");
	innerHTML = innerHTML.replace(/<option/g,"<span").replace(/<\/option/g,"</span");
	selTemp.innerHTML = innerHTML;
	
	for(var i=0;i<selTemp.childNodes.length;i++){
		var spantemp = selTemp.childNodes[i];
		if(spantemp.tagName){
			opt = document.createElement("OPTION");
			if(document.all){ 
				objeto.add(opt);
			}else{
				objeto.appendChild(opt);
			}
			
			for(var j=0; j<spantemp.attributes.length ; j++){
				var attrName = spantemp.attributes[j].nodeName;
				var attrVal = spantemp.attributes[j].nodeValue;
				if(attrVal){
					try{
						opt.setAttribute(attrName,attrVal);
						opt.setAttributeNode(spantemp.attributes[j].cloneNode(true));
						}catch(e){
						}
					}
				}
				
				if(spantemp.style){
					for(var y in spantemp.style){
						try{
							opt.style[y] = spantemp.style[y];
						}catch(e){
						}
					}
				}
				
				opt.value = spantemp.getAttribute("value");
				opt.text = spantemp.innerHTML;
				opt.selected = spantemp.getAttribute('selected');
				opt.className = spantemp.className;
			}
		}
	document.body.removeChild(selTemp);
	selTemp = null;
}



function getRandomNum(lbound, ubound) {
	return (Math.floor(Math.random() * (ubound - lbound)) + lbound);
}

function getRandomChar(number, lower, upper, other, extra) {
	var numberChars = "23456789";
	var lowerChars = "abcdefghjkmnpqrstuvwxyz";
	var upperChars = "ABCDEFGHJKMNPQRSTUVWXYZ";
	var otherChars = "";
	var charSet = extra;
	
	if (number == true)	charSet += numberChars;
	if (lower == true) charSet += lowerChars;
	if (upper == true) charSet += upperChars;
	if (other == true) charSet += otherChars;

	return charSet.charAt(getRandomNum(0, charSet.length));
}
	
function getRandomPassword(length, extraChars, firstNumber , firstLower , firstUpper , firstOther , latterNumber, latterLower, latterUpper, latterOther) {
	length = 8;
	extraChars = "";
	firstNumber = false;
	firstLower = true;
	firstUpper = true;
	firstOther = false;
	latterNumber=true;
	latterLower=true;
	latterUpper=true;
	latterOther=false;
	var rc = "";
	if (length > 0) rc = rc + getRandomChar(firstNumber, firstLower, firstUpper, firstOther, extraChars);
	for (var idx = 1; idx < length; ++idx) {
		rc = rc + getRandomChar(latterNumber, latterLower, latterUpper, latterOther, extraChars);
	}
	return rc;
}



function retiraAcento(palavra){
	var caracteresInvalidos = 'àèìòùâêîôûäëïöüáéíóúãõçÀÈÌÒÙÂÊÎÔÛÄËÏÖÜÁÉÍÓÚÃÕ´`^¨~/\?:;.,()-[]{}<>!@#$%&*|';
	var caracteresValidos =   'aeiouaeiouaeiouaeiouaocAEIOUAEIOUAEIOUAEIOUAO                             ';
	
	var nova_palavra = "";
	
	for (i=0;i<palavra.length;i++){
		letra = palavra.charAt(i);
		if (caracteresInvalidos.indexOf(letra) == -1){
			nova_palavra += letra;
		}else{
			nova_letra = caracteresValidos.charAt(caracteresInvalidos.indexOf(letra));
			nova_palavra += nova_letra;
		}
	}
	
	return nova_palavra;
}

function Trim(str){
	return str.replace(/^\s+|\s+$/g,"");
}

function f_sonumeros(field){
	var valid = "0123456789";
	var ok = "yes";
	var temp;
	for (var i=0; i<field.value.length; i++) {
	temp = "" + field.value.substring(i, i+1);
	if (valid.indexOf(temp) == "-1") ok = "no";
	}
	if (ok == "no") {
	return false;
	}
	return true;
}

function f_login(field){
	//colocar em minusculas
	var valid = "abcdefghijlmnopqrstuvxzwyk0123456789";
	var ok = "yes";
	var temp;
	for (var i=0; i<field.value.length; i++) {
		temp = "" + field.value.substring(i, i+1);
		if (valid.indexOf(temp.toLowerCase()) == "-1") ok = "no";
	}
	if (ok == "no") {
		return false;
	}
	return true;
}

function f_sodata(field){
	data = field.value;
	if (data.substring(1,2) == '/' && data.length < 10){
		field.value = '0' + data.substring(0,data.length);
	}
	data = field.value;
	if (data.substring(4,5) == '/' && data.length < 10){
		field.value = data.substring(0,3) + '0' + data.substring(3,data.length);
	}
	data = field.value;
	if (data == ''){ 
		return true;
	}
	var dia = parseInt(data.substring(0,2),10);
	var mes = parseInt(data.substring(3,5),10);
	var ano = parseInt(data.substring(6,10),10);
	var retorno = "";

	if (dia <= 31 && mes <=12 && ano >= 1000){
		//Verificando barras
		if (data.substring(2,3) != '/' || data.substring(5,6) != '/'){
			return false;
		}
		
		//Verificando validade do ano
		if (data.substring(6,7)== '0' || data.substring(6,7)=='' && data.substring(7,8)!='0'){
			return false;
		}
		
		//Verificando quantidade de dias para meses de 30
		if ((mes == 4)||(mes == 6)||(mes == 9)||(mes == 11)){
			if (dia > 30){
			return false;
			}
		}
		
		//Verificando quantidade de dias para mês 2
		if ((mes == 2)){
			if ((ano % 4) != 0){
				if (dia > 28){
					return false;
				}
			}else{
				if (dia > 29){
					return false;
				}
			}
		}

	}else{
			return false;
	}
	return true;
}

function f_sojpg(field){
	var txt = field.value;
	txt = txt.substring(txt.length - 4, txt.length);
	if (txt.toUpperCase() != '.JPG'){
		return false;
	}
	return true;
}


function f_soswf(field){
	var txt = field.value;
	txt = txt.substring(txt.length - 4, txt.length);
	if (txt.toUpperCase() != '.SWF'){
		return false;
	}else{
		return true;	
	}
}

function f_moeda(field){
	var valid = "0123456789,";
	var ok = "yes";
	var temp;
	for (var i=0; i<field.value.length; i++) {
	temp = "" + field.value.substring(i, i+1);
	if (valid.indexOf(temp) == "-1") ok = "no";
	}
	if (ok == "no") {
		return false;
	}
	return true;
}

function f_email(field){
	emailad = field.value
	if (emailad != ""){
		var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
		var check=/@[\w\-]+\./;
		var checkend=/\.[a-zA-Z]{2,3}$/;
		if (((emailad.search(exclude) != -1)||(emailad.search(check)) == -1)||(emailad.search(checkend) == -1)){
			return false;
		}
		else {
			return true;
		}	
	}
}

function f_cpf (field){
	StrCPF = field.value;
	x = 0;
	soma = 0;
	dig1 = 0;
	dig2 = 0;
	texto = "";
	StrCPF1="";
	len = StrCPF.length;
	x = len -1;

	for (var i=0; i <= len - 3; i++){
		y = StrCPF.substring(i,i+1);
		soma = soma + ( y * x);
		x = x - 1;
		texto = texto + y;
	}

	dig1 = 11 - (soma % 11);
	if (dig1 == 10) dig1=0 ;
	if (dig1 == 11) dig1=0 ;
	StrCPF1 = StrCPF.substring(0,len - 2) + dig1 ;
	x = 11; soma=0;
	
	for (var i=0; i <= len - 2; i++){
		soma = soma + (StrCPF1.substring(i,i+1) * x);
		x = x - 1;
	}

	dig2= 11 - (soma % 11);
	if (dig2 == 10) dig2=0;
	if (dig2 == 11) dig2=0;
	if ((dig1 + "" + dig2) == StrCPF.substring(len,len-2)){
		// alert ("Número do CPF Válido !");
		return true;
	}

	return false;
}


function f_cnpj(field){
	StrCGC = field.value;
	if (StrCGC == ''){
		return '';
	}
	var varFirstChr = StrCGC.charAt(0);
	var vlMult,vlControle,s1, s2 = "";
	var i,j,vlDgito,vlSoma = 0;
	for ( var i=0; i<=13; i++ ) {
		var c = StrCGC.charAt(i);
		if( ! (c>="0")&&(c<="9") ){
			return false;
		}
		if( c!=varFirstChr ){
			vaCharCGC = true;
		}
	}
	if( ! vaCharCGC ) {
			return false;
	}

	s1 = StrCGC.substring(0,12);
	s2 = StrCGC.substring(12,15);
	vlMult = "543298765432";
	vlControle = "";
	
	for ( j=1; j<3; j++ ) {
		vlSoma = 0;
		for ( i=0; i<12; i++ ){
			vlSoma += eval( s1.charAt(i) )* eval( vlMult.charAt(i) );
		}
		if( j == 2 ){
			vlSoma += (2 * vlDgito);
		}
		vlDgito = ((vlSoma*10) % 11);
		if( vlDgito == 10 ){
			vlDgito = 0;
		}
		vlControle = vlControle + vlDgito;
		vlMult = "654329876543";
	}
	
	if( vlControle != s2 ) {
			return false;
	}else{
		// alert("Número do CGC Válido !");
		return true;
	}
}
	

function f_menu(x){
	if (x.value=="") {
		return false;
	}
	return true;
}

function findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}


//EXEMPLO:
//return requiridos('txt_nome','',true,'txt_email','eml',true,'txt_ddd','num',true,'txt_tel','num',true,'txt_uf','',true,'txt_cidade','',true,'txt_endereco','',true,'txt_numero','',true,'txt_bairro','',true,'txt_cep','',true,'txt_rg','num',true,'dta_nascimento','dta',true);

function requiridos(){
  var i,num,args=requiridos.arguments;
  for (i=0; i<(args.length); i=i+3) {
	  val=findObj(args[i]);
	  val.className = "";
  }
  
  var erroFormato = false;
  var erroRequiri = false;
  
  for (i=0; i<(args.length); i=i+3) {
		val=findObj(args[i]);
		tipo=args[i+1];
		req=args[i+2];
		var msg = true;
		switch (tipo){
			case "eml":
				msg = f_email(val);
			break;
			
			case "cpf":
				msg = f_cpf(val);
			break;
			
			case "lgn":
				msg = f_login(val);
			break;
			
			case "dta":
				msg = f_sodata(val);
			break;
			
			case "num":
				msg = f_sonumeros(val);
			break;
			
			case "jpg":
				msg = f_sojpg(val);
			break;
			
			case "swf":
				msg = f_soswf(val);
			break;
			
			case "csh":
				msg = f_moeda(val);
			break;
			
			//case "mnu":
			//	msg = f_menu(val);
			//break;
			
			case "cpj":
				msg = f_cnpj(val);
			break;
		}
		
		if (!msg){
			val.className = "cmp_erro";
			erroFormato = true;
		}

		if (req && val.value=="") {
			//PARA IDENTIFICAR QUAL O CAMPO ELE ESTÁ VALIDANDO NO MOMENTO
			//alert(val.name);
			erroRequiri = true;
		}
  }
  
  msg = "O preenchimento do formulário está incorreto! \n";
  
  if (erroFormato){
	  msg = msg + "- Os campos em vermelho indicam que a informação foi digitada incorretamente.\n";
  }
  
  if (erroRequiri){
	  msg = msg + "- Todos os campos com * (asterísco) são de preenchimento obrigatório."
  }
  
  if (erroFormato || erroRequiri){
	  alert(msg);
	  return false;
  }
  
  return true;
}

function requiridos_mnu(){
  var i,num,args=requiridos_mnu.arguments;
  for (i=0; i<(args.length); i++) {
		val=findObj(args[i]);
		if (val.value=="") {
			alert('Selecione uma das opções!');
			val.focus();
			return false;
		}
  }
  return '';
}

function addslashes( str ) {  
	return (str+'').replace(/([\\"'])/g, "\\$1").replace(/\0/g, "\\0");  
}  

function changeASC()
{
	var campo;
	campo = document.getElementById("soimg1");
	campo.src = "imgs/s_asc.png";
}

function changeDESC()
{
	var campo;
	campo = document.getElementById("soimg1");
	campo.src = "imgs/s_desc.png";
}

/* 22/01/2010 */
function busca(campo,valor){
	ajax_loadXMLDoc("busca.php","codigo="+valor,"resposta","div");
}

function abrirRelatorioBancoDeQuestoes(){
	window.open('?pg=banco_questao&acao=relatorio',null,'width=800,height=600,menubar=1,scrollbars=1');
	return false;
}
function abrirRelatorioAutoresBancoDeQuestoes(){
	window.open('?pg=banco_questao&acao=relatorio_autor',null,'width=800,height=600,menubar=1,scrollbars=1');
	return false;
}
