
var Legenda_Lista = new Array();
var Legenda_Quadro;

Legenda_Lista[0] = Array('TABELA', 'CODIGO', 'TITULO', 'DESCRICAO');
Legenda_Lista[1] = Array('Climate', 'C1', '', 'The temperature climate orchids, like sea mountains, Andes gap; temperature may vary from 10ºC to 30ºC.');
Legenda_Lista[2] = Array('Climate', 'C2', '', 'The hot and humid climate orchids alternating with dry and hot climate, like amazon  regios and sea low mourtains; temperature may vary from 10ºC to 40ºC.');
Legenda_Lista[3] = Array('Climate', 'C3', '', 'The sawed region orchids, where altitude may vary from 500m to 1000m and caracterized by dry and hot days and coolness nights.');
Legenda_Lista[4] = Array('Climate', 'C4', '', 'The are plants from cold places and geat altitude, and to be cultivated out of  these local ones, they need special atmospheres.');
Legenda_Lista[5] = Array('Blooming season', 'F1', 'Summer', '');
Legenda_Lista[6] = Array('Blooming season', 'F2', 'Autumn', '');
Legenda_Lista[7] = Array('Blooming season', 'F3', 'Winter', '');
Legenda_Lista[8] = Array('Blooming season', 'F4', 'Spring', '');
Legenda_Lista[9] = Array('Habitat', 'H1', 'Aerial Plants', 'These plants can\'t adapt in vases, because their roots grow free using small branches as support, keeping the air, the fog and the rain as source of nutritions.');
Legenda_Lista[10] = Array('Habitat', 'H2', 'Epiphyte Plants', 'The plants grow on the trees, coconuts trees, etc., and fasten their roots absorving mineral and nutritious salts from the decomposition bronght by the   rain. They can live in vases, plates, etc.');
Legenda_Lista[11] = Array('Habitat', 'H3', 'Agricultural Plants', 'These plants grow on stones, and their fixation and absorption of  nutrients is similar to the epiphyte plants.');
Legenda_Lista[12] = Array('Habitat', 'H4', 'Terrestrial Plants', 'These plants live on the soil or over organic remains, and in some cases on humidity satured areas.');
Legenda_Lista[13] = Array('Habitat', 'H4a', 'Terrestrial Plants (a)', 'Sandy dry soil and rich in organic matter.');
Legenda_Lista[14] = Array('Habitat', 'H4b', 'Terrestrial Plants (b)', 'Healthy turf and organic remains.');
Legenda_Lista[15] = Array('Habitat', 'H4c', 'Terrestrial Plants (c)', 'Loamy soil and rich in organic matter with constat and renewed humidity. There are some species that keep submerged in the period of rains and can be completely dry un the dryness period.');
Legenda_Lista[16] = Array('Habitat', 'HX', 'Test', 'Include test.');
Legenda_Lista[17] = Array('Luminosity', 'L1', 'Direct sun', 'The plants need to be in a sunny place by a period of 2 to 4 hours and the remaining of the day in a high brightness so that they can flower; the shadow must be by 20%');
Legenda_Lista[18] = Array('Luminosity', 'L2', 'Half shadow', 'These plants live in the points of the trees or in thin forests, receiving about 75% of light; the shadow must be by 50%.');
Legenda_Lista[19] = Array('Luminosity', 'L3', 'Medium shadow', 'These plants live in the medium area of the forests or protected places of the sun, receiving about 50% of light; the shadow must be by 70%.');
Legenda_Lista[20] = Array('Luminosity', 'L4', 'Shaded', 'These plants live in very shaded places, receiving about 25% of   light; the shadow must be by 80%');
Legenda_Lista[21] = Array('Diameter', 'T1', '', 'Smaller than 1,0 cm of diameter.');
Legenda_Lista[22] = Array('Diameter', 'T1a', '', 'Smaller than 1.0 cm of diameter with flowering in bouquet form or bunches, becoming its flowering most attractive.');
Legenda_Lista[23] = Array('Diameter', 'T2', '', 'From 1.0 cm 4.0 cm of diameter.');
Legenda_Lista[24] = Array('Diameter', 'T2a', '', 'From 1.0 cm 4.0 cm of diameter with flowering in bouquet form or bunches, becoming its flowering most attractive.');
Legenda_Lista[25] = Array('Diameter', 'T3', '', 'From 4 cm to 10 cm of diameter.');
Legenda_Lista[26] = Array('Diameter', 'T3a', '', 'From 4 cm to 10 cm of diameter with flowering in bouquet form or bunches, becoming its flowering most attractive.');
Legenda_Lista[27] = Array('Diameter', 'T4', '', 'Larger than 10 cm of diameter.');
Legenda_Lista[28] = Array('Diameter', 'T4a', '', 'Larger than 10 cm of diameter with flowering in bouquet form or bunches, becoming its flowering most attractive.');
Legenda_Lista[29] = Array('Diameter', 'T?', '', '{Undefined diameter}');
Legenda_Lista[30] = Array('Color', 'E1', 'Yellow', '');
Legenda_Lista[31] = Array('Color', 'E10', 'Red', '');
Legenda_Lista[32] = Array('Color', 'E11', 'Purple', '');
Legenda_Lista[33] = Array('Color', 'E12', 'Wine', '');
Legenda_Lista[34] = Array('Color', 'E2', 'White', '');
Legenda_Lista[35] = Array('Color', 'E3', 'Chestnut', '');
Legenda_Lista[36] = Array('Color', 'E4', 'Blue', '');
Legenda_Lista[37] = Array('Color', 'E5', 'Lilac', '');
Legenda_Lista[38] = Array('Color', 'E6', 'Pink', '');
Legenda_Lista[39] = Array('Color', 'E7', 'Cream', '');
Legenda_Lista[40] = Array('Color', 'E8', 'Green', '');
Legenda_Lista[41] = Array('Color', 'E9', 'Salmon', '');
Legenda_Lista[42] = Array('Color', 'E?', '{Undefined color}', '');
Legenda_Lista[43] = Array('Abreviation', 'BS', '', 'Plants in conditions to be blossomed in respective station.');
Legenda_Lista[44] = Array('Abreviation', 'NBS', '', 'Plants that will go to blossom inside of 1 year.');
Legenda_Lista[45] = Array('Origin', 'BR', 'Brazilian origin', '');function Legenda_Inicia()
	{
	if (!document.getElementsByTagName) return;

	// Cria quadro descritivo
	Legenda_Quadro = document.createElement("div");

	Legenda_Quadro.setAttribute('id', 'Quadro_Legenda');
	Legenda_Quadro.style.position = 'absolute';
	Legenda_Quadro.style.top = '0px';
	Legenda_Quadro.style.left = '0px';
	Legenda_Quadro.style.display = 'none';
	Legenda_Quadro.style.width = '250px';

	// Insere no início
	var Corpo = document.getElementsByTagName("body").item(0);
	Corpo.insertBefore(Legenda_Quadro, Corpo.firstChild);

	var Referencias = document.getElementsByTagName('a');

	for (var Posicao = 0; Posicao < Referencias.length; Posicao++)
		{
		var Referencia = Referencias[Posicao];

		if (Referencia.getAttribute('href') && (Referencia.getAttribute('rel') == 'Planta_Legenda'))
			{
			Referencia.onmousemove = Legenda_Move;
			Referencia.onmouseover = function () { Legenda_Exibe(this); }
			Referencia.onmouseout = function () { Legenda_Esconde(this); }
			}
		}
	}

