
	/**
	* 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;
	}


	/*
	 * 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();
	}

	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.replaceAll("[TAX]","&tax="+nivel1HArray[contTax]);
							linkAux = linkAux.replaceAll("[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.replaceAll("[LINK]",tokensVal[indTk]);

				//Limpando link
				if(token.indexOf("COMUNIDADE"))
					linkAux = linkAux.replaceAll("[PAGINA]","");
				if(pagina != null && pagina != "")
					linkAux = linkAux.replaceAll("[PAGINA]","&pg="+pagina);
				linkAux = linkAux.replaceAll("[TAX]","");
				linkAux = linkAux.replaceAll("[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.replaceAll("$"+token+"$",linkAux);
					conteudo = conteudo.replaceAll("$"+separador+"$", "");
				}	
				else{
					var replace = "";
					if(posIni > 0)
						replace = conteudo.substring(posIni, posFim + 1);
					else
						replace = "$"+token+"$";
					conteudo = conteudo.replaceAll(replace, "");
				}
			}
			
			divNavegacao.innerHTML = conteudo;
			divNavegacao.style.display = 'block';
	}

	setAtalho("CTRL#SHIFT#R", "executaRefresh()");
	function executaRefresh(){

		var url = location.href;
		removerParametroUrl(url,"refresh");
		removerParametroUrl(url,"refreshAll");
		incluirParametroUrl(url,"refresh","s")
		redirect(url);
	}

	function removerParametroUrl(url,param)
	{
		var paramUrl = getParametroUrl(param);
		url = url.replaceAll("&"+param+"="+paramUrl,"");
		url = url.replaceAll(param+"="+paramUrl,"");
		return url;
	}

	function incluirParametroUrl(url,paramNome,paramVal)
	{
		url = removerParametroUrl(url,paramNome);
		url += url.indexOf("?") >= 0 ?	"&" : "?";
		url += paramNome+"="+paramVal;
		return url;
	}

	function getAlturaInternaJanela() {
	  var myHeight = 0;
	  if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myHeight = window.innerHeight;
	  } else if( document.documentElement && document.documentElement.clientHeight) {
		//IE 6+ in 'standards compliant mode'
		myHeight = document.documentElement.clientHeight;
	  } else if( document.body && document.body.clientHeight) {
		//IE 4 compatible
		myHeight = document.body.clientHeight;
	  }

	  return myHeight;
	}

	var initMediaBox = false;
	var GALERIA_1	= "GALERIA_1";
	var IMAGENS		= "IMAGENS";
	setFuncaoOnLoad("setUpMediaShadowbox('GALERIA_1', 'shadowbox[GALERIA_1]')");
	//setFuncaoOnLoad("setUpImageShadowbox('shadowbox[IMAGENS]')");
	//setFuncaoOnLoad("iniciarShadowbox()");
	function setUpMediaShadowbox (NOME, REL) {

		//Recupera LINKS
		var elementos = document.getElementsByName(NOME);
		if(elementos && elementos.length > 0 && typeof jQuery != "undefined") {
			var elementoAnterior = elementos;
			if(!elementos.length){
				elementos = new Array();
				elementos[elementos.length] = elementoAnterior
			}
			initMediaBox = true;
			for (e = 0; e < elementos.length; e++) {
				var umElemento = elementos[e];
				if(umElemento && umElemento.tagName == 'A'){
					umElemento.rel	= REL;
				}
				else if (umElemento && umElemento.tagName == 'IMG'){
					var a = document.createElement('A');
					a.href = umElemento.src;
					a.className = "ESCONDIDO";
					a.rel	= REL;
					document.body.appendChild(a);
				}

			}

			//Recupera IMAGENS
			var elementos = document.getElementsByTagName("IMG");
			if(elementos && elementos.length > 0 && typeof jQuery != "undefined") {
				initMediaBox = true;
				var elementoAnterior = elementos;
				if(!elementos.length){
					elementos = new Array();
					elementos[elementos.length] = elementoAnterior
				}
				for (i = 0; i < elementos.length; i++) {
					var umElemento = elementos[i];
					if(umElemento.id == NOME){
						var a = document.createElement('A');
						a.href = umElemento.src;
						a.className = "ESCONDIDO";
						a.rel	= REL;
						document.body.appendChild(a);
					}
				}
			}
		}
	}


	function setUpImageShadowbox (REL) {

		//Recupera IMAGENS
		var elementos = document.getElementsByTagName("IMG");
		if(elementos && elementos.length > 0 && typeof jQuery != "undefined") {
			initMediaBox = true;
			if(!elementos.length){
				elementos = gerarArrayElementos(elementos);
			}
			for (i = 0; i < elementos.length; i++) {
				var umElemento = elementos[i];
				var a = document.createElement('A');
				a.href = umElemento.src;
				a.className = "ESCONDIDO";
				a.rel	= REL;
				document.body.appendChild(a);
			}
		}
	}

	function gerarArrayElementos(origElem){
		var elementoAnterior = origElem;
		origElem = new Array();
		origElem[origElem.length] = elementoAnterior
		return origElem;
	}



	/**********************************************************************************
									PORTLET BANNER
	**********************************************************************************/

	function criarBanner(idBanner, velocidade, efeito, possuiLinks){

		var tFx = traduzEfeito(efeito);
		var proximo = !possuiLinks ? '#'+idBanner : "";

		var opcoes = { 
			fx:     tFx, 
			speed:  300, 
			next:   proximo,
			timeout: velocidade 
		};
		criarBannerComOpcoes(idBanner, opcoes, possuiLinks);

	}

	function criarBannerComOpcoes(idBanner, opcoes, possuiLinks){

		var config = { 
				fx:     "slideX", 
				speed:  300, 
				next:   '#'+idBanner,
				timeout: 10000 
		}

		$.extend(config, opcoes);
			
		$('#'+idBanner).cycle(config);

	}

	function traduzEfeito(fx){

		if("Rolar Hor." == fx)
			return 'scrollHorz';
		else if("Rolar Vert." == fx)
			return 'scrollVert';
		else if("Trocar" == fx)
			return 'fade';
		else if("Aleatório" == fx)
			return 'shuffle';
		else return "fade"
	}

	/***********************************************************************************
									PORTLET GALERIA
	************************************************************************************/

	var opcoesPadrao = {
			loadingImage: "/plc/javascript/jquery/shadowbox/images/loading.gif", //The URL of an image to use as a loading indicator while loading content. Defaults to "images/loading.gif".
			resizeLgImages:     false,
			handleLgImages:		"drag", //The mode to use for handling images that are too large for the viewport. May be one of "none", "resize", or "drag". Defaults to "resize".
			displayNav:         true, //Set this false to hide the gallery navigation controls. Defaults to true.
			continuous: true, //Set this true to enable "continuous" galleries. 
			counterType: 'default', //The mode to use for the gallery counter. May be either 'default' or 'skip'. Defaults to "default".
			initialHeight: 160, //The height of Shadowbox (in pixels) when it first appears on the screen. Defaults to 160. 
			initialWidth: 320, //The width of Shadowbox (in pixels) when it first appears on the screen. Defaults to 320. 
			animate: true, //Set this false to disable all fancy dimension and opacity animations. This can improve the overall effect on computers with poor performance. Defaults to true.
			overlayColor: "#000", //The color to use for the overlay. Defaults to "#000".
			overlayOpacity: 0.85, //The transparency of the overlay. Defaults to 0.85.
			resizeDuration: 0.35,//The duration (in seconds) of the resizing animations. Defaults to 0.35.
			fadeDuration: 0.35, //The duration (in seconds) of the resizing animations. Defaults to 0.35.
			displayCounter: true, //Set this false to hide the gallery counter. Defaults to true.
			viewportPadding: 20, //The amount of padding (in pixels) to maintain around the edge of the browser window. Defaults to 20.
			enableKeys: true, //Set this false to disable keyboard navigation of galleries. Defaults to true.
			keysClose:     ['c', 27], // c or esc
			text:           {
				loading: 'Carregando...',   
				cancel: 'Cancelar',
				close: 'Fechar',
				next: '<b>></b>' ,
				prev: '<b><</b>'
			},
			skin: 	{		
				main:	'<div id="shadowbox_overlay"></div>' + 
						'<div id="shadowbox_container">' + 
							'<div id="shadowbox">' + 
								'<div id="shadowbox_title">' + 
									'<div id="shadowbox_title_inner"></div>' + 
								'</div>' + 
								'<div id="shadowbox_body">' + 
									'<div id="shadowbox_body_inner"></div>' + 
									'<div id="shadowbox_loading"></div>' + 
								'</div>' + 
								'<div id="shadowbox_toolbar">' + 
										'<div id="shadowbox_toolbar_inner"></div>' + 
								'</div>' + 
							'</div>' + 
						'</div>', 
				loading:    '<img src="{0}" alt="{1}" />' +
							'<span><a href="javascript:Shadowbox.close();">{2}</a></span>',
				counter: '<div id="shadowbox_counter">{0}</div>', 
				close: '<div id="shadowbox_nav_close">' + '<a href="javascript:Shadowbox.close();">{0}</a>' + '</div>', 
				next: '<div id="shadowbox_nav_next">' + '<a href="javascript:Shadowbox.next();">{0}</a>' + '</div>', 
				prev: '<div id="shadowbox_nav_previous">' + '<a href="javascript:Shadowbox.previous();">{0}</a>' + '</div>' 
		}

	};

	function criarGaleria(nomeGaleria, opcoes){

		$(document).ready(function(){
			iniciarShadowbox(nomeGaleria, opcoes)
		});
	}

	function iniciarShadowbox(nomeGaleria, opcoes){

		if(typeof opcoes == "undefined")
			opcoes = {};
		var options = {
			loadingImage:		typeof opcoes.loadingImage != "undefined" ? opcoes.loadingImage : plcGeral.contextPath+opcoesPadrao.loadingImage,
			resizeLgImages:     typeof opcoes.resizeLgImages != "undefined" ? opcoes.resizeLgImages : opcoesPadrao.resizeLgImages,
			handleLgImages:		typeof opcoes.handleLgImages != "undefined" ? opcoes.handleLgImages : opcoesPadrao.handleLgImages,
			displayNav:         typeof opcoes.displayNav != "undefined" ? opcoes.displayNav : opcoesPadrao.displayNav,
			continuous:			typeof opcoes.continuous != "undefined" ? opcoes.continuous : opcoesPadrao.continuous,
			counterType:		typeof opcoes.counterType != "undefined" ? opcoes.counterType : opcoesPadrao.counterType,
			initialHeight:		typeof opcoes.initialHeight != "undefined" ? opcoes.initialHeight : opcoesPadrao.initialHeight,
			initialWidth:		typeof opcoes.initialWidth != "undefined" ? opcoes.initialWidth : opcoesPadrao.initialWidth,
			keysClose:			typeof opcoes.keysClose != "undefined" ? opcoes.keysClose : opcoesPadrao.keysClose,
			animate:			typeof opcoes.animate != "undefined" ? opcoes.animate : opcoesPadrao.animate,
			overlayColor:		typeof opcoes.overlayColor != "undefined" ? opcoes.overlayColor : opcoesPadrao.overlayColor,
			overlayOpacity:		typeof opcoes.overlayOpacity != "undefined" ? opcoes.overlayOpacity : opcoesPadrao.overlayOpacity,
			resizeDuration:		typeof opcoes.resizeDuration != "undefined" ? opcoes.resizeDuration : opcoesPadrao.resizeDuration,
			fadeDuration:		typeof opcoes.fadeDuration != "undefined" ? opcoes.fadeDuration : opcoesPadrao.fadeDuration,
			displayCounter:		typeof opcoes.displayCounter != "undefined" ? opcoes.displayCounter : opcoesPadrao.displayCounter,
			counterType:		typeof opcoes.counterType != "undefined" ? opcoes.counterType : opcoesPadrao.counterType,
			viewportPadding:	typeof opcoes.viewportPadding != "undefined" ? opcoes.viewportPadding : opcoesPadrao.viewportPadding,
			enableKeys:			typeof opcoes.enableKeys != "undefined" ? opcoes.enableKeys : opcoesPadrao.enableKeys,
			skin:				typeof opcoes.skin != "undefined" ? opcoes.skin : opcoesPadrao.skin,
			text:           {
				cancel:     typeof opcoes.cancel != "undefined" ? opcoes.cancel : opcoesPadrao.text.cancel,
				loading:    'Carregando...',   
				close:      typeof opcoes.close != "undefined" ? opcoes.close : opcoesPadrao.text.close,
				next:       typeof opcoes.next != "undefined" ? opcoes.next : opcoesPadrao.text.next,
				prev:       typeof opcoes.prev != "undefined" ? opcoes.prev : opcoesPadrao.text.prev,
				errors:     {
					single: 'Para ver este conteúdo é necessário instalação deste plugin: <a href="{0}">{1}</a>.',
					shared: 'Para ver este conteúdo é necessário instalação destes plugins: <a href="{0}">{1}</a> e <a href="{2}">{3}</a>.',
					either: 'Para ver este conteúdo é necessário instalação de algum destes plugins: <a href="{0}">{1}</a> ou <a href="{2}">{3}</a>.'
				}
			},
			ext:     {
				img:        ['png', 'jpg', 'jpeg', 'gif', 'bmp'],
				qt:         ['dv', 'mov', 'moov', 'movie', 'mp4'],
				wmp:        ['asf', 'wm', 'wmv'],
				qtwmp:      ['avi', 'mpg', 'mpeg'],
				iframe:     ['asp', 'aspx', 'cgi', 'cfm', 'htm', 'html', 'pl', 'php',
							'php3', 'php4', 'php5', 'phtml', 'rb', 'rhtml', 'shtml',
							'txt', 'vbs', 'do']
			}
	        //onClose: "desativarPreview"
			
		};

		Shadowbox.init(options);
	}

