
/**
* Função para inibir clicks em links e botões se for preview
* de estatística
*/
setFuncaoOnLoad("configEventosPreviewEstatistica()");
function configEventosPreviewEstatistica(){
	if(getParametroUrl("nca") == 's'){
		setUpOnEventoTag ('INPUT', 'onclick', 'inibeOnClick');
		setUpOnEventoTag ('A', 'onclick', 'inibeOnClick');
		configEventosMouse("mousedown");
		configEventosMouse("contextmenu");
	}	
}
function EcpEvento(){}
var ecpEvento = new EcpEvento();
EcpEvento.prototype.handlerOnResize = function(){
	ecpEvento.evtOnResize();
}
EcpEvento.prototype.evtOnResize = function(){
}
if(ExpYes)
	window.attachEvent("onresize", ecpEvento.handlerOnResize);
else	
	window.addEventListener("resize", ecpEvento.handlerOnResize,true)

function addToFavorites(title, url){

	if(title == "")
		title = document.title;
	if(url == "")	
		url = document.location.href;
	if (document.all)
		window.external.AddFavorite(url, title);
	else if (window.sidebar)
		window.sidebar.addPanel(title, url, "")
}

function enviarEmail(assunto, nomeDiv, email, nome){
	var emailPortal = "&emailPortal=S";
	var conteudo = getElementoPorId(nomeDiv).innerHTML;
	conteudo = conteudo.substring(0,conteudo.indexOf("<MENU_OPCOES>")) + conteudo.substring(conteudo.indexOf("</MENU_OPCOES>")+14, conteudo.length);
	var head = getCabecalho();
	conteudo = incluiEndAbsoluto(head+conteudo);
	
	if(email != ""){
		email = "&email="+email
		emailPortal = "&emailPortal=A";
		if(nome != "")
			nome = "&nome="+nome
	}	
	setVarGlobal("emailConteudo",conteudo)
	setVarGlobal("emailAssunto",assunto)
	if(ExpYes)
		janela(plcGeral.contextPath+"/ecp/webmailnovamsg.do?evento=novaMensagem&acao=N&acao=N"+emailPortal+email+nome,400,370);
	else
		janela(plcGeral.contextPath+"/ecp/webmailnovamsg.do?evento=novaMensagem&acao=N&acao=N"+emailPortal+email+nome,405,380);
}

function incluiEndAbsoluto(conteudo){
	var host = document.location.hostname;
	var port = document.location.port;
	port = typeof port == "undefined" || port == null ? "" : ":"+port;
	var urlBase = "http://"+host+port+plcGeral.contextPath+"/";

	do{
		conteudo = conteudo.replace("href=\""+plcGeral.contextPath+"/","href=\""+urlBase)
	}while(conteudo.indexOf("href=\""+plcGeral.contextPath) > -1)
	do{
		conteudo = conteudo.replace("src=\""+plcGeral.contextPath+"/","src=\""+urlBase)
	}while(conteudo.indexOf("src=\""+plcGeral.contextPath) > -1)
	do{
		conteudo = conteudo.replace("\/ecp\/images.do","images.do")
	}while(conteudo.indexOf("\/ecp\/images.do"+plcGeral.contextPath) > -1)
	do{
		conteudo = conteudo.replace("/ecp/files.do","files.do")
	}while(conteudo.indexOf("/ecp/files.do"+plcGeral.contextPath) > -1)
	
	conteudo = conteudo.replace(/images.do/g,urlBase+"images.do")
	conteudo = conteudo.replace(/files.do/g,urlBase+"/ecp/files.do")
	
	return conteudo;
}

function getCabecalho(){

	var head = "";
	if(ExpYes)
		head = document.all.tags('head')[0].innerHTML;
	else	
		head = document.getElementsByTagName('head')[0].innerHTML;
	return head;
}
/***************************************************\
LÓGICAS PARA MARCAÇÃO DE TERMOS BUSCADOS
\***************************************************/

//setFuncaoOnLoad("init_google()");

