classe_janela.js 34.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 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117
/*
Title: Janelas

i3GEO.janela

Abre janelas flutuantes

As janelas são criadas por meio da biblioteca YUI

Arquivo:

i3geo/classesjs/classe_janela.js

Licença:

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@gmail.com

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 ADEQUACÃ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'){
	var i3GEO = {};
}
/*
Namespace da biblioteca YUI utilizado para armazenar janelas flutuantes

Type:
{YAHOO.namespace}
*/
YAHOO.namespace("i3GEO.janela");
/*
Gerenciador das janelas flutuantes da biblioteca YUI

Type:
{YAHOO.widget.OverlayManager}
*/
YAHOO.i3GEO.janela.manager = new YAHOO.widget.OverlayManager();
//para efeitos de compatibilidade com a versão 4.6
YAHOO.namespace("janelaDoca.xp");
YAHOO.janelaDoca.xp.manager = new YAHOO.widget.OverlayManager();
/*
Gerenciador das janelas de aguarde da biblioteca YUI

Type:
{YAHOO.widget.OverlayManager}
*/
YAHOO.i3GEO.janela.managerAguarde = new YAHOO.widget.OverlayManager();
i3GEO.janela = {
	/*
	Propriedade: ESTILOABD

	Estilo que será aplicado ao elemento body da janela (class='bd')

	Tipo:
	{String}

	Default:
	{display:block;padding:5px 0px 5px 2px}
	*/
	ESTILOBD: "display:block;padding:5px 3px 5px 3px;",
	/*
	Propriedade: ESTILOAGUARDE

	Estilo da janela de aguarde

	Pode ser normal|reduzida|minima

	Tipo:
	{String}

	Default:
	{normal}
	*/
	ESTILOAGUARDE: "normal",
	/*
	Propriedade: AGUARDEMODAL

	Indica se a janela de aguarde será do tipo MODAL, ou seja, se irá ou não bloquear as opções do mapa.

	Tipo:
	{Boolean}

	Default:
	{false}
	*/
	AGUARDEMODAL: false,
	/*
	Lista com os nomes das funções que serão executadas antes de abrir a janela.

	Este é um array que pode ser modificado utilizando-se as funções javascript de
	manipulação de arrays.

	Tipo:
	{Array}

	Default:
	{"i3GEO.janela.prepara()"}
	*/
	ANTESCRIA: ["i3GEO.janela.prepara()"],
	/*
	Lista com os nomes das funções que serão executadas antes de fechar a janela.

	Este é um array que pode ser modificado utilizando-se as funções javascript de
	manipulação de arrays.

	Tipo:
	{Array}

	Default:
	{[]}
	*/
	ANTESFECHA: [],
	/*
	Propriedade: TRANSICAOSUAVE

	Altera a transparência das janelas quando o mouse sobrepõe e quando sai (não é ativado no navegador IE)

	Tipo:
	{boolean}

	Default:
	{true}
	*/
	TRANSICAOSUAVE: true,
	/*
	Propriedade: OPACIDADE

	Valor da opacidade miníma utilizada quando TRANSICAOSUAVE for igual a true.

	Varia de 0 a 100

	Tipo:
	{numeric}

	Default:
	{65}
	*/
	OPACIDADE: 65,
	/*
	Propriedade: OPACIDADEAGUARDE

	Valor da opacidade da janela de aguarde.

	Varia de 0 a 100

	Tipo:
	{numeric}

	Default:
	{50}
	*/
	OPACIDADEAGUARDE: 50,
	/*
	Lista os tips inseridos no mapa, possibilitando sua remoção em lote
	*/
	TIPS: [],
	/*
	Cada vez que uma janela flutuante é criada, esse valor é acrescido de 1
	*/
	ULTIMOZINDEX : 5,
	/*
	Executa funções default antes de abrir a janela
	*/
	prepara: function(){
		if(typeof(console) !== 'undefined'){console.info("i3GEO.janela.prepara()");}
		//
		//esconde o box de zoom e outros objetos temporários se estiverem visíveis
		//
		var iu = i3GEO.util;
		iu.escondePin();
		iu.escondeBox();
	},
	/*
	Function: cria

	Cria uma janela flutuante.

	Vc pode obter o elemento HTML interno da janela por meio de:

	{retorno}[2].innerHTML

	Vc pode recuperar uma janela com o comando YAHOO.i3GEO.janela.manager.find(id);

	Parametros:

	wlargura {integer} - largura da janela em pixels

	waltura {integer} - altura da janela em pixels

	wsrc {String} - URL que será incluída no SRC do iframe interno da janela. Se for "", o iframe não será criado

	nx {Integer} - posição x da janela em pixels. Se for "" será fixada no centro

	ny {Integer} - posição y da janela em pixels. Se for "" será fixada no centro

	texto {String} - texto do cabeçalho

	id {String} - (opcional) nome que será dado ao id que conterá a janela. Se não for definido, será usado o id="wdoca". O
		id do iframe interno é sempre igual ao id + a letra i. Por default, será "wdocai".
		O id do cabçalho será igual a id+"_cabecalho" e o id do corpo será id+"_corpo".
		O id também é utilizado na função de fechamento da janela. Quando for usada a técnica de
		script tag, ao fechar a janela a função de mesmo nome do id será definida como "null".

	modal {Boolean} - (opcional) indica se a janela bloqueará as inferiores ou não. Por default é false

	classe {String} - (opcional) classe CSS que será aplicada à barra de menu. Por default o valor é hd2. Na interface Google Earth, esse valor é sempre alterado para "hd".

	funcaoCabecalho {function} - (opcional) funcao que será executada quando o usuário clicar no cabecalho

	funcaoMinimiza {function} - (opcional) funcao que será executada para minimizar a janela

	Return:

	{Array} Array contendo: objeto YAHOO.panel criado,elemento HTML com o cabecalho, elemento HTML com o corpo
	*/
	cria: function(wlargura,waltura,wsrc,nx,ny,texto,id,modal,classe,funcaoCabecalho,funcaoMinimiza){
		if(typeof(console) !== 'undefined'){console.info("i3GEO.janela.cria()");}
		if($i(id)){
			janela = YAHOO.i3GEO.janela.manager.find(id);
			janela.show();
			janela.bringToTop();
			return;
		}
		var i,wlargurA,ins,novoel,wdocaiframe,temp,fix,underlay,ifr,janela;
		if(navm && !chro)
		{this.TRANSICAOSUAVE = false;}
		//executa as funções default de antes de qualquer criação de janela
		if(this.ANTESCRIA){
			for(i=0;i<this.ANTESCRIA.length;i++)
			{eval(this.ANTESCRIA[i]);}
		}
		//define os parâmetros default
		if(!classe || classe == "")
		{classe = "hd";}
		if(!id || id === "")
		{id = "wdoca";}
		if(!modal || modal === "")
		{modal = false;}
		ifr = false;
		if(i3GEO.Interface && i3GEO.Interface.ATUAL === "googleearth"){
			i3GEO.janela.TRANSICAOSUAVE = false;
			ifr = true;
		}
		fix = "contained";
		if(nx === "" || nx === "center")
		{fix = true;}
		//no IE, com CSS3, a sombra n&atilde;o funciona
		if(modal === true)
		{underlay = "none";}
		else
		{underlay = "shadow";}
		//cria as marca&ccedil;&otilde;es html para a janela
		temp = navm ? 0:2;
		wlargurA = parseInt(wlargura,10)+temp+"px";
		ins = '<div id="'+id+'_cabecalho" class="'+classe+'" style="background-color:white;">';
		if(i3GEO.configura !== undefined)
		{ins += "<img id='"+id+"_imagemCabecalho' style='z-index:2;position:absolute;left:3px;top:2px;visibility:hidden;' src=\'"+i3GEO.configura.locaplic+"/imagens/aguarde.gif\' />";}
		ins += "<span style='font-size:10px;'>"+texto+"</span>";
		if(funcaoMinimiza)
		{ins += "<div id='"+id+"_minimizaCabecalho' class='container-minimiza'></div>";}
		ins += '</div><div id="'+id+'_corpo" class="bd" style="'+this.ESTILOBD+'">';
		if(wsrc !== "")
		{ins += '<iframe name="'+id+'i" id="'+id+'i" valign="top" style="border:0px white solid"></iframe>';}
		ins += '</div>';
		novoel = document.createElement("div");
		novoel.id = id;
		novoel.style.display="block";
		novoel.innerHTML = ins;
		if(this.TRANSICAOSUAVE ){
			novoel.onmouseover = function(){
				YAHOO.util.Dom.setStyle(novoel,"opacity",1);
			};
			novoel.onmouseout = function(){
				YAHOO.util.Dom.setStyle(novoel,"opacity",i3GEO.janela.OPACIDADE / 100);
			};
			YAHOO.util.Dom.setStyle(novoel,"opacity",1);
		}
		document.body.appendChild(novoel);
		wdocaiframe = $i(id+"i");
		if(wdocaiframe){
			temp = wdocaiframe.style;
			temp.width = parseInt(wlargura,10)-12 + "px";
			temp.height = waltura;
			temp.display = "block";
			wdocaiframe.src = wsrc;
		}
		else{
			if(waltura !== "auto")
			{$i(id+'_corpo').style.height=parseInt(waltura,10)+"px";}
			$i(id+'_corpo').style.width=parseInt(wlargura,10)+"px";
		}
		//cria a janela
		if(waltura === "auto")
		{janela = new YAHOO.widget.Panel(id, { iframe:ifr,modal:modal, width: wlargurA,underlay:"none", fixedcenter: fix, constraintoviewport: true, visible: true,monitorresize:false,dragOnly:true,keylisteners:null} );}
		else{janela = new YAHOO.widget.ResizePanel(id, { hideMode:'offsets',iframe:ifr,underlay:underlay, modal:modal, width: wlargurA, fixedcenter: fix, constraintoviewport: true, visible: true,monitorresize:false,dragOnly:true,keylisteners:null} );}
		if(nx !== "" && nx !== "center"){
			janela.moveTo(nx,ny + 50);
		}
		YAHOO.i3GEO.janela.manager.register(janela);
		if(this.TRANSICAOSUAVE ){
			janela.cfg.setProperty("effect",[
					{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.5}
			]);
		}
		janela.cfg.setProperty("zIndex",[4]);
		janela.render();
		janela.bringToTop();
		//ajusta estilos e outras caracter&iacute;sticas da janela criada
		if(navm && id !== "i3geo_janelaMensagens" && i3GEO.Interface.ATUAL === "googleearth")
		{janela.moveTo(0,0);}
		if(ifr === true)
		{janela.iframe.style.zIndex = 4;}
		temp = $i(id+"_corpo");
		if(temp){
			if(navm)
			{temp.style.paddingRight = "0px";}
			temp.style.width = parseInt(temp.style.width,10) - 2 + "px";
		}
		YAHOO.util.Event.addListener($i(id), "click", YAHOO.util.Event.stopPropagation);
		//finaliza
		if(funcaoCabecalho)
		{$i(id+'_cabecalho').onclick = funcaoCabecalho;}
		if(funcaoMinimiza)
		{$i(id+"_minimizaCabecalho").onclick = funcaoMinimiza;}
		YAHOO.util.Event.addListener(janela.close, "click", i3GEO.janela.fecha,janela,{id:id},true);
		//$i(id+"_c").style.zIndex = 20000;
		return([janela,$i(id+"_cabecalho"),temp]);
	},
	/*
	Minimiza ou maximiza a janela

	Parametro:

	id {string} - prefixo utilizado na composi&ccedil;&atilde;o do id da janela
	*/
	minimiza: function(id){
		var temp = $i(id+"_corpo"),
			n,
			i,
			m = YAHOO.i3GEO.janela.manager.find(id);
		if(temp){
			if(temp.style.display === "block"){
				temp.style.display = "none";
				if(m)
				{m.hideIframe;}
			}
			else{
				temp.style.display = "block";
				if(m)
				{m.showIframe;}
			}
		}
		temp = $i(id+"_resizehandle");
		if(temp){
			if(temp.style.display === "none")
			{temp.style.display = "block";}
			else
			{temp.style.display = "none";}
		}
		temp = $i(id+"_c");
		if(temp){
			temp = temp.getElementsByTagName("div");
			n = temp.length;
			for(i=0;i<n;i++){
				if(temp[i].className === "underlay" || temp[i].className === "bd"){
					if(temp[i].style.display === "none")
					{temp[i].style.display = "block";}
					else
					{temp[i].style.display = "none";}
				}
			}
		}
		temp = $i(id+"_corpo");
		if(temp){
			if(temp.style.display === "none")
			{temp.style.display = "block";}
			else
			{temp.style.display = "none";}
		}
	},
	/*
	Aplica a op&ccedil;&atilde;o definida em ANTESFECHA e elimina alguns objetos que s&atilde;o comumente adicionados por algumas opera&ccedil;&otilde;es do i3geo
	como richdraw, box, pin

	Parametros:

	event {objeto} - objeto YUI do evento que gerou o fechament da janela

	args {objeto} - parametros do evento que fechou a janela
	*/
	fecha: function(event,args){
		if(typeof(console) !== 'undefined'){console.info("i3GEO.janela.fecha()");}
		var i,id;
		//esconde elementos gr&aacute;ficos q a ferramenta pode ter aberto
		i3GEO.util.escondePin();
		i3GEO.util.escondeBox();
		//executa fun&ccedil;&otilde;es default
		if(i3GEO.janela.ANTESFECHA){
			for(i=0;i<i3GEO.janela.ANTESFECHA.length;i++)
			{eval(i3GEO.janela.ANTESFECHA[i]);}
		}
		if(i3GEO.janela.id)
		{id = i3GEO.janela.id;}
		else
		{id = event.id;}
		if(id == undefined)
		{id = args.id;}
		i3GEO.janela.destroi(id);
	},
	/*
	Destroi uma janela sem aplicar as funcoes adicionais

	Parametros:

	id {string} - id da janela
	*/
	destroi: function(id){
		var janela = YAHOO.i3GEO.janela.manager.find(id);
		i3GEO.util.removeScriptTag(id+"_script");
		i3GEO.util.removeScriptTag(id+".dicionario_script");
		if(janela){
			YAHOO.i3GEO.janela.manager.remove(janela);
			//janela.destroy();
			//destroy remove os listeners!!!!
			janela = $i(id+"_c");
			janela.parentNode.removeChild(janela);
		}
	},
	/*
	Function: alteraTamanho

	Altera o tamanho de uma janela aberta

	Parametros:

	w {Integer} - nova largura

	h {Integer} - nova altura

	id {String} - (opcional) id que identifica a janela aberta, por padr&atilde;o utiliza "wdoca"
	*/
	alteraTamanho: function(w,h,id){
		if(typeof(console) !== 'undefined'){console.info("i3GEO.janela.alteraTamanho()");}
		var i;
		if(arguments.length === 3)
		{i = $i(id);}
		else
		{i = $i("wdoca");}
		if(i){
			i.style.width = w + "px";
			i.style.height = h + "px";
		}
	},
	/*
	Function: abreAguarde

	Abre uma janela com a mensagem de aguarde

	Parametros:

	id {String} - id da nova janela

	texto {String} - texto da janela
	*/
	abreAguarde: function(id,texto){
		if(typeof(console) !== 'undefined'){console.info("i3GEO.janela.abreAguarde("+id+")");}
		var pos,temp,janela;
		if(!id || id == undefined)
		{return;}
		janela = YAHOO.i3GEO.janela.managerAguarde.find(id);
		pos = [0,0];
		if($i(i3GEO.Interface.IDCORPO))
		{pos = YAHOO.util.Dom.getXY($i(i3GEO.Interface.IDCORPO));}
		else if ($i("contemImg"))
		{pos = YAHOO.util.Dom.getXY($i("contemImg"));}
		if(i3GEO.janela.AGUARDEMODAL == true)
		{texto += "<br><span style='color:navy;cursor:pointer;font-size:9px;' onclick='javascript:if(i3GEO.janela.AGUARDEMODAL == true){i3GEO.janela.AGUARDEMODAL = false;}else{i3GEO.janela.AGUARDEMODAL = true;}'>bloquear/desbloquear</span>";}
		if(!janela){
			janela = new YAHOO.widget.Panel(id,{width:"240px",fixedcenter:false,underlay:"none",close:true,draggable:false,modal:i3GEO.janela.AGUARDEMODAL,monitorresize:false});
			janela.render(document.body);
			YAHOO.i3GEO.janela.managerAguarde.register(janela);
		}
		if(i3GEO.janela.ESTILOAGUARDE === "normal" || i3GEO.janela.ESTILOAGUARDE === "reduzida"){
			janela.setBody(texto);
			janela.body.style.padding="5px";
		}
		if(i3GEO.janela.ESTILOAGUARDE === "normal" || i3GEO.janela.ESTILOAGUARDE === "minima")
		{janela.setHeader("<span><img id=aguardeGifAberto src='"+i3GEO.configura.locaplic+"/imagens/aguarde.gif' /></span>&nbsp;<span style=font-size:8px >"+YAHOO.i3GEO.janela.managerAguarde.overlays.length+"</span>");}
		if(i3GEO.parametros.w > 0)
		{janela.moveTo(pos[0] + (i3GEO.parametros.w / 2) - 120,pos[1]);}
		else
		{janela.moveTo(pos[0],pos[1]);}
		janela.show();
		try{janela.header.style.height="20px";}
		catch(e){}
		temp = $i(id+"_c");
		if(temp){
			temp.style.backgroundColor = "";
		}
		YAHOO.util.Dom.setStyle(temp,"opacity",i3GEO.janela.OPACIDADEAGUARDE / 100);
	},
	/*
	Function: fechaAguarde

	Fecha uma janela do tipo aguarde

	Paremeters:

	id {String} - id da janela que ser&aacute; fechada. Se n&atilde;o for definido, tenta fechar as janelas principais.
	*/
	fechaAguarde: function(id){
		if(id != undefined){
			var janela = YAHOO.i3GEO.janela.managerAguarde.find(id);
			if(janela){
				YAHOO.i3GEO.janela.managerAguarde.remove(janela);
				janela.destroy();
			}
		}
	},
	/*
	Function: tempoMsg

	Abre uma janela com uma mensagem temporaria

	Parametros:

	texto {String} - texto da janela

	tempo {segundos}
	*/
	tempoMsg: function(texto,tempo){
		var pos,janela,attributes,anim,altura=40;
		janela = YAHOO.i3GEO.janela.managerAguarde.find("i3geoTempoMsg");
		pos = [0,0];
		if($i(i3GEO.Interface.IDCORPO))
		{pos = YAHOO.util.Dom.getXY($i(i3GEO.Interface.IDCORPO));}
		else if ($i("contemImg"))
		{pos = YAHOO.util.Dom.getXY($i("contemImg"));}
		if(!janela){
			janela = new YAHOO.widget.Panel("i3geoTempoMsg",{width:"220px",fixedcenter:false,underlay:"none",close:false,draggable:false,modal:false,monitorresize:false,iframe:true});
			janela.render(document.body);
			YAHOO.i3GEO.janela.managerAguarde.register(janela);
		}
		janela.setBody(texto);
		altura = 70;
		janela.body.style.padding="5px";
		janela.body.style.backgroundColor="yellow";
		if(i3GEO.Interface.ATUAL != "googleearth"){
			janela.body.style.height="0px";
		}
		else{
			janela.body.style.height= altura+"px";
		}
		janela.body.style.overflow = "hidden";
		janela.body.onclick = function(){
			var janela = YAHOO.i3GEO.janela.managerAguarde.find("i3geoTempoMsg");
			if(janela){
				janela.destroy();
			}
		};

		if(i3GEO.parametros.w > 0)
		{janela.moveTo(pos[0] + (i3GEO.parametros.w / 2) - 120,pos[1]);}
		else
		{janela.moveTo(pos[0],pos[1]);}
		janela.show();
		if(i3GEO.Interface.ATUAL != "googleearth"){
			attributes = {
				height: { to: altura }
			};
			anim = new YAHOO.util.Anim(janela.body, attributes, .5, YAHOO.util.Easing.easeNone);
			anim.onComplete.subscribe(function(){
				janela.body.style.overflow = "auto";
				janela.body.style.display = "block";
				$i("i3geoTempoMsg_c").style.zIndex = 100000;
			});
			anim.animate();
		}
		//YAHOO.util.Dom.setStyle(temp,"opacity",i3GEO.janela.OPACIDADEAGUARDE / 100);
		if(!tempo){
			tempo = 4000;
		}
		setTimeout(
			function(){
				var attributes,anim,
					janela = YAHOO.i3GEO.janela.managerAguarde.find("i3geoTempoMsg");
				if(i3GEO.Interface.ATUAL != "googleearth"){
					if(janela){
						janela.body.style.overflow = "hidden";
						attributes = {
							height: { to: 0 }
						};
						anim = new YAHOO.util.Anim(janela.body, attributes, .5, YAHOO.util.Easing.easeNone);
						anim.onComplete.subscribe(function(){
							janela.destroy();
						});
						anim.animate();
					}
				}
				else{
					janela.destroy();
				}
			},
			tempo
		);

	},
	/*
	Substitui a janel&ccedil;a de alerta padr&atilde;o do sistema operacional por uma outra customizada

	Parametros:

	texto {String} - texto da mensagem
	*/
	ativaAlerta: function(){
		window.alert = function(texto){
			var textoI,
				janela = YAHOO.i3GEO.janela.managerAguarde.find("alerta");
			if(!janela){
				janela = new YAHOO.widget.SimpleDialog("alerta",{
					width: "300px",
					fixedcenter: true,
					visible: false,
					draggable: false,
					zIndex: 100000,
					textAlign: "left",
					close: true,
					modal: false,
					effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25},
					constraintoviewport: true,
					buttons: [ { text:$trad("x74"), handler: function(){this.destroy();}, isDefault:true }],
					icon: YAHOO.widget.SimpleDialog.ICON_WARN,
					text: ""
				});
				//YAHOO.i3GEO.janela.dialogInfo.cfg.setProperty("icon",YAHOO.widget.SimpleDialog.ICON_WARN);
				YAHOO.i3GEO.janela.managerAguarde.register(janela);
				janela.setHeader(" ");
				janela.render(document.body);
			}
			textoI = janela.cfg.getProperty("text");
			if(textoI != ""){
				textoI += "<br>";
			}
			texto = textoI + texto;
			janela.cfg.setProperty("text",texto);
			janela.show();
		};
	},
	/*
	Janela de confirmacao

	Parametros:

	pergunta {string} - texto da pegunta

	w {numeric} - largura da janela

	resposta1 {string} - (opcional) texto do botao 1

	resposta2 {string} - (opcional) texto do botao 2

	funcao1  {function} - (opcional) funcao do botao 1

	funcao2 {function} - (opcional) funcao do botao 2
	*/
	confirma: function(pergunta,w,resposta1,resposta2,funcao1,funcao2){
		var f1,f2,janela = YAHOO.i3GEO.janela.managerAguarde.find("confirma");
		if(!w || w == ""){
			w = 300;
		}
		if(!funcao1 || funcao1 == ""){
			f1 = function(){
				YAHOO.i3GEO.janela.managerAguarde.find("confirma").destroy();
				return true;
			};
		}
		else{
			f1 = function(){
				funcao1.call();
				YAHOO.i3GEO.janela.managerAguarde.find("confirma").destroy();
			};
		}
		if(!funcao2 || funcao2 == ""){
			f2 = function(){
				YAHOO.i3GEO.janela.managerAguarde.find("confirma").destroy();
				return false;
			};
		}
		else{
			f2 = function(){
				YAHOO.i3GEO.janela.managerAguarde.find("confirma").destroy();
				funcao2.call();
			};
		}
		if(!resposta1 || resposta1 == ""){
			resposta1 = $trad("x58");
		}
		if(!resposta2 || resposta2 == ""){
			resposta2 = $trad("x75");
		}
		if(janela){
			janela.destroy();
		}
		janela = new YAHOO.widget.SimpleDialog("confirma",{
			width: w+"px",
			fixedcenter: true,
			visible: false,
			draggable: false,
			zIndex: 100000,
			textAlign: "left",
			close: false,
			modal: false,
			effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25},
			constraintoviewport: true,
			buttons: [
				{ text: resposta1, handler:f1 },
				{ text: resposta2,  handler:f2 }
			],
			icon: YAHOO.widget.SimpleDialog.ICON_HELP,
			text: pergunta
		});
		YAHOO.i3GEO.janela.managerAguarde.register(janela);
		janela.setHeader(" ");
		janela.render(document.body);
		janela.show();
	},
	/*
	Janela de prompt para entrada de dados

	O campo para digitacao contem o ID 'i3GEOjanelaprompt'

	Parametros:

	pergunta {string} - texto da pegunta

	funcaoOk  {function} - (opcional) funcao do botao ok

	valorDefault {string}
	*/
	prompt: function(pergunta,funcaoOk,valorDefault){
		if($i("i3GEOjanelaprompt")){
			return;
		}
		if(!valorDefault){
			valorDefault = "";
		}
		var i = "<br><input id='i3GEOjanelaprompt' type=text value='"+valorDefault+"' style='position:relative;top:5px;width:98%;cursor:text;' />";
		i3GEO.janela.confirma(pergunta+i,"","","",funcaoOk);
	},
	/*
	Function: mensagemSimples

	Mostra uma janela simples com uma mensagem

	Parametros:

	texto {String} - texto da mensagem
	*/
	mensagemSimples: function(texto,cabecalho){
		var janela;
		if($i("mensagemSimples1")){
			janela = YAHOO.i3GEO.janela.manager.find("mensagemSimples1");
		}
		else{
			janela = new YAHOO.widget.SimpleDialog("mensagemSimples1",{
				width: "300px",
				fixedcenter: true,
				visible: true,
				draggable: true,
				zIndex: 100000,
				textAlign: "left",
				close: true,
				modal: false,
				effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25},
				constraintoviewport: true,
				text: ""
			});
			YAHOO.i3GEO.janela.manager.register(janela);
			janela.setHeader(cabecalho);
			janela.render(document.body);
		}
		janela.setHeader(cabecalho);
		janela.cfg.setProperty("text",texto);
		janela.show();
	},
	/*
	Cria um DIV e posiciona sobre o mapa na posi&ccedil;&atilde;o do mouse.

	Parametro:

	cabecalho {String} - texto que ser&aacute; usado no cabe&ccedil;alho (op&ccedil;&atilde;o fixar) (opcional)

	Return:

	ID do DIV criado
	*/
	tip: function(cabecalho){
		if(typeof(console) !== 'undefined'){console.info("i3GEO.janela.tip()");}
		var Nid,i,novoel,res;
		if(arguments.length === 0){cabecalho = "fixar";}
		Nid = YAHOO.util.Dom.generateId();
		i = $i("i3geo_rosa");
		if(i)
		{i.style.display="none";}
		if ($i(i3GEO.Interface.IDCORPO))
		{$i("img").title = "";}
		//insere div para tips
		novoel = document.createElement("div");
		novoel.id = Nid;
		novoel.style.position="absolute";
		novoel.style.zIndex=5000;
		novoel.style.textAlign="left";
		novoel.style.background="white";
		if (navm)
		{novoel.style.filter = "alpha(opacity=90)";}
		else
		{novoel.style.opacity = ".9";}
		document.body.appendChild(novoel);
		i3GEO.janela.TIPS.push($i(Nid));
		//
		//monta o TIP com o id &uacute;nico criado
		//quando o usu&aacute;rio escolhe a op&ccedil;&atilde;o de fixar,
		//o div &eacute; incluido no array i3GEO.janela.TIPS
		//quando o mapa &eacute; redesenhado, esses elementos s&atilde;o exclu&iacute;dos do mapa
		//
		res = "<div id='"+Nid+"cabecatip' style='text-align:left;background-color:rgb(240,240,240)'>";
		res += "<span style='color:navy;cursor:pointer;text-align:left' onclick='javascript:$i(\""+Nid+"cabecatip\").innerHTML =\"\";' >"+cabecalho+"</span></div>";
		novoel.innerHTML = "<table style='text-align:left'><tr><td style='text-align:left'>"+res+"</td></tr></table>";
		ist = novoel.style;
		ist.top = objposicaocursor.telay - 9 + "px";
		ist.left = objposicaocursor.telax - 5 + "px";
		ist.display="block";
		//
		//registra a fun&ccedil;&atilde;o de elimina&ccedil;&atilde;o dos tips
		//
		if(i3GEO.eventos.NAVEGAMAPA.toString().search("i3GEO.janela.excluiTips('todos')") < 0)
		{i3GEO.eventos.NAVEGAMAPA.push("i3GEO.janela.excluiTips('todos')");}
		if(i3GEO.eventos.MOUSEMOVE.toString().search("i3GEO.janela.excluiTips('naofixos')") < 0)
		{i3GEO.eventos.MOUSEMOVE.push("i3GEO.janela.excluiTips('naofixos')");}
		//
		return(Nid);
	},
	/*
	Exclui os tips armazenados na vari&aacute;vel i3GEO.janela.TIPS

	Parametro:

	tipo {String} - todos|naofixos tipos de tips que ser&atilde;o exclu&iacute;dos
	*/
	excluiTips: function(tipo){
		if(typeof(console) !== 'undefined'){console.info("i3GEO.janela.excluiTips()");}
		var ot,i;
		if(arguments.length === 0)
		{tipo = "todos";}
		if(i3GEO.janela.TIPS.length > 0){
			ot = i3GEO.janela.TIPS.length-1;
			if (ot >= 0){
				do{
					if(tipo === 'todos'){
						if(i3GEO.janela.TIPS[ot]){
							i = $i(i3GEO.janela.TIPS[ot].id);
							document.body.removeChild(i);
						}
					}
					if(tipo === 'naofixos'){
						if ($i(i3GEO.janela.TIPS[ot])){
							if($i(i3GEO.janela.TIPS[ot].id+"cabecatip").innerHTML !== ""){
								document.body.removeChild($i(i3GEO.janela.TIPS[ot].id));
							}
						}
					}
				}
				while(ot--);
				if(tipo === "todos")
				{i3GEO.janela.TIPS = [];}
			}
		}
	},
	slider: function(funcao,inicial){
		var scaleFactor,bottomConstraint,topConstraint,janela,novoel,Event,slider = "",bg,thumb;
		janela = i3GEO.janela.cria(230,200,"","","",$trad("t20"),"opacidadeG");
		novoel = document.createElement("div");
		novoel.id = "slider-bg";
		novoel.tabindex = "-1";
		novoel.innerHTML = '<div style="cursor:default;position:absolute;top:4px" id="slider-thumb"><img src="'+i3GEO.configura.locaplic+'/imagens/thumb-n.gif"></div>';
		janela[2].appendChild(novoel);
		Event = YAHOO.util.Event;
		bg="slider-bg";
		thumb="slider-thumb";
		novoel.style.position = "relative";
		novoel.style.background= 'url('+i3GEO.configura.locaplic+'/imagens/bg-fader.gif) 5px 0 no-repeat';
		novoel.style.height = "28px";
		novoel.style.width= "228px";
		// The slider can move 0 pixels up
		topConstraint = 0;
		// The slider can move 200 pixels down
		bottomConstraint = 200;
		// Custom scale factor for converting the pixel offset into a real value
		scaleFactor = 1;
		// The amount the slider moves when the value is changed with the arrow
		// keys
		Event.onDOMReady(function() {
			slider = YAHOO.widget.Slider.getHorizSlider(bg,thumb, topConstraint, bottomConstraint, 20);
			slider.setValue(parseInt(inicial,10));
			slider.getRealValue = function() {
				return Math.round(this.getValue() * scaleFactor);
			};
			slider.subscribe("slideEnd", function(offsetFromStart) {
				var actualValue = slider.getRealValue();
				eval(funcao+"("+actualValue+")");
			});
		});
		// Use setValue to reset the value to white:
		Event.on("putval", "click", function(e) {
			slider.setValue(100, false); //false here means to animate if possible
		});
	},
	/*
	Adiciona no cabe&ccedil;alho da janela um combo com a lista de temas para janelas abertas por ferramentas

	Essa fun&ccedil;&atilde;o &eacute; utilizada pelas ferramentas que operam sobre um determinado tema. O combo permite que o usu&aacute;rio
	selecione um tema e ative a ferramenta para funcionar com esse tema

	Parametros:

	idDiv {string} - id do elemento HTML que receber&aacute; o combo

	idCombo {string} - id do combo que ser&aacute; criado

	ferramenta {string} - nome da ferramenta (namespace da classe, por exemplo "tabela" para a classe i3GEOF.tabela

	tipo {string} - tipo de combo

	funcaoOnChange {function} - funcao que sera executada no evento onchange do combo a ser criado
	*/
	comboCabecalhoTemas: function(idDiv,idCombo,ferramenta,tipo,funcaoOnChange){
		var temp = $i(idDiv);
		if(temp){
			temp.innerHTML = "";
			i3GEO.util.comboTemas(
				temp.id+"Sel",
				function(retorno){
					var container = $i(idDiv),
						c;
					container.innerHTML = retorno.dados;
					//container.style.left = "0px";
					//container.styletextAlign = "left";
					c = $i(idCombo);
					c.style.width = "150px";
					c.style.border = "solid #B4B4B4 1px";
					c.style.top = "6px";
					c.style.left = "2px";
					c.style.position = "relative";
					c.style.fontSize = "10px";
					c.style.color = "#686868";
					if(i3GEO.temaAtivo !== "")
					{c.value = i3GEO.temaAtivo;}
					if(i3GEOF[ferramenta] && i3GEOF[ferramenta].tema)
					{c.value = i3GEOF[ferramenta].tema;}
					if(c.value === "" && i3GEOF[ferramenta]){
						i3GEOF[ferramenta].tema = "";
						$i("i3GEOF."+ferramenta+"_corpo").innerHTML = "";
					}
					if(funcaoOnChange && funcaoOnChange != ""){
						c.onchange = funcaoOnChange;
					}
					else{
						c.onchange = function(){
							var valor = $i(idCombo).value;
							if(valor !== ""){
								i3GEO.mapa.ativaTema(valor);
								if(i3GEOF[ferramenta]){
									i3GEOF[ferramenta].tema = valor;
									$i("i3GEOF."+ferramenta+"_corpo").innerHTML = "";
									eval("i3GEOF."+ferramenta+".inicia('i3GEOF."+ferramenta+"_corpo');");
								}
							}
						};
					}
				},
				temp.id,
				"",
				false,
				tipo
			);
		}
		//
		//a busca nao funciona com parametros dentro de parenteses
		//por isso e necessario zerar o array
		//
		if(i3GEO.eventos.ATUALIZAARVORECAMADAS.length > 20){
			i3GEO.eventos.ATUALIZAARVORECAMADAS = [];
		}
		temp = "i3GEO.janela.comboCabecalhoTemas('"+idDiv+"','"+idCombo+"','"+ferramenta+"','"+tipo+"')";
		if(i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search(temp) < 0)
		{i3GEO.eventos.ATUALIZAARVORECAMADAS.push(temp);}
	}
};
try{
	//controle dos pain&eacute;is que podem ser redimensionados
	YAHOO.widget.ResizePanel = function(el, userConfig)	{
		if (arguments.length > 0)
		{YAHOO.widget.ResizePanel.superclass.constructor.call(this, el, userConfig);}
	};
	YAHOO.widget.ResizePanel.CSS_PANEL_RESIZE = "yui-resizepanel";
	YAHOO.widget.ResizePanel.CSS_RESIZE_HANDLE = "resizehandle";
	YAHOO.extend(
		YAHOO.widget.ResizePanel, YAHOO.widget.Panel,{
			init: function(el, userConfig){
				YAHOO.widget.ResizePanel.superclass.init.call(this, el);
				this.beforeInitEvent.fire(YAHOO.widget.ResizePanel);
				var Dom = YAHOO.util.Dom,
					oInnerElement = this.innerElement,
					oResizeHandle = document.createElement("DIV"),
					sResizeHandleId = this.id + "_resizehandle";
				oResizeHandle.id = sResizeHandleId;
				oResizeHandle.className = YAHOO.widget.ResizePanel.CSS_RESIZE_HANDLE;
				Dom.addClass(oInnerElement, YAHOO.widget.ResizePanel.CSS_PANEL_RESIZE);
				this.resizeHandle = oResizeHandle;
				function initResizeFunctionality(){
					var me = this,
						oHeader = this.header,
						oBody = this.body,
						oFooter = this.footer,
						nStartWidth,
						nStartHeight,
						aStartPos = 0,
						nBodyBorderTopWidth,
						nBodyBorderBottomWidth,
						nBodyTopPadding,
						nBodyBottomPadding,
						nBodyOffset = 0;
					oInnerElement.appendChild(oResizeHandle);
					this.ddResize = new YAHOO.util.DragDrop(sResizeHandleId, this.id);
					this.ddResize.setHandleElId(sResizeHandleId);
					this.ddResize.onMouseDown = function(e){
						//if(typeof(console) !== 'undefined'){console.error("down");}
						nStartWidth = oInnerElement.offsetWidth;
						nStartHeight = oInnerElement.offsetHeight;
						if (YAHOO.env.ua.ie && document.compatMode  === "BackCompat")
						{nBodyOffset = 0;}
						else{
							nBodyBorderTopWidth = parseInt(Dom.getStyle(oBody, "borderTopWidth"), 10);
							nBodyBorderBottomWidth = parseInt(Dom.getStyle(oBody, "borderBottomWidth"), 10);
							nBodyTopPadding = parseInt(Dom.getStyle(oBody, "paddingTop"), 10);
							nBodyBottomPadding = parseInt(Dom.getStyle(oBody, "paddingBottom"), 10);
							nBodyOffset = nBodyBorderTopWidth + nBodyBorderBottomWidth + nBodyTopPadding + nBodyBottomPadding;
						}
						//
						//ajusta o tamanho do body no IE qd a janela &eacute; redimensionada
						//
						me.cfg.setProperty("width", nStartWidth + "px");
						aStartPos = [YAHOO.util.Event.getPageX(e), YAHOO.util.Event.getPageY(e)];
					};
					this.ddResize.onDrag = function(e){
						var aNewPos = [YAHOO.util.Event.getPageX(e), YAHOO.util.Event.getPageY(e)],
							nOffsetX = aNewPos[0] - aStartPos[0],
							nOffsetY = aNewPos[1] - aStartPos[1],
							nNewWidth = Math.max(nStartWidth + nOffsetX, 10),
							nNewHeight = Math.max(nStartHeight + nOffsetY, 10),
							nBodyHeight = (nNewHeight - (oFooter.offsetHeight + oHeader.offsetHeight + nBodyOffset));
						me.cfg.setProperty("width", nNewWidth + "px");
						//if(navm)
						//{nNewWidth = nNewWidth - 2;}
						oBody.style.width = nNewWidth - 4 +"px";
						if (nBodyHeight < 0)
						{nBodyHeight = 0;}
						oBody.style.height =  nBodyHeight + "px";
						if ($i("wdocai")){
							$i("wdocai").style.height = nBodyHeight + "px";
							$i("wdocai").style.width = oBody.style.width + "px";
						}
					};
					this.ddResize.onMouseUp = this.ddResize.onDrag.call();
				}
				function onBeforeShow(){
					initResizeFunctionality.call(this);
					this.unsubscribe("beforeShow", onBeforeShow);
				}
				function onBeforeRender(){
					if (!this.footer)
					{this.setFooter("");}
					if (this.cfg.getProperty("visible"))
					{initResizeFunctionality.call(this);}
					else
					{this.subscribe("beforeShow", onBeforeShow);}
					this.unsubscribe("beforeRender", onBeforeRender);
				}
				this.subscribe("beforeRender", onBeforeRender);
				if (userConfig)
				{this.cfg.applyConfig(userConfig, true);}
				this.initEvent.fire(YAHOO.widget.ResizePanel);
			},
			toString: function()
			{return "ResizePanel " + this.id;}
		}
	);
}
catch(e){
	if(typeof(console) !== 'undefined'){console.error(e);}
}
//YAHOO.log("carregou classe janela", "Classes i3geo");