/*****************************************************************************\
					MENU DESTAQUE (JQUERY JQMODAL E JQDNR)
\*****************************************************************************/

function criarMenuDestaque(){
	var listaTermos = getParametroUrl("termos");
	if(listaTermos){
		listaTermos = listaTermos.replaceAll("%20"," ");
		listaTermos = listaTermos.replaceAll("+"," ");
		var termos = listaTermos.split(' ');
		var linkTermos = "";
		var c = 0;
		for(var i=0; i<termos.length; i++){
			linkTermos += "<a href='#' onclick=\"destacarTermo('"+termos[i]+"', 'destaque"+getContadorDestaque()+"');   return false;\" title='Clique para destacar este termo.'><span class='bt'>"+termos[i].toLowerCase()+"</span></a>&nbsp;";
			//c = c++ > 4 ? 0 : c;
		}
		var campoBusca = "<form class=\"form\" name=\"destaqueForm\" style=\"margin-top:10px;\">Outro Termo: <input class=\"campo\" type=\"text\" name=\"novoTermo\" value=\"\"  style=\"height:20px;\"><input type=\"button\" value=\"Destacar\" onclick=\"destacarTermo(get('novoTermo','destaqueForm'), 'destaque'+getContadorDestaque()); set('novoTermo','','','destaqueForm'); return false;\" style=\"height:20px;\"></form>"
		$("#MENU_DESTAQUE").prepend("<b>Termos para destaque:</b>&nbsp;<span>"+linkTermos+"</span> [<a href='#' onclick='removerDestaqueTermo(); return false;' title='Clique pare remover todos os destaques.'>Limpar</a>]");
		$(".jqmdMSG").html("<span>"+linkTermos+"</span> [<a href='#' onclick='removerDestaqueTermo(); return false;' title='Clique pare remover todos os destaques.'>Limpar</a>]"+campoBusca);
		$("#ex3aTrigger").click(function(){
			esconderMenuDestaque();
		});
		$("#MENU_DESTAQUE_FECHAR").click(function(){
			mostraMenuDestaque();
		});
		mostraMenuDestaque()
	}
}

