classe_guias.js 31.7 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990
/*jslint plusplus:false,white:false,undef: false, rhino: true, onevar: true, evil: false */

/*
Title: Guias

Arquivo:

i3geo/classesjs/classe_guias.js

Licenca:

GPL2

i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet

Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil
Desenvolvedor: Edmar Moretti edmar.moretti@mma.gov.br

Este programa é software livre; você pode redistribuí-lo
e/ou modificá-lo sob os termos da Licença Pública Geral
GNU conforme publicada pela Free Software Foundation;

Este programa é distribuído na expectativa de que seja útil,
porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita
de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA.
Consulte a Licença Pública Geral do GNU para mais detalhes.
Você deve ter recebido uma cópia da Licença Pública Geral do
GNU junto com este programa; se não, escreva para a
Free Software Foundation, Inc., no endereço
59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
*/
if(typeof(i3GEO) === 'undefined'){
	i3GEO = [];
}
/*
Classe: i3GEO.guias

Cria e controla os blocos de opções ativados por meio de guias ou botões 

Para configurar as guias do mapa principal utilize i3GEO.guias.configura = ...

*/
i3GEO.guias = {
	/*
	Variavel: ATUAL

	Guia que está ativa

	O nome da guia é a definida na variável i3GEO.guias.CONFIGURA

	Tipo:
	{string}

	Default:
	{"temas"}
	*/
	ATUAL: "temas",
	/*
	Propriedade: ALTURACORPOGUIAS
	
	Altura em pixels que será aplicado em cada guia
	
	Por default, a altura é calculada automaticamente, mas em alguns casos, pode ser necessário especificar o valor para permitir um melhor ajuste do layout do mapa
	
	Mantenha como 0 para que o cálculo seja automático
	
	Tipo:
	{numeric}
	
	Default: 0
	*/
	ALTURACORPOGUIAS: 0,
	/*
	Propriedade: CONFIGURA

	Define os parâmetros de cada guia que será mostrada no mapa, como título, conteúdo, etc.

	Você pode modificar o nome de uma guia como no exemplo

	i3GEO.guias.CONFIGURA.legenda.titulo = "nome diferente";

	Por padrão são definidas as guias legenda, temas, adiciona e mapas (links)

	Exemplo

	i3GEO.guias.CONFIGURA.legenda = {
			titulo:"Legenda do mapa",
			id:"guia4",
			idconteudo:"guia4obj",//id do elemento HTML que contém o conteúdo da guia
			click: function(){
				i3GEO.guias.mostra("legenda");//mostra a guia
				i3GEO.mapa.legendaHTML.cria("guia4obj");
			}
		}

	Tipo:
	{JSON}
	*/
	CONFIGURA: {
		"temas":{
			icone:"imagens/gisicons/show-layers.png",
			titulo:$trad("g4a"),
			id:"guia1",
			idconteudo:"guia1obj",
			click:""
		},
		"adiciona":{
			icone:"imagens/gisicons/show-catalog.png",
			titulo:$trad("g1a"),
			id:"guia2",
			idconteudo:"guia2obj",
			click: function(){
				var ondeArvore;
				i3GEO.guias.mostra("adiciona");
				if(!$i("arvoreAdicionaTema"))
				{
					try{ondeArvore = objmapa.guiaMenu+"obj";}
					catch(e){ondeArvore = "guia2obj";}
				}
				else
				{ondeArvore = "arvoreAdicionaTema";}
				//para efeitos de compatibilidade
				if(document.getElementById("outrasOpcoesAdiciona")){
					i3GEO.arvoreDeTemas.OPCOESADICIONAIS.idonde = "outrasOpcoesAdiciona";
					i3GEO.arvoreDeTemas.OPCOESADICIONAIS.incluiArvore = false;
				}
				i3GEO.arvoreDeTemas.cria(i3GEO.configura.sid,i3GEO.configura.locaplic,ondeArvore);
			}
		},
		"legenda":{
			icone:"imagens/gisicons/show-legend.png",
			titulo:$trad("g3"),
			id:"guia4",
			idconteudo:"guia4obj",
			click: function(){
				i3GEO.guias.mostra("legenda");
				i3GEO.mapa.legendaHTML.cria("guia4obj");
			}
		},
		"mapas":{
			icone:"imagens/gisicons/show-links.png",
			titulo:"Links",
			id:"guia5",
			idconteudo:"guia5obj",
			click: function(){
				var pegaMapas = function(retorno){
					var ins,mapa,ig1lt,ig1,nome,lkd,link,temp;
					ins = "<br><div id='banners' style='overflow:auto;text-align:left'>";
					mapa = retorno.data.mapas;
					ig1lt = mapa.length;
					ig1=0;
					if(ig1lt > 0){
						do{
							temp = mapa[ig1];
							nome = temp.NOME;
							if(temp.PUBLICADO){
								if(temp.PUBLICADO.toLowerCase() === "nao")
								{nome = "<s>"+nome+"</s>";}
							}
							lkd = temp.LINK;
							link = i3GEO.configura.locaplic+"/ms_criamapa.php?temasa="+temp.TEMAS+"&layers="+temp.LIGADOS;
							if (temp.EXTENSAO !== "")
							{link += "&mapext="+temp.EXTENSAO;}
							if (temp.OUTROS !== "")
							{link += "&"+temp.OUTROS;}
							if (lkd !== "")
							{link = lkd;}
							ins += "<div><a href='"+link+"'><img src='"+temp.IMAGEM+"'></a></div><br>";
							ins += "<div><p style=text-align:center >"+nome+"</p></div><br>";
							ig1++;
						}
						while(ig1<ig1lt);
					}
					$i(i3GEO.guias.CONFIGURA.mapas.idconteudo).innerHTML = ins+"</div>";
				};
				$i(i3GEO.guias.CONFIGURA.mapas.idconteudo).innerHTML = "Aguarde...";
				i3GEO.guias.mostra("mapas");
				i3GEO.php.pegaMapas(pegaMapas);
			}
		}
	},
	/*
	Propriedade: ORDEM

	Ordem de inclusão das guias no mapa. Essa opção é mais útil no caso do tipo sanfona, pois nesse caso,
	a primeira guia é sempre a que fica ativa. Se esse parâmetro for uma string vazia, a ordem
	utilizada será a ordem existente em i3GEO.guias.CONFIGURA.
	
	Ao ser definida, apenas as guias indicadas no array serão incluídas

	Exemplo:

	i3GEO.guias.ORDEM = ["temas","adiciona","legenda"];

	Tipo:
	{array}

	Default:
	{""}
	*/
	ORDEM: "",
	/*
	Propriedade: TIPO

	Tipo de guia
	
	Quando TIPO = "movel", a inicialização da guia é feita em i3GEO.inicia
	Isso é ne cessário pq a guia móvel só pode ser criada após o posicionamento do corpo do mapa

	Tipo:
	{string}

	Default:
	{"guia"}

	Values:
	guia|sanfona|tablet|movel
	*/
	TIPO: "guia",
	/*
	Propriedade: idguias

	ID do elemento DOM, criado pelo YUI, onde serão inseridas as guias

	Tipo:
	{String}

	Default:
	{"guiasYUI"}
	*/
	IDGUIAS: "guiasYUI",
	/*
	Function: cria

	Cria as guias com base na variável i3GEO.guias.CONFIGURA

	As guias podem ser definidas no HTML do mapa, sem necessariamente estarem na variável configura.<b> 
	As guias, nesse caso, devem ter como ID "guia'n'", por exemplo id="guia6". Para cada uma dessas guias
	deve haver um DIV com o conteúdo. Esse DIV deve ter como ID "guia'n'obj", por exemplo id="guia6obj".
	No caso de ser utilizado a guia móvel, com i3GEO.guias.TIPO = "movel" , "guia'n" não é necessário, uma vez que são
	utilizados os ícones definidos em i3GEO.guias.CONFIGURA

	Parametro:

	onde {String} - id do elemento que conterá as guias
	*/
	cria: function(onde){
		
		if(typeof(console) !== 'undefined'){console.info("i3GEO.guias.cria()");}
		//
		//obtém outras guias que podem existir no mapa
		//
		var nguiasreal = 0,onf,outf,guiaconteudo,id,guia,guias,g,re,ng,tituloguia,i,ins,largura,altura,temp,preload,
			CONFIGURA = i3GEO.guias.CONFIGURA,
			guias = i3GEO.util.listaChaves(CONFIGURA),
			nguias = guias.length;
		//
		//no caso de TIPO === "movel", as guias não são construídas de imediato, apenas é criado um objeto
		//com os parâmetros necessários para a criação das guias
		//
		if(i3GEO.guias.TIPO === "movel"){
			i3GEO.guias.IDGUIAS = "i3GEOguiaMovelConteudo";
			for(ng=0;ng<nguias;ng++){
				if($i(i3GEO.guias.CONFIGURA[guias[ng]].idconteudo)){
					i3GEO.guias.guiaMovel.config.guias.ids.push(i3GEO.guias.CONFIGURA[guias[ng]].id);
					i3GEO.guias.guiaMovel.config.guias.idsconteudos.push(i3GEO.guias.CONFIGURA[guias[ng]].idconteudo);
					if(i3GEO.guias.CONFIGURA[guias[ng]].icone !== undefined)
					{i3GEO.guias.guiaMovel.config.guias.icones.push(i3GEO.guias.CONFIGURA[guias[ng]].icone);}
					else
					{i3GEO.guias.guiaMovel.config.guias.icones.push("imagens/gisicons/open1.png");}
					i3GEO.guias.guiaMovel.config.guias.titulos.push(i3GEO.guias.CONFIGURA[guias[ng]].titulo);
					i3GEO.guias.guiaMovel.config.guias.chaves.push(guias[ng]);
				}
			}
			return;
		}
		try{
			for(g=0;g<12;g++){
				tituloguia = "";
				if($i("guia"+g)){
					tituloguia = $i("guia"+g).innerHTML;
					re = new RegExp("&nbsp;", "g");
					tituloguia = tituloguia.replace(re,'');
					for(ng=0;ng<nguias;ng++){
						if(CONFIGURA[guias[ng]].id === "guia"+g){
							tituloguia = "";
						}
					}
					if (tituloguia !== ""){
						i3GEO.guias.CONFIGURA["guia"+g] = [];
						i3GEO.guias.CONFIGURA["guia"+g].titulo = tituloguia;
						i3GEO.guias.CONFIGURA["guia"+g].id = "guia"+g;
						i3GEO.guias.CONFIGURA["guia"+g].idconteudo = "guia"+g+"obj";
						if($i('guia'+g).onclick){
							i3GEO.guias.CONFIGURA["guia"+g].click = $i("guia"+g).onclick;
						}
					}
				}
			}
			if(i3GEO.guias.ORDEM === "")
			{guias = i3GEO.util.listaChaves(CONFIGURA);}
			else
			{guias = i3GEO.guias.ORDEM;}
			nguias = guias.length;
			//
			//verifica o div que contém as guias caso não tenha sido passado como parâmetro
			//
			if(arguments.length === 0){
				for(ng=0;ng<nguias;ng++){
					i = $i(i3GEO.guias.CONFIGURA[guias[ng]].id);
					if(i){onde = i.parentNode;}
				}
			}
			else
			{onde = $i(onde);}
			if(!onde){return;}
			onde.id = i3GEO.guias.IDGUIAS;
			onde.className = "yui-navset";
			//
			//constroi as TAGs para as guias
			//
			if(i3GEO.guias.TIPO === "guia" || i3GEO.guias.TIPO === "tablet"){
				ins = '<ul class="yui-nav" style="border-width:0pt 0pt 0px;border-color:rgb(240,240,240);border-bottom-color:white;text-align:center;">';
				for(ng=0;ng<nguias;ng++){
					if($i(i3GEO.guias.CONFIGURA[guias[ng]].id)){
						if($i(i3GEO.guias.CONFIGURA[guias[ng]].idconteudo))
						{ins += '<li><a alt="" title=""><em><div id="'+i3GEO.guias.CONFIGURA[guias[ng]].id+'" >'+i3GEO.guias.CONFIGURA[guias[ng]].titulo+'</div></em></a></li>';}
					}
				}
				//adiciona uma guia que permite esconder todas as outras guias se for do tipo tablet
				ins += "</ul>";
				onde.innerHTML = ins;
				
				onf = function(event){
					var bcg,cor;
					YAHOO.util.Event.stopEvent(event);
					bcg = this.parentNode.parentNode.style;
					cor = bcg.background.split(" ")[0];
					if(cor !== "white" && bcg.backgroundColor !== "white")
					{bcg.background = "#bfdaff";}
				};
				outf = function(event){
					var bcg,cor;
					YAHOO.util.Event.stopEvent(event);
					bcg = this.parentNode.parentNode.style;
					cor = bcg.background.split(" ")[0];
					if(cor !== "white" && bcg.backgroundColor !== "white")
					{bcg.background = "transparent";}
				};
			}
			if(i3GEO.guias.TIPO === "sanfona"){
				ins = '<dl id=sanfona'+onde.id+' class="accordion" >';
				//verifica a quantidade certa de guias
				if(i3GEO.guias.ORDEM === ""){
					for(ng=0;ng<nguias;ng++){
						if($i(i3GEO.guias.CONFIGURA[guias[ng]].id)){
							nguiasreal++;
						}
					}
				}
				else
				{nguiasreal = i3GEO.guias.ORDEM.length;}
				
				if(navn)
				{altura = i3GEO.parametros.h - (nguiasreal * 25) - 1;}
				else
				{altura = i3GEO.parametros.h - (nguiasreal * 23) + 1;}
				for(ng=0;ng<nguias;ng++){
					if($i(i3GEO.guias.CONFIGURA[guias[ng]].id)){
						id = i3GEO.guias.CONFIGURA[guias[ng]].idconteudo;
						temp = $i(id);
						if(temp){
							guiaconteudo = temp.innerHTML;
							temp.innerHTML = "";
							temp.style.display = "none";
							temp.id = "";
							ins += '<dt style=height:17px id="'+i3GEO.guias.CONFIGURA[guias[ng]].id+'" >' +
								'<table class=accordiontable ><tr><td width="98%" >'+i3GEO.guias.CONFIGURA[guias[ng]].titulo+'</td><td width="2%" ><img id="" src="'+i3GEO.configura.locaplic+'/imagens/branco.gif" style="width:10px;" /></td></tr></table>' +
								'<dd clas=close >' +
								'<div class=bd >' +
								'<div id="'+id+'" >'+guiaconteudo+'</div></div></dd>';
						}
					}
				}
				ins += "</dl>";
				onde.innerHTML = ins;
				onde.style.height = altura+"px";
				onf = function(){};
				outf = function(){};
				YAHOO.lutsr.accordion.init(true,5,false,"sanfona"+onde.id,altura);
				i3GEO.guias.ALTURACORPOGUIAS = altura;
			}
			for(g=0;g<nguias;g++)
			{
				guia = i3GEO.guias.CONFIGURA[guias[g]];
				id = guia.id;
				guiaconteudo = $i(id);
				if(guiaconteudo){
					if(guia.click === "" || guia.click === undefined)
					{eval('$i("'+id+'").onclick = function(event){i3GEO.guias.mostra("'+guias[g]+'");}');}
					else
					{guiaconteudo.onclick = guia.click;}
					YAHOO.util.Event.addListener($i(id), "click", YAHOO.util.Event.preventDefault);
					YAHOO.util.Event.addListener($i(id), "click", YAHOO.util.Event.stopPropagation);
					YAHOO.util.Event.addFocusListener($i(id), YAHOO.util.Event.preventDefault);
					guiaconteudo.onmouseover = onf;
					guiaconteudo.onmouseout = outf;
					temp = $i(guia.idconteudo);
					if(temp){
						temp.style.overflow="auto";
						if(i3GEO.guias.TIPO === "guia"){
							if(i3GEO.guias.ALTURACORPOGUIAS === 0)
							{temp.style.height = i3GEO.parametros.h + "px";}
							else
							{temp.style.height = i3GEO.guias.ALTURACORPOGUIAS + "px";}
						}
						else
						{temp.style.height = onde.style.height;}
					}
				}
			}
		}
		catch(e){
			if(typeof(console) !== 'undefined'){console.error(e);}
		}
		if(i3GEO.guias.TIPO !== "tablet"){
			i3GEO.guias.mostra(i3GEO.guias.ATUAL);
			i3GEO.guias.ativa(i3GEO.guias.ATUAL);
		}
		else
		{i3GEO.guias.escondeGuias();}
	},
	/*
	Function: ajustaAltura

	Ajusta a altura das guias conforme a altura da imagem do mapa
	*/
	ajustaAltura: function(){
		if(typeof(console) !== 'undefined'){console.info("i3GEO.guias.ajustaAltura()");}
		var guia,guias,nguias,temp,temps,n,i,
			altura=0;
		if(i3GEO.guias.ALTURACORPOGUIAS != 0)
		{altura = i3GEO.guias.ALTURACORPOGUIAS;}
		guias = i3GEO.util.listaChaves(i3GEO.guias.CONFIGURA);
		nguias = guias.length;
		for(g=0;g<nguias;g++){
			guia = $i(this.CONFIGURA[guias[g]].idconteudo);
			if(guia){
				guia.style.overflow="auto";
				if(this.TIPO === "guia")
				{guia.style.height = altura + "px";}
				if(this.TIPO === "sanfona"){
					guia.style.height = altura + "px";
					temp = $i("guiasYUI");
					if(temp){
						temp.style.height = altura + "px";
						temps = temp.getElementsByTagName("dd");
						n = temps.length;
						for(i=0;i<n;i++){
							if(temps[i].style.visibility == "visible")
							{temps[i].style.height = altura + "px";}
						}
					}
					YAHOO.lutsr.accordion.properties.altura = altura;
				}
			}
		}
	},
	/*
	Function: escondeGuias
	
	Esconde todas as guias
	*/
	escondeGuias: function(){
		var guias,nguias,g,temp,attributes,anim;
		guias = i3GEO.util.listaChaves(i3GEO.guias.CONFIGURA);
		nguias = guias.length;
		for(g=0;g<nguias;g++){
			temp = $i(this.CONFIGURA[guias[g]].idconteudo);
			if(temp){
				if(i3GEO.guias.TIPO === "tablet" && temp.style.display === "block"){
					temp.style.overflow = "hidden";
					attributes = {
						height: { to: 0 },
						id: this.CONFIGURA[guias[g]].idconteudo
					};
					anim = new YAHOO.util.Anim(temp, attributes, 1, YAHOO.util.Easing.easeNone);				
					anim.onComplete.subscribe(function(){
						var temp = $i(anim.attributes.id);
						temp.style.overflow = "auto";
						temp.style.display="none";
						if(i3GEO.barraDeBotoes.BARRAS[0])
						{i3GEO.barraDeBotoes.BARRAS[0].show();}
					});
					anim.animate();				
				}
				else
				{temp.style.display="none";}
			}
			if($i(this.CONFIGURA[guias[g]].id) && i3GEO.guias.TIPO !== "movel")
			{$i(this.CONFIGURA[guias[g]].id).parentNode.parentNode.style.background="transparent";}
		}	
	},
	/*
	Function: mostra

	Mostra no mapa uma determinada guia

	Parametro:

	guia {String} - nome da guia
	*/
	mostra: function(guia){
		if(typeof(console) !== 'undefined'){console.info("i3GEO.guias.mostra()");}
		var guias,nguias,g,temp,temp1,attributes,anim;
		guias = i3GEO.util.listaChaves(i3GEO.guias.CONFIGURA);
		nguias = guias.length;
		//
		//se a guia clicada já estiver aberta na interface com TABLET
		//
		if($i(i3GEO.guias.CONFIGURA[guia].idconteudo).style.display === "block" && i3GEO.guias.TIPO === "tablet"){
			i3GEO.guias.escondeGuias();
			return;
		}
		if(i3GEO.guias.TIPO !== "movel"){
			for(g=0;g<nguias;g++){
				if($i(i3GEO.guias.CONFIGURA[guias[g]].idconteudo))
				{$i(i3GEO.guias.CONFIGURA[guias[g]].idconteudo).style.display="none";}
				if($i(i3GEO.guias.CONFIGURA[guias[g]].id))
				{$i(i3GEO.guias.CONFIGURA[guias[g]].id).parentNode.parentNode.style.background="transparent";}
			}
		}
		//
		//verifica se o nome da guia passado como parametro está correto ou é o id da guia
		//
		if(i3GEO.guias.CONFIGURA.toString().search(guia) < 0){
			for(g=0;g<nguias;g++){
				if(i3GEO.guias.CONFIGURA[guias[g]].id === guia)
				{guia = guias[g];}
			}
		}
		if(i3GEO.guias.CONFIGURA[guia]){
			temp = $i(i3GEO.guias.CONFIGURA[guia].idconteudo);
			if(temp){
				if(i3GEO.guias.TIPO === "tablet"){
					if(i3GEO.barraDeBotoes.BARRAS[0])
					{i3GEO.barraDeBotoes.BARRAS[0].hide();}
					temp.style.left = (i3GEO.parametros.w / 2) - 150 + "px";
					temp.style.height = 0;//i3GEO.parametros.h - 10 + "px";
					temp.style.display = "block";
					temp.style.zIndex = 9000;
					temp.style.overflow = "hidden";
					attributes = {
						height: { to: i3GEO.parametros.h - 10 }
					};
					anim = new YAHOO.util.Anim(temp, attributes, 1, YAHOO.util.Easing.easeNone);				
					anim.onComplete.subscribe(function(){
						temp.style.overflow = "auto";
						temp.style.display = "block";
					});
					if(DetectaMobile("DetectAndroid") === true){
						temp.style.height = "";
						temp.style.overflow = "auto";
					}					
					else
					{anim.animate();}
				}
				else
				{temp.style.display="block";}
				if(i3GEO.guias.TIPO !== "movel")
				{$i(i3GEO.guias.CONFIGURA[guia].id).parentNode.parentNode.style.backgroundColor="white";}
				i3GEO.guias.ATUAL = guia;
			}
		}
	},
	/*
	Function: ativa

	Ativa uma determinada guia

	Parametro:

	guia {String} - guia que será ativada
	*/
	ativa: function(guia){
		if(typeof(console) !== 'undefined'){console.info("i3GEO.guias.ativa()");}
		try{
			i3GEO.guias.ATUAL = guia;
			if(i3GEO.guias.CONFIGURA[i3GEO.guias.ATUAL].click !== "")
			{i3GEO.guias.CONFIGURA[i3GEO.guias.ATUAL].click.call();}
		}
		catch(e){
			if(typeof(console) !== 'undefined'){console.error(e);}
		}
	},
	/*
	Function: libera

	Libera as guias do local atual, colocando-as em uma janela flutuante sobre o mapa.
	*/
	libera: function(){
		if(typeof(console) !== 'undefined'){console.info("i3GEO.guias.libera()");}
		if (!$i("conteudojanelaguias")){
			var i,w,pos,a,l,letras,temp;
			$i(i3GEO.Interface.IDCORPO).style.left = "0px";
			if($i(this.IDGUIAS))
			{$i(this.IDGUIAS).style.display="none";}
			i = $i("contemFerramentas");
			//if(i)
			//{i.style.display = "none";}
			w = parseInt($i("contemFerramentas").style.width,10);
			$i("contemFerramentas").style.width = "0px";
			i = $i("visual");
			if (i)
			{i.style.width="0px";i.innerHTML="";}
			pos = "px";
			a = i3GEO.parametros.h;
			l = i3GEO.parametros.w + w;
			i3GEO.parametros.h = a;
			i3GEO.parametros.w = l;
			//if (navm)
			//{pos = "";}
			i = $i(i3GEO.Interface.IDCORPO);
			if(i){
				i.style.width= l+pos;
				i.style.height= a+pos;
			}
			i = $i(i3GEO.Interface.IDMAPA);
			if(i){
				i.style.width= l+pos;
				i.style.height= a+pos;
				i.style.clip = 'rect('+0+" "+(l*1+2)+" "+(a*1+2)+" "+0+')';
			}
			i = $i("mst");
			if(i)
			{i.style.width = l + 1 + pos;}

			if (i3GEO.configura.entorno.toLowerCase() === "sim"){
				letras=["L","O"];
				for (l=0;l<2; l++){
					if ($i("img"+letras[l])){
						$i("img"+letras[l]).style.width = i3GEO.parametros.w+pos;
						$i("img"+letras[l]).style.height = i3GEO.parametros.h+pos;
						$i("corpoMapa"+letras[l]).style.width=i3GEO.parametros.w+pos;
						$i("corpoMapa"+letras[l]).style.height=i3GEO.parametros.h+pos+pos;
						$i("corpoMapa"+letras[l]).style.clip = 'rect(0 0 0 0)';
					}
				}
				letras=["N","S"];
				for (l=0;l<2; l++){
					if ($i("img"+letras[l])){
						$i("img"+letras[l]).style.width = i3GEO.parametros.w * 2+pos;
						$i("img"+letras[l]).style.height = i3GEO.parametros.h * 2+pos;
						$i("corpoMapa"+letras[l]).style.width=i3GEO.parametros.w * 3+pos;
						$i("corpoMapa"+letras[l]).style.height=i3GEO.parametros.h+pos;
						$i("corpoMapa"+letras[l]).style.clip = 'rect(0 0 0 0)';
					}
				}
			}
			i3GEO.mapa.ajustaPosicao();
			temp = function(retorno){
				//carrega janela
				var novoel,temp,i,g,guias,nguias;
				novoel = document.createElement("div");
				novoel.id = "janelaguias";
				novoel.style.display="block";
				novoel.innerHTML = '<div class="hd">Guias <div onclick ="i3GEO.janela.minimiza(\'conteudojanelaguias\')" id="janelaguias_minimizaCabecalho" class="container-minimiza" ></div></div><div class="bd" id="conteudojanelaguias_corpo" style=padding:0px ></div>';
				temp = $i("i3geo") ? $i("i3geo").appendChild(novoel) : document.body.appendChild(novoel);
				YAHOO.namespace("janelaguias.xp");
				YAHOO.janelaguias.xp.panel = new YAHOO.widget.Panel("janelaguias", {width:"270px", fixedcenter: true, constraintoviewport: false, underlay:"none", close:false, visible:true, draggable:true, modal:false,iframe:true } );
				YAHOO.janelaguias.xp.panel.render();
				YAHOO.janelaguias.xp.panel.cfg.setProperty("y", 0);
				YAHOO.janelaDoca.xp.manager.register(YAHOO.janelaDoca.xp.panel);
				i = $i(i3GEO.guias.IDGUIAS);
				$i("conteudojanelaguias_corpo").appendChild(i);
				i.style.borderLeft="1px solid black";
				i.style.borderRight="1px solid black";
				guias = i3GEO.util.listaChaves(i3GEO.guias.CONFIGURA);
				nguias = guias.length;
				for(g=0;g<nguias;g++){
					if($i(i3GEO.guias.CONFIGURA[guias[g]].idconteudo)){
						$i("conteudojanelaguias_corpo").appendChild($i(i3GEO.guias.CONFIGURA[guias[g]].idconteudo));
						temp = $i(i3GEO.guias.CONFIGURA[guias[g]].idconteudo).style;
						temp.background="white";
						temp.border="1px solid black";
						temp.borderTop="0px solid black";
						temp.width="270px";
						temp.left="-1px";
						temp.height = i3GEO.parametros.h - 90 + "px";
					}
				}
				i3GEO.atualiza("");
				i.style.display="block";
				i.style.left = "-1px";
				i.style.width = "270px";
			};
			i3GEO.janela.abreAguarde("i3GEO.atualiza",$trad("o1"));
			i3GEO.php.mudatamanho(temp,a,l);
		}
		else{
			YAHOO.janelaguias.xp.panel.render();
			YAHOO.janelaguias.xp.panel.show();
		}
	},
	/*
	Function: mostraGuiaFerramenta

	Mostra uma determinada guia em uma janela do tipo ferramenta.

	As guias são construídas pelo construtor da ferramenta

	Parametros:

	guia {String} - O elemento html cujo id for igual a guia+"obj" terá seu estilo (display) definido como block, tornando-o visível

	namespace {String} - Todos os elementos html que tiverem como id o namespace, seguindo por um número e "obj", terão seu estilo alterado para none, tornando-se invisíveis

	*/
	mostraGuiaFerramenta: function(guia,namespace){
		if(typeof(console) !== 'undefined'){console.info("i3GEO.guias.mostraGuiaFerramenta()");}
		var g, Dom = YAHOO.util.Dom;
		if(!namespace)
		{namespace = "guia";}
		for(g=0;g<12;g++){
			Dom.setStyle(namespace+g+"obj","display","none");
		}
		Dom.setStyle(guia+"obj","display","block");
	},
	/*
	Function: guiaMovel
	
	Controla as guias do tipo "movel", que apresenta uma janela retrátil onde as opções são mostradas
	*/
	guiaMovel: {
		/*
		Propriedade: ABERTA
		
		Indica se a guia inicializará aberta
		
		Type:
		{boolean}
		*/
		ABERTA: false,
		/*
		Propriedade: config
		
		Define os valores de posicionamento dos elementos que compõem a guia
		*/
		config: {
			larguraPuxador: 50,
			alturaPuxador: 319,
			alturaGuiaMovel: 0,
			larguraGuiaMovel: 320,
			topGuiaMovel:0,
			guias: {
				icones: [],
				ids: [],
				idsconteudos: [],
				titulos: [],
				chaves: []
			}
		},
		/*
		Variavel: left
		
		Valor de posicionamento à esquerda, calculado na inicialização
		*/
		left: 0,
		/*
		Function: inicia
		
		Inicializa a guia móvel
		*/
		inicia: function(){
			var posMapa = i3GEO.util.pegaPosicaoObjeto($i(i3GEO.Interface.IDMAPA)),
				centroY = posMapa[1] + (i3GEO.parametros.h / 2),
				config = i3GEO.guias.guiaMovel.config,
				ins = "",
				temp;
			
			if(i3GEO.guias.ALTURACORPOGUIAS === 0 && config.alturaGuiaMovel === 0)
			{i3GEO.guias.guiaMovel.config.alturaGuiaMovel = i3GEO.parametros.h;}
			else
			{i3GEO.guias.guiaMovel.config.alturaGuiaMovel = i3GEO.guias.ALTURACORPOGUIAS;}
			config = i3GEO.guias.guiaMovel.config;
			
			temp = $i("i3GEOguiaMovel").style;
			//temp.height = config.alturaGuiaMovel + "px";
			temp.left = (posMapa[0] + i3GEO.parametros.w - config.larguraPuxador) + "px";
			//aberta temp.left = (posMapa[0] + i3GEO.parametros.w - config.larguraPuxador - config.larguraGuiaMovel) + "px";
			i3GEO.guias.guiaMovel.left = parseInt(temp.left,10) + "px";
			if(config.topGuiaMovel === 0)
			{temp.top = (centroY - ((config.alturaGuiaMovel - 42) / 2)) + "px";}
			else
			{temp.top = config.topGuiaMovel + "px";}
			temp.width = config.larguraPuxador + "px";
			//aberta temp.width = config.larguraPuxador + config.larguraGuiaMovel + "px";

			temp = $i("i3GEOguiaMovelMolde").style;
			temp.top = "0px";
			temp.left = config.larguraPuxador + "px";
			temp.width = "0px"; //config.larguraGuiaMovel + "px";
			temp.height = config.alturaGuiaMovel + "px";
			temp.backgroundColor = "white";
			
			temp = $i("i3GEOguiaMovelPuxador").style;
			temp.top = ((config.alturaGuiaMovel  - config.alturaPuxador) / 2 ) + "px";
			temp.left = "0px";
			temp.width = config.larguraPuxador + "px";
			temp.height = config.alturaPuxador + "px";
			
			temp = $i("i3GEOguiaMovelIcones").style;
			temp.left = "1px";
			temp.top = "1px";
			temp.width = (config.larguraGuiaMovel - 1) + "px";
			temp.height = "35px";
			
			if(navm)
			{temp.height = "37px";}
			temp.zIndex = 5;
			temp.paddingTop = "2px";
			temp = $i("i3GEOguiaMovelConteudo").style;
			temp.left = "1px";
			temp.top = "38px";
			temp.height = (config.alturaGuiaMovel - 39) +"px";
			if(navm)
			{temp.width = (config.larguraGuiaMovel - 1) + "px";}
			else
			{temp.width = (config.larguraGuiaMovel - 5) + "px";}
			temp.paddingLeft = "4px";
			YAHOO.util.Dom.setStyle("i3GEOguiaMovelConteudo", "opacity", 0.90);
			YAHOO.util.Dom.setStyle("i3GEOguiaMovelIcones", "opacity", 0.90);
			YAHOO.util.Dom.setStyle("i3GEOguiaMovelMolde", "opacity", 0.10);
			$i("i3GEOguiaMovelMolde").onmouseover = function(){
				if($i("i3GEOguiaMovelConteudo").style.display === "block")
				{YAHOO.util.Dom.setStyle("i3GEOguiaMovelMolde", "opacity", 0.9);}
				if($i("i3GEOguiaMovelIcones").innerHTML === "")
				{i3GEO.guias.guiaMovel.mostraIcones();}
			};
			$i("i3GEOguiaMovelMolde").onmouseout = function(){
				YAHOO.util.Dom.setStyle("i3GEOguiaMovelMolde", "opacity", 0.20);
				if($i("i3GEOguiaMovelIcones").innerHTML === "")
				{i3GEO.guias.guiaMovel.mostraIcones();}				
			};
			i3GEO.guias.guiaMovel.ativa(i3GEO.guias.ATUAL);
			if(i3GEO.guias.guiaMovel.ABERTA === true)
			{i3GEO.guias.guiaMovel.abreFecha();}
		},
		/*
		Function: mostraIcones
		
		Mostra os ícones que acionam cada guia
		*/
		mostraIcones: function(){
			if($i("i3GEOguiaMovelIcones").innerHTML != "")
			{return;}
			var n = i3GEO.guias.guiaMovel.config.guias.icones.length,
				i,
				temp = i3GEO.guias.guiaMovel.config.guias,
				ins = "";
			if(i3GEO.guias.ORDEM !== "")
			{temp.chaves = i3GEO.guias.ORDEM;}
			for(i=0;i<n;i++){
				if(temp.chaves[i])
				{ins += "<button title='"+temp.titulos[i]+"' onmouseout='javascript:this.className = \"iconeGuiaMovel iconeGuiaMovelMouseOut\"' onmouseover='javascript:this.className = \"iconeGuiaMovel iconeGuiaMovelMouseOver\"' onclick='i3GEO.guias.guiaMovel.ativa(\""+temp.chaves[i]+"\")' class=iconeGuiaMovel ><img id='"+temp.ids[i]+"' src='"+i3GEO.configura.locaplic+"/"+temp.icones[i]+"' style='cursor:pointer;;' /></button>";}
			}
			$i("i3GEOguiaMovelIcones").innerHTML = ins;
			i3GEO.guias.guiaMovel.desativaIcones();
			if($i(i3GEO.guias.CONFIGURA[i3GEO.guias.ATUAL].id)){
				$i(i3GEO.guias.CONFIGURA[i3GEO.guias.ATUAL].id).parentNode.style.backgroundColor = "#cedff2";
				$i(i3GEO.guias.CONFIGURA[i3GEO.guias.ATUAL].id).parentNode.style.boxShadow = "none";
			}			
		},
		/*
		Function: desativaIcones
		
		Altera a cor do fundo dos ícones, voltando ao original
		*/
		desativaIcones:function(){
			var ims = $i("i3GEOguiaMovelIcones").getElementsByTagName("button"),
				n = ims.length,
				i;
			for(i=0;i<n;i++){
				ims[i].style.backgroundColor = "white";
				ims[i].style.boxShadow = "";
			}		
		},
		/*
		Function: ativa
		
		Ativa o conteúdo de determinada guia
		
		Parametro:
		
		chave {string} - código da guia, definido em i3GEO.guias.CONFIGURA
		*/
		ativa: function(chave){
			if(i3GEO.guias.CONFIGURA[chave].click)
			{i3GEO.guias.CONFIGURA[chave].click.call();}
			i3GEO.guias.escondeGuias();
			i3GEO.guias.mostra(chave);
			i3GEO.guias.ATUAL = chave;
			i3GEO.guias.guiaMovel.desativaIcones();
			if($i(i3GEO.guias.CONFIGURA[chave].id)){
				$i(i3GEO.guias.CONFIGURA[chave].id).parentNode.style.backgroundColor = "#cedff2";
				$i(i3GEO.guias.CONFIGURA[chave].id).parentNode.style.boxShadow = "none";
			}
		},
		/*
		Function: reposiciona
		
		Reposiciona a guia móvel quando o mapa muda de tamanho
		*/
		reposiciona: function(){
			var temp = $i("i3GEOguiaMovel").style.top;
			//i3GEO.guias.guiaMovel.config.guias.icones = [];
			//i3GEO.guias.guiaMovel.config.guias.ids = [];
			//i3GEO.guias.guiaMovel.config.guias.idsconteudos = [];
			//i3GEO.guias.guiaMovel.config.guias.titulos = [];
			//i3GEO.guias.guiaMovel.config.guias.chaves = [];
			i3GEO.guias.guiaMovel.config.alturaGuiaMovel = 0;
			i3GEO.guias.ALTURACORPOGUIAS = 0;
			$i("i3GEOguiaMovelIcones").style.display = "none";
			$i("i3GEOguiaMovelConteudo").style.display = "none";
			$i("i3GEOguiaMovelMolde").style.display = "none";			
			i3GEO.guias.escondeGuias();
			i3GEO.guias.guiaMovel.inicia();
			$i("i3GEOguiaMovel").style.top = temp;
		},
		/*
		Function: abreFecha
		
		Abre ou fecha a guia móvel
		*/
		abreFecha: function(){
			var conteudo = $i("i3GEOguiaMovelConteudo"),
				molde = $i("i3GEOguiaMovelMolde"),
				guia = $i("i3GEOguiaMovel"),
				attributes,
				anim,
				anim1;
			if(molde.style.display === "block"){//esconde
				$i("i3GEOguiaMovelIcones").style.display = "none";
				$i("i3GEOguiaMovelConteudo").style.display = "none";
				attributes = {
					left: { to: parseInt(i3GEO.guias.guiaMovel.left,10) },
					id: "i3GEOguiaMovel"
				};
				anim = new YAHOO.util.Anim(guia, attributes, 1, YAHOO.util.Easing.easeNone);
				attributes = {
					width: { to: 0 },
					id: "i3GEOguiaMovelMolde"
				};
				anim1 = new YAHOO.util.Anim(molde, attributes, 1, YAHOO.util.Easing.easeNone);					
				anim.duration = 0.5;
				anim1.duration = 0.5;
				anim.animate();
				anim1.animate();
				anim1.onComplete.subscribe(function(){
					molde.style.display = "none";
				});				
			}
			else{
				//conteudo.style.display = "block";
				molde.style.display	= "block";		
				attributes = {
					left: { to: parseInt(guia.style.left,10) - i3GEO.guias.guiaMovel.config.larguraGuiaMovel },
					id: "i3GEOguiaMovel"
				};
				anim = new YAHOO.util.Anim(guia, attributes, 1, YAHOO.util.Easing.easeNone);
				
				attributes = {
					width: { to: i3GEO.guias.guiaMovel.config.larguraGuiaMovel },
					id: "i3GEOguiaMovelMolde"
				};
				anim1 = new YAHOO.util.Anim(molde, attributes, 1, YAHOO.util.Easing.easeNone);					
				anim.duration = 0.5;
				anim1.duration = 0.5;
				anim1.onComplete.subscribe(function(){
					$i("i3GEOguiaMovelIcones").style.display = "block";
					$i("i3GEOguiaMovelConteudo").style.display = "block";
					i3GEO.guias.guiaMovel.mostraIcones();
					YAHOO.util.Dom.setStyle("i3GEOguiaMovelMolde", "opacity", 0.9);
				});
				anim.animate();
				anim1.animate();
			}
		}
	}
};