//###############################FUNCAO DA MASCARA DE VALORES###############################
/*Combo Box Image Selector:
By JavaScript Kit (www.javascriptkit.com)
Over 200+ free JavaScript here!
*/

    /***
    * Descrição.: formata um campo do formulário de
    * acordo com a máscara informada...
    * Parâmetros: - objForm (o Objeto Form)
    * - strField (string contendo o nome
    * do textbox)
    * - sMask (mascara que define o
    * formato que o dado será apresentado,
    * usando o algarismo "9" para
    * definir números e o símbolo "!" para
    * qualquer caracter...
    * - evtKeyPress (evento)
    *
    * Uso.......: <input type="textbox"
    * name="xxx".....
    * onkeyup="return txtBoxFormat(document.rcfDownload, 'str_cep', '99999-999', event);">
    * Observação: As máscaras podem ser representadas
    * como os exemplos abaixo:
    * CEP -> 99999-999
    * CPF -> 999.999.999-99
    * CNPJ -> 99.999.999/9999-99
    * C/C -> 999999-!
    * Tel -> (99) 9999-9999
    ***/
//-->
//funcao de mascara para formulario
function txtBoxFormat(objForm, strField, sMask, evtKeyPress)
	{
		var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;

		if(document.all)
			{ 
				nTecla = evtKeyPress.keyCode; // Internet Explorer
			}
		else if(document.layers)
			{ 
				nTecla = evtKeyPress.which; // Nestcape
			}

		sValue = objForm[strField].value;

		// Limpa todos os caracteres de formatação que
		// já estiverem no campo.
		sValue = sValue.toString().replace( "-", "" );
		sValue = sValue.toString().replace( "-", "" );
		sValue = sValue.toString().replace( ".", "" );
		sValue = sValue.toString().replace( ".", "" );
		sValue = sValue.toString().replace( "/", "" );
		sValue = sValue.toString().replace( "/", "" );
		sValue = sValue.toString().replace( "(", "" );
		sValue = sValue.toString().replace( "(", "" );
		sValue = sValue.toString().replace( ")", "" );
		sValue = sValue.toString().replace( ")", "" );
		sValue = sValue.toString().replace( " ", "" );
		sValue = sValue.toString().replace( " ", "" );
		fldLen = sValue.length;
		mskLen = sMask.length;

		i = 0;
		nCount = 0;
		sCod = "";
		mskLen = fldLen;
		
		while (i <= mskLen)
			{
				bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/"))
				bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " "))
				
				if (bolMask)
					{
						sCod += sMask.charAt(i);
						mskLen++;
					}
				else
					{
						sCod += sValue.charAt(nCount);
						nCount++;
					}
				
				i++;
			}
				
		objForm[strField].value = sCod;
				
		if (nTecla != 8)
			{ // backspace
				if (sMask.charAt(i-1) == "9") 
					{// apenas números...
						return ((nTecla > 47) && (nTecla < 58)); // números de 0 a 9 
					} 
				else
					{ 
						return true; // qualquer caracter...
					}
			}
		else
			{
				return true;
			}
	}
//###############################FUNCAO DA MASCARA DE VALORES###############################
















//###############################FUNCAO EQUIVALENTE AO SUBSTR_COUNT DO PHP###############################
function substr_count( haystack, needle, offset, length ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // *     example 1: substr_count('Kevin van Zonneveld', 'e');
    // *     returns 1: 3
    // *     example 2: substr_count('Kevin van Zonneveld', 'K', 1);
    // *     returns 2: 0
    // *     example 3: substr_count('Kevin van Zonneveld', 'Z', 0, 10);
    // *     returns 3: false
 
    var pos = 0, cnt = 0;
 
    if(isNaN(offset)) offset = 0;
    if(isNaN(length)) length = 0;
    offset--;
 
    while( (offset = haystack.indexOf(needle, offset+1)) != -1 ){
        if(length > 0 && (offset+needle.length) > length){
            return false;
        } else{
            cnt++;
        }
    }
 
    return cnt;
}
//###############################FUNCAO EQUIVALENTE AO SUBSTR_COUNT DO PHP###############################
