var contadorDestaque = 0;
function getContadorDestaque(){
	return contadorDestaque++ > 4 ? 0 : contadorDestaque;
}

function buscaDestaque(){
	var listaTermos = getParametroUrl("busca", document.location.search);
	if(listaTermos){
		listaTermos = listaTermos.replaceAll("%20"," ");
		listaTermos = listaTermos.replaceAll("+"," ");
		var termos = listaTermos.split(' ');
		for(var i=0; i<termos.length; i++){
			$('#RESULTADO_BUSCA').each(function() { $.highlight(this,termos[i].toUpperCase(), "destaqueResBusca"); }); 
		}
	}
	if(getParametroUrl("grp") == "I")
		$('#RESULTADO_BUSCA').each(function() { $.highlight(this,"Imagens", "destaqueResBusca"); }); 
}


function destacarTermo(termo, classe){
	if(typeof termo != "undefined" && termo != ""){
		$('#CONTEUDO_DESTAQUE').each(function() { $.highlight(this,termo.toUpperCase(), classe); }); 
	}else{
		alert("Informe termo para destaque.");
	}
}
function removerDestaqueTermo(){
	$('#CONTEUDO_DESTAQUE').removeHighlight();
}

function esconderMenuDestaque(){
	$("#MENU_DESTAQUE").css("display","none");
}