// Google Highlighter
// Copyright(C)2001 - 2003
// Cal Henderson <cal@iamcal.com>
// Thanks to Ian Beveridge for bugfixes
// This code may be freely redistributed,
// providing this message remains intact.
//Script featured on & available at Dynamic Drive (http://www.dynamicdrive.com)
//Changes: Modification to window.onload code
var google_text_color = '#000000';
var google_link_colors = new Array('#ffff66','#a0ffff','#99ff99','#ff9999','#ff66ff');
function init_google(){
	var pattern = /\/busca\.do/i;
	var url = document.referrer ? document.referrer : opener ? opener.location : "";
	alert("URL: "+url)
	alert("getParametroUrl('pAcPgIni'): "+getParametroUrl("pAcPgIni"))
	alert("document.location: "+document.location)
	alert("pattern.exec(url): "+pattern.exec(url))
	if (!getParametroUrl("pAcPgIni") && document.location != url && pattern.exec(url) != null){
		var url_parts = url.split('?');
	//if (pattern.exec(document.location.href) != null){
	//	var url_parts = document.location.href.split('?');
		//var url_parts = document.location.href.split('?');
		//alert("url_parts: "+url_parts)
		if (url_parts[1]){ 
			var url_args = url_parts[1].split('&');
			for(var i=0; i<url_args.length; i++){
				var keyval = url_args[i].split('=');
				if (keyval[0] == 'busca'){
					go_google(decode_url(keyval[1]));
					return;
				}
			}
		}
	}
}
function decode_url(url){
	return unescape(url.replace(/\+/g,' '));
}
function go_google(terms){
	terms = terms.replace(/\"/g,"");
	var terms_split = terms.split(' ');
	var c = 0;
	for(var i=0; i<terms_split.length; i++){
		highlight_google(terms_split[i], document.body,google_link_colors[c]);
		c = (c == google_link_colors.length-1)?0:c+1;
	}
	//JSFX_FloatTopDiv();
}
function highlight_google(term, container, color){
	var term_low = term.toLowerCase();
	for(var i=0; i<container.childNodes.length; i++){
		var node = container.childNodes[i];
		if (node.nodeType == 3){
			var data = node.data;
			var data_low = data.toLowerCase();
			if (data_low.indexOf(term_low) != -1){
				//term found!
				var new_node = document.createElement('SPAN');
				node.parentNode.replaceChild(new_node,node);
				var result;
				while((result = data_low.indexOf(term_low)) != -1){
					new_node.appendChild(document.createTextNode(data.substr(0,result)));
					new_node.appendChild(create_node_google(document.createTextNode(data.substr(result,term.length)),color));
					data = data.substr(result + term.length);
					data_low = data_low.substr(result + term.length);
				}
				new_node.appendChild(document.createTextNode(data));
				linksProcurar(term, color);
			}
		}else{
			//recurse
			highlight_google(term, node, color);
		}
	}
}
function create_node_google(child, color){
	var node = document.createElement('SPAN');
	node.style.backgroundColor = color;
	node.style.color = google_text_color;
	node.appendChild(child);
	return node;
}

var linksTermos = "<div style=\"background-color: #FFFFCC; border:1px solid #000000; padding: 2px 2px 2px 2px;\"><b>Termos buscados:<br></b></div>";
function linksProcurar(termo, cor){
	linksTermos = linksTermos.replace("</div>","");
	if(linksTermos.indexOf(termo) < 0)
		linksTermos += "<span style=\"background-color:'"+cor+"';\">"+termo+"</span>&nbsp;</div>";
	//divLinks += "<span style=\"background-color:'"+cor+"';\"><a href=\"#\" onclick=\"procurarTermo('"+termo+"')\">["+cor+"]</a></span>&nbsp;</div>";
	//alert(getElementoPorId("divLinks").innerHTML)
	getElementoPorId("divLinks").innerHTML = linksTermos;
}


/*
 * File Authors:
 * 		Paul Moers (mail@saulmade.nl)
 * 		Thanks to Christian Fecteau (webmaster@christianfecteau.com)
 */
/***************************************************\
	REDIMENSIONA OBJETO PARA TELA CHEIA
\***************************************************/
function EcpResize(name,print){
	this.Name = name;
	this.objetoResize = parent.document.getElementById(this.Name);
	this.documentElementOverflow;
	this.bodyCssText;
	this.bodyClassName;
	this.originalCssText;
	this.originalWidth;
	this.originalHeight;
	this.autoFitToResize = true;
	this.objetoCentralizado = true;
}
var ecpResize = new EcpResize();
EcpResize.prototype.hasBeenResized = null;
EcpResize.prototype.Resize = function(evt, name, resize, print){
		if(typeof name != "undefined"){
				ecpResize.Name = name;
				ecpResize.objetoResize = parent.document.getElementById(ecpResize.Name);
		}	
		if(ExpYes){
			evt = event;
		}
		
		if(evt.type == 'resize'){
				ecpResize.Execute(false);
				ecpResize.Execute(true);
		}	else if(typeof resize == "undefined" || resize == "")
				ecpResize.Execute(!ecpResize.hasBeenResized);
		else 
				ecpResize.Execute(true);
		if(print && ecpResize.hasBeenResized)	
			window.print();
}

EcpResize.prototype.Execute = function(hasBeenResized)
{
	var viewPaneWidth, viewPaneHeight;
	ecpResize.hasBeenResized = (hasBeenResized == null) ? false : hasBeenResized;
	if (ecpResize.originalCssText == null || ecpResize.hasBeenResized == true){
		if (hasBeenResized && ecpResize.autoFitToResize){
			if (ExpYes)
				window.attachEvent("onresize", ecpResize.Resize);
			else 
				window.addEventListener("resize", ecpResize.Resize, true);
		}
		// preparing the body for the editor in fullsize and hiding the scrollbars in Firefox
		with (top.document.getElementsByTagName("body")[0].style){
			ecpResize.bodyCssText= cssText; cssText= "";overflow= "hidden";
			margin= "0px";padding= "0px";height= "0px";width= "0px";
			position= "static";top= "0px";left= "0px";
		}
		// also storing a possible className
		ecpResize.bodyClassName = top.document.getElementsByTagName("body")[0].className;
		// hide IE scrollbars (in strict mode)
		if (ExpYes){
			ecpResize.documentElementOverflow = top.document.documentElement.style.overflow;
			top.document.documentElement.style.overflow = "hidden";
		}
		// now when the scrollbar is hidden, find the viewPane's dimensions
		viewPaneWidth = findViewPaneWidth();
		viewPaneHeight = findViewPaneHeight();
		// resize
		with (ecpResize.objetoResize.style){
			ecpResize.originalCssText					= cssText;
			ecpResize.originalWidth						= ecpResize.objetoResize.width;
			ecpResize.originalHeight						= ecpResize.objetoResize.height;
			position= "absolute";zIndex= "9999999";left= "0px";
			top= "0px";width= viewPaneWidth + "px";
			//height= viewPaneHeight + "px";
			height= viewPaneHeight;
			// giving the frame some (huge) borders on his right and bottom side to hide the background that would otherwise show when the editor is in fullsize mode and the window is increased in size
			// not for IE, because IE immediately adapts the editor on resize, without showing any of the background
			// oddly in firefox, the editor seems not to fill the whole frame, so just setting the background of it to white to cover the page laying behind it anyway
			if (NavYes){
				borderRight= "9999px solid white";borderBottom= "9999px solid white";
			}backgroundColor						= "white";
		}
		// scroll to top left
		top.window.scrollTo(0, 0);
	}// original style properties available? Resize to original size.
	else{
		// Removing the event handler of windowresizing
		if (ecpResize.autoFitToResize == true){
			if (top.detachEvent)
				top.detachEvent("onresize", ecpResize.Resize);
			//else if(top.removeEventListener)
				//top.removeEventListener("resize", ecpResize.Resize, true);
		}
		// restoring the body and restoring the scrollbars in Firefox
		with (top.document.getElementsByTagName("body")[0].style)
			cssText										= ecpResize.bodyCssText;
		// maybe it had a className...
		top.document.getElementsByTagName("body")[0].className = ecpResize.bodyClassName;
		// show IE scrollbars
		if (ExpYes)
			top.document.documentElement.style.overflow = ecpResize.documentElementOverflow;
		// restore original size
		with (ecpResize.objetoResize.style){
			try{
			cssText										= ecpResize.originalCssText;
			width											= ecpResize.originalWidth;
			height										= ecpResize.originalHeight;
			position									= "static";
			}catch(e){}
		}
		// scrolling so that the editor appears centered in the viewPane
		var adjustX, adjustY = 0;
		if (ecpResize.objetoCentralizado){
			viewPaneWidth = findViewPaneWidth();
			viewPaneHeight = findViewPaneHeight();
			adjustX = (viewPaneWidth - ecpResize.objetoResize.width) / 2;
			adjustY = (viewPaneHeight - ecpResize.objetoResize.height) / 2;
			if (adjustX < 1)
				adjustX = 0;
			if (adjustY < 1)
				adjustY = 0;
		}
		// Scroll to the editor
		top.window.scrollTo(findPosX(ecpResize.objetoResize) - adjustX, findPosY(ecpResize.objetoResize) - adjustY);
		// empty CSS buffer
		ecpResize.originalCssText = null;
	}
}
// finding the viewPane's width
function findViewPaneWidth(){
	var viewPaneWidth = 0;
	if (top.window.clientWidth) // all except Explorer
		viewPaneWidth = top.window.clientWidth;
	else if (top.document.documentElement && top.document.documentElement.clientWidth) // Explorer 6 Strict Mode
		viewPaneWidth = top.document.documentElement.clientWidth;
	else if (top.document.body) // other Explorers
		viewPaneWidth = top.document.body.clientWidth;
	return viewPaneWidth;
}
// finding the viewPane's height
function findViewPaneHeight(){
	var viewPaneHeight = "100%";
	//Comentado para que a altura seja retornada como 100%
/*	if (top.window.clientHeight) // all except Explorer
		viewPaneHeight = top.window.clientHeight;
	else if (top.document.documentElement && top.document.documentElement.clientHeight) // Explorer 6 Strict Mode
		viewPaneHeight = top.document.documentElement.clientHeight;
	else if (top.document.body) // other Explorers
		viewPaneHeight = top.document.body.clientHeight;
*/	
	return viewPaneHeight;
}

function findPosX(obj){
	var curleft = 0;
	if (obj.offsetParent)	{
		while (obj.offsetParent){
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}	else if (obj.x)
		curleft += obj.x;
	return curleft;
}
function findPosY(obj){
	var curtop = 0;
	var printstring = '';
	if (obj.offsetParent)	{
		while (obj.offsetParent){
			printstring += ' element ' + obj.tagName + ' has ' + obj.offsetTop;
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

/***************************************************\
MENU FLUTUANTE BUSCA
\***************************************************/

/*
Floating Menu script-  Roy Whittle (http://www.javascript-fx.com/)
Script featured on/available at http://www.dynamicdrive.com/
This notice must stay intact for use
*/
//Enter "frombottom" or "fromtop"
var verticalpos="fromtop"
if (!document.layers)
document.write('</div>')

function JSFX_FloatTopDiv()
{
	var startX = 0,
	startY = 0;
	var ns = (navigator.appName.indexOf("Netscape") != -1);
	var d = document;
	function ml(id)
	{
		var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
		if(d.layers)el.style=el;
		el.sP=function(x,y){this.style.left=x;this.style.top=y;};
		el.x = startX;
		if (verticalpos=="fromtop")
		el.y = startY;
		else{
		el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
		el.y -= startY;
		}
		return el;
	}
	window.stayTopLeft=function()
	{
		if (verticalpos=="fromtop"){
		var pY = ns ? pageYOffset : document.body.scrollTop;
		ftlObj.y += (pY + startY - ftlObj.y)/8;
		}
		else{
		var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
		ftlObj.y += (pY - startY - ftlObj.y)/8;
		}
		ftlObj.sP(ftlObj.x, ftlObj.y);
		setTimeout("stayTopLeft()", 10);
	}
	
	ftlObj = ml("divStayTopLeft");
	stayTopLeft();
}

/***************************************************\
PROCURA DE TERMOS
\***************************************************/

function procurarTermo(termo){
	if(ExpYes)
		procurarTermoIE(termo);
	else
		procurarTermoFF(termo);
}

function procurarTermoIE2(termo) {
	var r = document.body.createTextRange();
	r.findText(termo);
	r.select();
}

function procurarTermoIE(termo) {
   // get the selection range and text range
   var findRange = document.selection.createRange();
   var textRange = document.body.createTextRange();
   // make sure selection is in editor 
   if (!textRange.inRange(findRange)) {
      // if selection not in editor place it in editor en re-execute button
      textRange.collapse(true);
      textRange.select();          
      findRange = textRange;
      //procurarTermoIE(termo);
   } //else {
      var text_length = textRange.htmlText.length;
      var updown = 1;
      // set the searchflags
      var iFlags = 2;
      // set the searchscope
      var iSearchScope  = text_length  * updown;
      // search the string and position  
      if ( updown == 1 ) {
         if (findRange.htmlText != '') {
            // nondegenerate range : deplace start position
            findRange.moveStart("word");
         }
         //findRange.moveEnd("textedit");
      } else {
         iFlags = iFlags + 1;
         findRange.moveStart("character",1);
         findRange.moveEnd("character",-1);
      }
      if (findRange.findText(termo,iSearchScope,iFlags)){
         // found: select the text
         findRange.select();
         findRange.scrollIntoView();
      } else {
         // not found : give a warning
         alert('Fim da busca.');
      }
   //}
}
function procurarTermoFF(termo){
	// window.find( searchString, caseSensitive, backwards, wrapAround, wholeWord, searchInFrames, showDialog ) ;
  	window.find( termo, false, false, false, true, false, false );
}


function novaMensagem(email, pele){
	WEBMAIL_ACAO = "MNV";
	email = typeof email != "undefined" ? email : "";
	if(email.indexOf("<") > -1){
		email = email.substring(email.indexOf("<")+1);
		email = email.substring(0,email.indexOf(">"));
	}
	if(email != "")
		email = "&email="+email.toLowerCase();
		
	janela(plcGeral.contextPath+"/ecp/webmailnovamsg.do?evento=novaMensagem&wmAcao="+WEBMAIL_ACAO+email+"&pelePlc"+pele,850,600);
}


function verificarEnquete(acao, url, w, h, props,campo, form){
	var winEnquete;	
	var resposta;
	if(acao == "v")	{
		resposta = get(campo,form);
		url += resposta
		if(resposta == ""){
			exibeMsg(msgErroEnquete)
			return false;
		}
	}
	url += "&app="+getParametroUrl ('app');
	if(props != "" && ""+props != "undefined")
		winEnquete = janela(url,"",props);
	else
		winEnquete = janela(url,"","resizable=no,scrollbars=no,width="+w+",height="+h);
}


function montaCaminhoNavegacao(conteudo){

		debug = false;


		var exibeLink 		= getVarGlobal("NAVEGACAO_EXIBE_HIPERLINKS");
		var link	 		= "<a href='"+getVarGlobal("NAVEGACAO_TAX_LINK")+"'>[LINK]</a>";
		//if(debug) alert("link: "+link)
		var pagina			= getVarGlobal("NAVEGACAO_ID_PAGINA");
		//if(debug) alert("pagina: "+pagina)
		var nivel1Nv		= getVarGlobal("NAVEGACAO_NIVEL_1_NV");
		if(debug) alert("nivel1Nv: "+nivel1Nv)

		var nomeComunidade 	= getVarGlobal("NAVEGACAO_NOME_COMUNIDADE");
		var nomePagina 		= getVarGlobal("NAVEGACAO_NOME_PAGINA");

		var nivel1	 		= getVarGlobal("NAVEGACAO_NIVEL_1") ? getVarGlobal("NAVEGACAO_NIVEL_1") : "";
		var nivel1H	 		= getVarGlobal("NAVEGACAO_NIVEL_1_H");
		var nivel1HArray	= nivel1H ? nivel1H.split("/") : new Array();
		if(debug) alert("nivel1: "+nivel1)
		//if(debug) alert("nivel1H: "+nivel1H)
		if(debug) alert("nivel1HArray: "+nivel1HArray)

		var	posApp			= nivel1.indexOf("/");
		var nomeApp			= nivel1.substring(0,posApp);
		nivel1 = nivel1.substring(posApp+1);
		var nv1Array		= nivel1.split("/");
		if(debug) alert("nv1Array: "+nv1Array);

		var nivelAtual	 		= getVarGlobal("NAVEGACAO_NIVEL_ATUAL");
		if(nivelAtual == null || nivelAtual == "")
			nv1Array.pop();
		if(debug) alert("nivelAtual: "+nivelAtual)

		var nomeConteudo 	= getVarGlobal("NAVEGACAO_NOME_CONTEUDO");

		var divNavegacao 	= getElementoPorId("DIV_CAMINHO_NAVEGACAO");
		if(!divNavegacao)
			return;

		var conteudo 	= divNavegacao.innerHTML;
			
    	var tokens 		= new Array("COMUNIDADE","PAGINA","CONTEUDO");
    	var tokensVal 	= new Array(nomeComunidade,nomePagina,nomeConteudo);

		for(var ind = 0; ind < nv1Array.length; ind++){
			tokens[tokens.length] = "NIVEL_" + Math.abs(ind + 1);
			tokensVal[tokensVal.length] = nv1Array[ind];
		}
		for(var ind2 = ind; ind2 < 10; ind2++){
			tokens[tokens.length] = "NIVEL_" + Math.abs(ind2 + 1);
			tokensVal[tokensVal.length] = "";
		}

		tokens[tokens.length] = "NIVEL_ATUAL";
		tokensVal[tokensVal.length] = nivelAtual;

		if(debug) alert("tokens: "+tokens)
		if(debug) alert("tokensVal: "+tokensVal)

    	var token 		= "";
		var separador	= "";
		var linkAux		= "";
		var linkAnt		= "";
		var contTax		= 2;
    	for(var indTk = 0; indTk < 14; indTk++){
    		
			if(indTk > 7)
				debug = false;

			if(tokens[indTk]){
				token = tokens[indTk];
			} else if (indTk == 10){
				token = "NIVEL_ATUAL";
			}else{
				token = "NIVEL_"+indTk;
			}

			linkAux	= link;
			if(indTk < 4 || ((indTk+4) % 2 == 0) || token.indexOf("ATUAL") >= 0){

				if(debug) alert("NOVO LINK PARA TOKEN "+indTk+": "+token)

				if(token.indexOf("NIVEL") >= 0 && token.indexOf("ATUAL") < 0 &&  nivel1HArray[contTax]){
					if(debug) alert("contTax: "+ contTax)
					if(indTk >= 4 && contTax < nivel1HArray.length && nivel1HArray[contTax]){
						linkAux = linkAux.replace("[TAX]","&tax="+nivel1HArray[contTax]);
						linkAux = linkAux.replace("[TAXP]","&taxp="+nivel1HArray[contTax]);
						if(debug) alert("NOVO LINK NIVEL: "+linkAux)
						contTax+=2;
					}
				}else if(token.indexOf("ATUAL") >= 0 && tokensVal[indTk]){
					linkAux = tokensVal[indTk];
				}
				
				if(linkAux != "")
					linkAnt = linkAux;

			}else{
				if(debug) alert("USANDO LINK ANTERIOR: "+linkAnt)
				linkAux = linkAnt;
			}

			if(token.indexOf("CONTEUDO") >= 0 && typeof tokensVal[indTk] != "undefined")
				linkAux = tokensVal[indTk];
			if (token.indexOf("COMUNIDADE") >= 0 || token.indexOf("PAGINA") >= 0)
				linkAux	= link;
			if (exibeLink == 'N' && tokensVal[indTk])
				linkAux	= tokensVal[indTk];
			
			linkAux = linkAux.replace("[LINK]",tokensVal[indTk]);

			//Limpando link
			if(token.indexOf("COMUNIDADE"))
				linkAux = linkAux.replace("[PAGINA]","");
			if(pagina != null && pagina != "")
				linkAux = linkAux.replace("[PAGINA]","&pg="+pagina);
			linkAux = linkAux.replace("[TAX]","");
			linkAux = linkAux.replace("[TAXP]","");

			if(debug) alert("Trocando token "+ indTk +": "+ token+"\nPor: "+linkAux)

        	separador	= "SEPARADOR_"+token;
        	posToken 	= conteudo.indexOf("$"+token+"$");
        	posIni 		= conteudo.indexOf("$"+separador+"$");
        	posFim 		= posToken + (("$"+token+"$").length - 1);
        	if(posToken >= 0 && tokensVal[indTk] != null && !tokensVal[indTk] == ""){
				conteudo = conteudo.replace("$"+token+"$",linkAux);
				conteudo = conteudo.replace("$"+separador+"$", "");
        	}	
        	else{
        		var replace = "";
        		if(posIni > 0)
        			replace = conteudo.substring(posIni, posFim + 1);
        		else
        			replace = "$"+token+"$";
        		conteudo = conteudo.replace(replace, "");
        	}
    	}
		
		divNavegacao.innerHTML = conteudo;
		divNavegacao.style.display = 'block';
}