//###############################FUNCOES EQUIVALENTES AO BASE64_ENCODE E BASE64_DECODE DO PHP###############################
function urlencode( str ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Philip Peterson
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +      input by: AJ
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Brett Zamir (http://brett-zamir.me)
    // +   bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +      input by: travc
    // +      input by: Brett Zamir (http://brett-zamir.me)
    // +   bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Lars Fischer
    // %          note 1: info on what encoding functions to use from: http://xkr.us/articles/javascript/encode-compare/
    // *     example 1: urlencode('Kevin van Zonneveld!');
    // *     returns 1: 'Kevin+van+Zonneveld%21'
    // *     example 2: urlencode('http://kevin.vanzonneveld.net/');
    // *     returns 2: 'http%3A%2F%2Fkevin.vanzonneveld.net%2F'
    // *     example 3: urlencode('http://www.google.nl/search?q=php.js&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:unofficial&client=firefox-a');
    // *     returns 3: 'http%3A%2F%2Fwww.google.nl%2Fsearch%3Fq%3Dphp.js%26ie%3Dutf-8%26oe%3Dutf-8%26aq%3Dt%26rls%3Dcom.ubuntu%3Aen-US%3Aunofficial%26client%3Dfirefox-a'
                             
    var histogram = {}, unicodeStr='', hexEscStr='';
    var ret = (str+'').toString();
    
    var replacer = function(search, replace, str) {
        var tmp_arr = [];
        tmp_arr = str.split(search);
        return tmp_arr.join(replace);
    };
    
    // The histogram is identical to the one in urldecode.
    histogram["'"]   = '%27';
    histogram['(']   = '%28';
    histogram[')']   = '%29';
    histogram['*']   = '%2A';
    histogram['~']   = '%7E';
    histogram['!']   = '%21';
    histogram['%20'] = '+';
    histogram['\u00DC'] = '%DC';
    histogram['\u00FC'] = '%FC';
    histogram['\u00C4'] = '%D4';
    histogram['\u00E4'] = '%E4';
    histogram['\u00D6'] = '%D6';
    histogram['\u00F6'] = '%F6';
    histogram['\u00DF'] = '%DF';
    histogram['\u20AC'] = '%80';
    histogram['\u0081'] = '%81';
    histogram['\u201A'] = '%82';
    histogram['\u0192'] = '%83';
    histogram['\u201E'] = '%84';
    histogram['\u2026'] = '%85';
    histogram['\u2020'] = '%86';
    histogram['\u2021'] = '%87';
    histogram['\u02C6'] = '%88';
    histogram['\u2030'] = '%89';
    histogram['\u0160'] = '%8A';
    histogram['\u2039'] = '%8B';
    histogram['\u0152'] = '%8C';
    histogram['\u008D'] = '%8D';
    histogram['\u017D'] = '%8E';
    histogram['\u008F'] = '%8F';
    histogram['\u0090'] = '%90';
    histogram['\u2018'] = '%91';
    histogram['\u2019'] = '%92';
    histogram['\u201C'] = '%93';
    histogram['\u201D'] = '%94';
    histogram['\u2022'] = '%95';
    histogram['\u2013'] = '%96';
    histogram['\u2014'] = '%97';
    histogram['\u02DC'] = '%98';
    histogram['\u2122'] = '%99';
    histogram['\u0161'] = '%9A';
    histogram['\u203A'] = '%9B';
    histogram['\u0153'] = '%9C';
    histogram['\u009D'] = '%9D';
    histogram['\u017E'] = '%9E';
    histogram['\u0178'] = '%9F';
    
    // Begin with encodeURIComponent, which most resembles PHP's encoding functions
    ret = encodeURIComponent(ret);
 
    for (unicodeStr in histogram) {
        hexEscStr = histogram[unicodeStr];
        ret = replacer(unicodeStr, hexEscStr, ret); // Custom replace. No regexing
    }
    
    // Uppercase for full PHP compatibility
    return ret.replace(/(\%([a-z0-9]{2}))/g, function(full, m1, m2) {
        return "%"+m2.toUpperCase();
    });
}









function urldecode( str ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Philip Peterson
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +      input by: AJ
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Brett Zamir (http://brett-zamir.me)
    // +      input by: travc
    // +      input by: Brett Zamir (http://brett-zamir.me)
    // +   bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Lars Fischer
    // %          note 1: info on what encoding functions to use from: http://xkr.us/articles/javascript/encode-compare/
    // *     example 1: urldecode('Kevin+van+Zonneveld%21');
    // *     returns 1: 'Kevin van Zonneveld!'
    // *     example 2: urldecode('http%3A%2F%2Fkevin.vanzonneveld.net%2F');
    // *     returns 2: 'http://kevin.vanzonneveld.net/'
    // *     example 3: urldecode('http%3A%2F%2Fwww.google.nl%2Fsearch%3Fq%3Dphp.js%26ie%3Dutf-8%26oe%3Dutf-8%26aq%3Dt%26rls%3Dcom.ubuntu%3Aen-US%3Aunofficial%26client%3Dfirefox-a');
    // *     returns 3: 'http://www.google.nl/search?q=php.js&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:unofficial&client=firefox-a'
    
    var histogram = {}, ret = str.toString(), unicodeStr='', hexEscStr='';
    
    var replacer = function(search, replace, str) {
        var tmp_arr = [];
        tmp_arr = str.split(search);
        return tmp_arr.join(replace);
    };
    
    // The histogram is identical to the one in urlencode.
    histogram["'"]   = '%27';
    histogram['(']   = '%28';
    histogram[')']   = '%29';
    histogram['*']   = '%2A';
    histogram['~']   = '%7E';
    histogram['!']   = '%21';
    histogram['%20'] = '+';
    histogram['\u00DC'] = '%DC';
    histogram['\u00FC'] = '%FC';
    histogram['\u00C4'] = '%D4';
    histogram['\u00E4'] = '%E4';
    histogram['\u00D6'] = '%D6';
    histogram['\u00F6'] = '%F6';
    histogram['\u00DF'] = '%DF'; 
    histogram['\u20AC'] = '%80';
    histogram['\u0081'] = '%81';
    histogram['\u201A'] = '%82';
    histogram['\u0192'] = '%83';
    histogram['\u201E'] = '%84';
    histogram['\u2026'] = '%85';
    histogram['\u2020'] = '%86';
    histogram['\u2021'] = '%87';
    histogram['\u02C6'] = '%88';
    histogram['\u2030'] = '%89';
    histogram['\u0160'] = '%8A';
    histogram['\u2039'] = '%8B';
    histogram['\u0152'] = '%8C';
    histogram['\u008D'] = '%8D';
    histogram['\u017D'] = '%8E';
    histogram['\u008F'] = '%8F';
    histogram['\u0090'] = '%90';
    histogram['\u2018'] = '%91';
    histogram['\u2019'] = '%92';
    histogram['\u201C'] = '%93';
    histogram['\u201D'] = '%94';
    histogram['\u2022'] = '%95';
    histogram['\u2013'] = '%96';
    histogram['\u2014'] = '%97';
    histogram['\u02DC'] = '%98';
    histogram['\u2122'] = '%99';
    histogram['\u0161'] = '%9A';
    histogram['\u203A'] = '%9B';
    histogram['\u0153'] = '%9C';
    histogram['\u009D'] = '%9D';
    histogram['\u017E'] = '%9E';
    histogram['\u0178'] = '%9F';
 
    for (unicodeStr in histogram) {
        hexEscStr = histogram[unicodeStr]; // Switch order when decoding
        ret = replacer(hexEscStr, unicodeStr, ret); // Custom replace. No regexing
    }
    
    // End with decodeURIComponent, which most resembles PHP's encoding functions
    ret = decodeURIComponent(ret);
 
    return ret;
}//###############################FUNCAO EQUIVALENTE AO SUBSTR_COUNT DO PHP###############################























//###############################FUNCAO DA MASCARA DE MOEDA###############################
	//EX: onkeypress="return(FormataReais(this,'.',',',event));"
	function FormataReais(fld, milSep, decSep, e)
		{
			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;
			//alert("whichCode: "+whichCode);
			if (whichCode == 13) return true;
			key = String.fromCharCode(whichCode);  // Valor para o código da Chave
			//alert("key: "+key);
			if (strCheck.indexOf(key) == -1) return false;  // Chave inválida
			len = fld.value.length;
			for(i = 0; i < len; i++)
			if ((fld.value.charAt(i) != '0') && (fld.value.charAt(i) != decSep)) break;
			aux = '';
			for(; i < len; i++)
			if (strCheck.indexOf(fld.value.charAt(i))!=-1) aux += fld.value.charAt(i);
			aux += key;
			len = aux.length;
			if (len == 0) fld.value = '';
			if (len == 1) fld.value = '0'+ decSep + '0' + aux;
			if (len == 2) fld.value = '0'+ decSep + aux;
			if (len > 2)
				{
					aux2 = '';
					for (j = 0, i = len - 3; i >= 0; i--)
						{
							//alert("aux2: "+aux2);
							if (j == 3)
								{
									aux2 += milSep;
									j = 0;
								}
							aux2 += aux.charAt(i);
							j++;
						}
					fld.value = '';
					len2 = aux2.length;
					for (i = len2 - 1; i >= 0; i--)
					fld.value += aux2.charAt(i);
					//alert("aux conta: "+fld.value+decSep+aux.substr(len - 3, len));
					fld.value += decSep + aux.substr(len - 2, len);
				}
			return false;
			
			
		}
//###############################FUNCAO DA MASCARA DE MOEDA###############################


























//###############################FUNCOES DO DREAMWEAVER###############################
//funcao que abre uma janela pop-up - v2.0
function MM_openBrWindow(theURL,winName,features)
	{
		window.open(theURL,winName,features);
	}

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


//funcao que chama comando de javascript - v2.0
function MM_callJS(jsStr)
	{
		return eval(jsStr)	
	}


//funcao que busca o nome do objeto do formulario - v4.01
function MM_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=MM_findObj(n,d.layers[i].document);
  		if(!x && d.getElementById) x=d.getElementById(n); return x;
	}

//funcao que verifica e valida os campos no fomrularo - v4.0
function MM_validateForm()
	{
		var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
 	 	for (i=0; i<(args.length-2); i+=3) 
			{ 
				test=args[i+2]; val=MM_findObj(args[i]);
				if (val)
					{
						nm=val.name;
						if ((val=val.value)!="")
							{
								if (test.indexOf('isEmail')!=-1) 
									{
										p=val.indexOf('@');
										if (p<1 || p==(val.length-1)) errors+='- '+nm+' deve conter um endereço de e-mail válido.\n';
									}
								else if (test!='R')
									{
										num = parseFloat(val);
										if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
										if (test.indexOf('inRange') != -1) 
											{
												p=test.indexOf(':');
												min=test.substring(8,p); 
												max=test.substring(p+1);
												if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
											}
									}
							}
						else if (test.charAt(0) == 'R') errors += '- É obrigatório o preenchimento do campo '+nm+'\n'; 
					}
  			} 
		if (errors) alert('Erro(s):\n'+errors);
  		document.MM_returnValue = (errors == '');
	}

//define qual navegador estou usando
if((navigator.appName == "Netscape")&&(parseInt(navigator.appVersion)>=4))
	{
		document.captureEvents( Event.KEYDOWN )
		document.onkeyup = countChars;
	}	

//funcao que pre-carrega as imagens - v3.0
function MM_preloadImages()	
	{
  		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];
					}
			}
	}