function mostraMenuDestaque(){
	$("#MENU_DESTAQUE").css("display","block");
}

/*****************************************************************************\
							PORTLET BUSCA
\*****************************************************************************/
var disparouBusca = false;
function buscarSlide(botao, tipo)
{
  var numForms 	= document.forms.length;
  var numCampos	= ""; 

	if(tipo != "" && ""+tipo != "undefined")
	{
		var url = document.location.pathname+document.location.search;
		//var pos = url.indexOf("&busca");
		//if(pos >= 0)
			//url = url.substring(0,pos);
		url = incluirParametroUrl(url,"busca",argumento);
		url = incluirParametroUrl(url,"dirSlide",tipo);
		url = incluirParametroUrl(url,"mtSlide",metadado);
		url += "#slide_"+tipo;
		redirect(url);
	}

  if(disparouBusca){
		disparouBusca = false;
  		return true;
  }
  
  for (var i = 0; i < numForms; i++){
    numCampos = document.forms[i].elements.length;
    for (var j = 0; j < numCampos; j++){
      if (document.forms[i].elements[j].value == botao && 
		  (document.forms[i].elements[j].id == "SUBMIT_BUSCA" || document.forms[i].elements[j].id == "SUBMIT_BUSCA_SLIDE")){
		if(!disparouBusca){
			disparaBotao(document.forms[i].elements[j]);
			return false;
		}
      }
    }
  }
  
  if(!disparouBusca){
  		return false;
  }else{
  		return true;
  }
}