function Legenda_Exibe(Objeto)
	{
	var Caminho = Objeto.href;
	var Variavel = getQueryString(Caminho);

	if (Variavel && Variavel['id'] && Legenda_Quadro.style.display != 'block')
		{
		var Codigo = unescape(Variavel['id']);
		var Titulo = '';
		var Descricao = '';

		Planta_Selecionado = Objeto.href;

		for (var Posicao = 1; Posicao < Legenda_Lista.length; Posicao++)
			{
			if (Legenda_Lista[Posicao][1] == Codigo)
				{
				Titulo = Legenda_Lista[Posicao][0];
				Descricao = '<strong>' + Codigo + (Legenda_Lista[Posicao][2] ? ': ' + Legenda_Lista[Posicao][2] : '') + '</strong>';
				
				if (Legenda_Lista[Posicao][3]) Descricao += '<br />' + Legenda_Lista[Posicao][3];
				}
			}

		Legenda_Quadro.style.display = 'block';
		Legenda_Quadro.innerHTML = '<div class="Titulo">' + Titulo + '</div><div class="Texto">' + Descricao + '</div>';
		}
	}

function Legenda_Esconde(Objeto)
	{
	Legenda_Quadro.innerHTML = '';
	Legenda_Quadro.style.display = 'none';
	}

function Legenda_Move(Evento)
	{
	var DistanciaX = 16;
	var DistanciaY = 0;

	var PosicaoX = getMouseX(Evento);
	var PosicaoY = getMouseY(Evento);

	var Pagina_Tamanho = getPageSize();
	var Pagina_Rolagem = getPageScroll();

	var Quadro_Largura = parseInt(Legenda_Quadro.offsetWidth);
	var Quadro_Altura = parseInt(Legenda_Quadro.offsetHeight);

	// Largura
	if ((PosicaoX + DistanciaX + Quadro_Largura) > (Pagina_Rolagem[0] + Pagina_Tamanho[2]))
		PosicaoX = PosicaoX - Quadro_Largura - 1;
	else
		PosicaoX = PosicaoX + DistanciaX;

	// Altura
	if ((PosicaoY + DistanciaY + Quadro_Altura) > (Pagina_Rolagem[1] + Pagina_Tamanho[3]))
		PosicaoY = PosicaoY - Quadro_Altura - 1;
	else
		PosicaoY = PosicaoY + DistanciaY;

	Legenda_Quadro.style.left = PosicaoX + 'px';
	Legenda_Quadro.style.top = PosicaoY + 'px';
	}

addLoadEvent(Legenda_Inicia);