//funcao que mostra/esconde layers
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; 
			}
	}
//-->

//funcao que volta a imagem original nas rollover images - v3.0
function MM_swapImgRestore() 
	{
  		var i,x,a=document.MM_sr; 
		for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}

//funcao que troca a imagem nas rollover images - v3.0
function MM_swapImage() 
	{
  		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];
			}
}

//###############################FUNCOES DO DREAMWEAVER###############################














//funcao que subemete o formulario
function envia_form(valor,formulario)
	{
		//alert("valor: "+valor);
		//alert("formulario: "+formulario);
		eval("document."+formulario+".acao.value=''");
		eval("document."+formulario+".acao.value='"+valor+"'");
		eval("document."+formulario+".submit()");
	}





//funcao que subemete o formulario exigindo o preenchimento de usuario e senha
function envia_form_senha(valor,formulario,texto_usuario,campo_usuario,campo_senha,lembrar_senha)
	{
		//alert("valor: "+valor);
		//alert("formulario: "+formulario);
		var usuario = eval("document."+formulario+"."+campo_usuario+".value");
		var senha = eval("document."+formulario+"."+campo_senha+".value");
		if(lembrar_senha!="sim")
			{
				if((usuario!="")&&(senha!=""))
					{
						envia_form(valor,formulario);
					}
				else
					{
						alert("Para prosseguir, digite seu "+texto_usuario+" e sua senha");
					}
			}
		else if(lembrar_senha=="sim")
			{
				if(usuario!="")
					{
						envia_form_action_target('inscreva_se','lembrar_senha.php','_self')
					}
				else
					{
						alert("Para prosseguir, digite seu "+texto_usuario);
					}
			}
		if((usuario=="")&&(senha=="")) eval("document."+formulario+"."+campo_usuario+".focus()");
		else if(usuario=="") eval("document."+formulario+"."+campo_usuario+".focus()");
		else if(senha=="") eval("document."+formulario+"."+campo_senha+".focus()");
	}