var argumento = "";
function guardaArgumento(arg){
	argumento = arg;
}

var metadado = "";
function guardaMetadado(meta){
	metadado = meta;
}

function abrirAjuda(){
	var win = janela(plcGeral.contextPath+"/ecp/ajudabusca.do?evento=x",400);
}

function janelaDownload(url){
	url = url.substring(0,url.indexOf("?f="))+"?td=conf&f="+url.substring(url.indexOf("?f=")+3);
	url = url.substring(url.indexOf("dSldAt=")+7)
	win = janela(url,200,200);
}

/*****************************************************************************\
					GRID TABELA (JQUERY TABLESORTER)
\*****************************************************************************/
function criarGridTabela(seletor, opcoes, temNav, opcoesPager){

	var ops = {widthFixed: true, widgets: ['zebra']};
	var opsPager = {
				container: $(seletor+"pager"),
				positionFixed: false,
				size: 5,
				seperator: " de "
		};

	$.extend(true, ops, opcoes);
	$.extend(true, opsPager, opcoesPager);

	if(temNav || temNav == "S"){
		$(seletor)
		.tablesorter(ops)
		.tablesorterPager(opsPager);
	}else{
		$(seletor)
		.tablesorter(ops);
		$(seletor+"pager").css("display","none");
	}
}


/*****************************************************************************\
					TREE VIEW (JQUERY TREEVIEW)
\*****************************************************************************/
function criarTreeView(seletor, opcoes){


	var ops = {
		control: "#treecontrol",
		//animated: "normal",
		persist: "location"
//		cookieId: "treeview-"+seletor
//		unique: true,
//		collapsed: true
	};

	$.extend(true, ops, opcoes);

	$(seletor).treeview(ops);
}

/*****************************************************************************\
							PORTLET SLIDE
\*****************************************************************************/

function navDiretoriAnteriorSlide(dirRetorno){

	var url = document.location.href;
	url = incluirParametroUrl(url,"pAcDir",dirRetorno);
	url = removerParametroUrl(url,"busca");
	redirect(url);
}

/*****************************************************************************\
							PROCURA TERMO
\*****************************************************************************/

/*
function procurarTermo(termo){
	if(ExpYes)
		procurarTermoIE(termo);
	else
		procurarTermoFF(termo);
}

function procurarTermoIE(termo) {
   // get the selection range and text range
   //var findRange = document.selection.createRange();
   //var textRange = document.body.createTextRange();

   var findRange = ($("#CONTEUDO_DESTAQUE").get()[0]).createTextRange();
   var textRange = ($("#CONTEUDO_DESTAQUE").get()[0]).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 configuraCssPortalParaTransitional(){}