//funcao que arredonda valores com casas decimais
function arredonda_valor(valor,casas)
	{
		var valor = Math.round( valor * Math.pow( 10 , casas ) ) / Math.pow( 10 , casas );
  	 	//document.write( novo );
		return(valor);
	}
	
//funcao que avisa quando foi dado dois cliques no botao de enviar
function desativa_dbClick()
	{
		alert("Para processar sua solicitação, clique apenas 1 vez no botão de enviar");
	}


//funcao que passa para o proximo campo quando digitar o limite de caracteres
function pula_campo(campo_atual, limite, proximo_campo, form)
	{
		tamanho_campo = eval("document."+form+"."+campo_atual+".value.length");
		//alert("tamanho_campo: "+tamanho_campo);
		//alert("limite: "+limite);
		if(tamanho_campo == limite)
			{
				eval("document."+form+"."+proximo_campo+".focus()");
			}
	}

//funcao que verifica se foi digitado link e se tem http no texto
function verifica_http(campo)
	{
		var conteudo_link = campo.value;
		if(conteudo_link!="") 
			{
				tem_http = conteudo_link.indexOf("http://");
				if(tem_http < 0) 
					{
						alert("É necessário incluir 'http://' no início do endereço");
						campo.focus();
					}
			}
	}
	
		
//funcao que muda o action e posta o form
function envia_form_action_target(formulario,action,target)
	{
		eval("document."+formulario+".target = '"+target+"'");
		eval("document."+formulario+".action = '"+action+"'");
		eval("document."+formulario+".submit()");
	}


//funcao que posta o formulario atribuindo um valor para o ACAO e mudando o action
function envia_form_action(formulario,action,valor_acao)
	{
		eval("document."+formulario+".acao.value = '"+valor_acao+"'");
		eval("document."+formulario+".action = '"+action+"'");
		eval("document."+formulario+".submit()");
	}


//funcao que posta o formulario atribuindo um valor para o ACAO e mudando o action
function envia_form_action_target_acao(formulario,action,target,valor_acao)
	{
		eval("document."+formulario+".acao.value = '"+valor_acao+"'");
		eval("document."+formulario+".target = '"+target+"'");
		eval("document."+formulario+".action = '"+action+"'");
		eval("document."+formulario+".submit()");
	}
	
	
//funcao que limpa os valores do campo e retorna o foco nele
function limpa_valor(form,campo)
	{
		eval("document."+form+"."+campo+".value=''");
		eval("document."+form+"."+campo+".focus()");
	}


//funcao que desabilita o botao de inserir/alterar no form
function desabilita_botao()
	{
		var controle = document.admin.desabilita.value;
		if(controle=='desabilita') document.admin.botao.disabled = true;
	}


//converte o numero em moeda
function float2moeda(num) 
	{
		x = 0;
		if(num<0) 
			{
				num = Math.abs(num);
				x = 1;
			}  
		if(isNaN(num)) num = "0";
      	cents = Math.floor((num*100+0.5)%100);
		num = Math.floor((num*100+0.5)/100).toString();
		
		if(cents < 10) cents = "0" + cents;
      	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
        num = num.substring(0,num.length-(4*i+3))+'.'
		+num.substring(num.length-(4*i+3));   
		ret = num + ',' + cents;   if (x == 1) ret = ' - ' + ret;return ret;
	}
	
	

//funcao que mostra ou esconde as opcoes de escolaridade no cadastro de curriculum
function mostra_cadastro_escolaridade(escolaridade)
	{
		if(escolaridade=='pos_graduacao')
			{
				document.getElementById("pos_graduacao").style.display = ''
				document.getElementById("ensino_superior").style.display = ''
				document.getElementById("ensino_medio").style.display = 'none'
				document.getElementById("ensino_tecnico").style.display = 'none'
				document.getElementById("ensino_fundamental").style.display = 'none'
			}
		if((escolaridade=='superior_completo')||(escolaridade=='superior_incompleto'))
			{
				document.getElementById("pos_graduacao").style.display = 'none'
				document.getElementById("ensino_superior").style.display = ''
				document.getElementById("ensino_medio").style.display = 'none'
				document.getElementById("ensino_tecnico").style.display = 'none'
				document.getElementById("ensino_fundamental").style.display = 'none'
			}
		if((escolaridade=='ensino_medio_completo')||(escolaridade=='ensino_medio_incompleto'))
			{
				document.getElementById("pos_graduacao").style.display = 'none'
				document.getElementById("ensino_superior").style.display = 'none'
				document.getElementById("ensino_medio").style.display = ''
				document.getElementById("ensino_tecnico").style.display = 'none'
				document.getElementById("ensino_fundamental").style.display = 'none'
			}
		if((escolaridade=='curso_tecnico')||(escolaridade=='curso_tecnico_incompleto'))
			{
				document.getElementById("pos_graduacao").style.display = 'none'
				document.getElementById("ensino_superior").style.display = 'none'
				document.getElementById("ensino_medio").style.display = 'none'
				document.getElementById("ensino_tecnico").style.display = ''
				document.getElementById("ensino_fundamental").style.display = 'none'
			}
		if((escolaridade=='ensino_fundamental_completo')||(escolaridade=='ensino_fundamental_incompleto'))
			{
				document.getElementById("pos_graduacao").style.display = 'none'
				document.getElementById("ensino_superior").style.display = 'none'
				document.getElementById("ensino_medio").style.display = 'none'
				document.getElementById("ensino_tecnico").style.display = 'none'
				document.getElementById("ensino_fundamental").style.display = ''
			}
	}


//funcao que mostra/esconde um item usando o display
function mostra_esconde(nome,acao)
	{
		eval("document.getElementById('"+nome+"').style.display = '"+acao+"'");
	}


//funcao que valida o formlario de contato - SITE FIEMT
function envia_form_contato()
	{
		var destino_mensagem = document.contato.destino_mensagem[document.contato.destino_mensagem.selectedIndex].value;
		var nome = document.contato.nome.value;
		var telefone = document.contato.telefone.value;
		var email = document.contato.email.value;
		var mensagem = document.contato.mensagem.value;
		
		var mensagem_alert = '';
		
		if(destino_mensagem=="") mensagem_alert += "\n- Selecione o destino da mensagem.";
		if(nome=="") mensagem_alert += "\n- Digite seu nome.";
		if((telefone=="")&&(email=="")) mensagem_alert += "\n- Digite um telefone ou e-mail para contato.";
		if(mensagem=="") mensagem_alert += "\n- Digite o texto da mensagem.";
		
		if(mensagem_alert=="")
			{
				document.contato.submit();
			}
		else
			{
				alert('Os seguintes erros foram encontrados: '+mensagem_alert);
			}
	}
	

/*####################FUNCAO QUE AUMENTA/DIMINUI A FONTE####################*/
var tam = 13;

function mudaFonte(tipo,elemento){
	if (tipo=="mais") {
		if(tam<18) tam+=1;
		createCookie('fonte',tam,365);
	} else {
		if(tam>10) tam-=1;
		createCookie('fonte',tam,365);
	}
	document.getElementById('texto_materia').style.fontSize = tam+'px';
	// document.getElementById('mudaFoto').style.fontSize = tam+'px';
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	} else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
/*####################FUNCAO QUE AUMENTA/DIMINUI A FONTE####################*/


//funcao que mostra as permissoes do usuario
//id_div = id da DIV que contem os itens
function mostra_permissoes_usuarios(id_div)
	{
		$("#"+id_div).slideDown();
		$("#img_"+id_div).animate({ opacity: "hide" });
	}

