//Copyright - 2000-2008 Alfredo J G A Borba. Todos os Direitos Reservados (www.webcalc.com.br)


//Altera Painel (painel_id = 1)
function mudaPainelPid1() {	
	var painel_html = "";	
	painel_html += "<div id='sub_painel' style='padding-right: 0px; padding-bottom: 0px; border: 0;'><table id='painel_table' border='0' style='width: 457px; margin-left: 5px; margin-bottom: 5px;'><tr>";
	if (is.ie5 && !is.fox) {
		painel_html += "<td style='width: 27px;'>";
	}
	else {
		painel_html += "<td style='width: 27px; height: 35px'>";
	}
	painel_html += "<div id='marca_coord' style='width: 20px; height: 20px; border: 0px solid; text-align: center; padding: 4px 4px 1px 2px;' title='Ativar Marca&ccedil;&atilde;o de Coordenadas' onClick='MudaBtVz(this, 4); altMap(this);' onMouseDown='MudaBtVz(this, 3)' onMouseOver='MudaBtVz(this, 1)' onMouseOut='MudaBtVz(this, 2)'><img src='../imagens/compass.gif' alt='' name='marcaCoord' id='marcaCoord' width='16' height='16' border='0' style='margin-left: 2px;' title='Ativar Marca&ccedil;&atilde;o de Coordenadas'></div></td>";
	painel_html += "<td valign='middle' class='calc1'>&nbsp;&nbsp;<input type='checkbox' name='calc_dist_op' id='calc_dist_op' value='' onClick='ativaCalcDist(this);' />&nbsp;Dist&acirc;ncias Marcas&nbsp;&nbsp;&nbsp;&nbsp;<input type='checkbox' name='calc_dist_op2' id='calc_dist_op2' value='' onClick='ativaCalcDist(this);' />&nbsp;Dist&acirc;ncias Coordenadas</td>";			
	if (is.ie5 && !is.fox) {
		painel_html += "<td style='width: 27px;'>";
	}
	else {
		painel_html += "<td style='width: 27px; height: 35px'>";
	}			
	painel_html += "<div id='imprime' style='width: 20px; height: 20px; border: 0px solid; text-align: center; padding: 4px 4px 1px 2px; display: none' title='Abrir Janela para Impress&atilde;o' onClick='MudaBtVz(this, 4); altMap(this);' onMouseDown='MudaBtVz(this, 3)' onMouseOver='MudaBtVz(this, 1)' onMouseOut='MudaBtVz(this, 2)'><img src='../imagens/icon_print.gif' alt='' name='imprimir' id='imprimir' width='16' height='16' border='0' style='margin-left: 2px;' title='Abrir Janela para Impress&atilde;o'></div></td>";
	painel_html += "<td style='width: 27px;'><div id='mostra_link' style='width: 20px; height: 20px; border: 0px solid; text-align: center; padding: 4px 4px 1px 2px;' title='Mostrar Link para Esta P&aacute;gina' onClick='MudaBtVz(this, 4); altMap(this);' onMouseDown='MudaBtVz(this, 3)' onMouseOver='MudaBtVz(this, 1)' onMouseOut='MudaBtVz(this, 2)'><img src='../imagens/link.gif' alt='' name='mostraLink' id='mostraLink' width='16' height='15' border='0' style='margin-left: 2px;' title='Mostrar Link para Esta P&aacute;gina'></div></td>";
	painel_html += "<td style='width: 27px;'><div id='ajuda' style='width: 20px; height: 20px; border: 0px solid; text-align: center; padding: 4px 4px 1px 2px;' title='Mostrar Instru&ccedil;&otilde;es' onClick='MudaBtVz(this, 4); document.location.href=\"#instrucoes\";' onMouseDown='MudaBtVz(this, 3)' onMouseOver='MudaBtVz(this, 1)' onMouseOut='MudaBtVz(this, 2)'><img src='../imagens/ajuda_b.gif' alt='' name='mostraAjuda' id='mostraAjuda' width='16' height='16' border='0' style='margin-left: 2px;' title='Mostrar Instru&ccedil;&otilde;es'></div></td>";
	painel_html += "</tr></table>";
	painel_html += "<table border='0' style='width: 457px; margin-left: 5px; margin-bottom: 5px;'>";
	painel_html += "<tr><td valign='middle'>";
	painel_html += "<span class='calc1'>Latitude:</span>&nbsp;&nbsp;";
	painel_html += "<input type='text' name='lat_1' id='lat_1' size='10' onChange='verifcampo(this)' /><span id='grau_lat'>&deg;</span>";
	painel_html += "&nbsp;<select name='lat_index' id='lat_sinal' onChange='verifcampo(this)'>";
	painel_html += "<option>N</option>";
	painel_html += "<option>S</option>";
	painel_html += "</select>";
	painel_html += "&nbsp;&nbsp;";
	painel_html += "<span class='calc1'>Longitude:</span>&nbsp;&nbsp;";
	painel_html += "<input type='text' name='long_1' id='long_1' size='10' onChange='verifcampo(this)' /><span id='grau_long'>&deg;</span>";
	painel_html += "&nbsp;<select name='long_index' id='long_sinal' onChange='verifcampo(this)'>";
	painel_html += "<option>L</option>";
	painel_html += "<option>O</option>";
	painel_html += "</select>";			
	if (is.ie5 && !is.fox) {
		painel_html += "</td><td align='left' style='width: 27px;'>";
	}
	else {
		painel_html += "</td><td align='left' style='width: 27px; height: 35px'>";
	}			
	painel_html += "<div id='busca_coord' style='width: 20px; height: 20px; border: 0px solid; text-align: center; padding: 4px 4px 1px 2px;' onClick='MudaBtVz(this, 4); altMap(this);' onMouseDown='MudaBtVz(this, 3)' onMouseOver='MudaBtVz(this, 1)' onMouseOut='MudaBtVz(this, 2)' title='Localizar Coordenadas'><img src='../imagens/lupa.gif' alt='' name='buscaCoord' id='buscaCoord' width='12' height='12' border='0' style='vertical-align: middle; margin-left: 1px;' title='Localizar Coordenadas'></div>";
	painel_html += "</td></tr></table>";
	painel_html += "<table border='0' style='width: 457px; margin-left: 5px;'>";
	painel_html += "<tr><td valign='middle'>";
	painel_html += "<span class='calc1' id='calc_op_txt' style='color: #b4b4b4;'>Dist&acirc;ncia:</span>&nbsp;<input type='text' name='dist' id='dist' size='15' style='background-color: #dddddd; border: 1px solid #4682b4; text-align: right;' />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class='calc1' id='calc_op_txt_acum' style='color: #b4b4b4;'>Acumulada:</span>&nbsp;<input type='text' name='dist_acum' id='dist_acum' size='18' style='background-color: #dddddd; border: 1px solid #4682b4; text-align: right;' />";			
	if (is.ie5 && !is.fox) {
		painel_html += "</td><td align='left' style='width: 27px;'>";
	}
	else {
		painel_html += "</td><td align='left' style='width: 27px; height: 35px'>";
	}			
	painel_html += "<div id='apaga_dist' style='width: 20px; height: 20px; border: 0px solid; text-align: center; padding: 4px 4px 1px 2px;' onClick='MudaBtVz(this, 4); altMap(this);' onMouseDown='MudaBtVz(this, 3)' onMouseOver='MudaBtVz(this, 1)' onMouseOut='MudaBtVz(this, 2)' title='Apagar Dist&acirc;ncia Acumulada'><img src='../imagens/cancelar2.gif' alt='' name='apagaDist' id='apagaDist' width='12' height='12' border='0' style='vertical-align: middle; margin-left: 2px;' title='Apagar Dist&acirc;ncia Acumulada'></div>";
	painel_html += "</td></tr></table>";
	painel_html += "<table border='0' cellspacing='3' cellpadding='0' style='width: 452px; margin-left: 9px; margin-top: 5px;'><tr>";
	painel_html += "<td><input type='button' name='def_ponto1' id='def_ponto1' value='Ponto 1' disabled style='width: 70px;' onclick='distCoord(this);' /></td>";
	if (is.ie5 && !is.fox) {
		var height = 30;
	}
	else {
		var height = 40;
	}
	painel_html += "<td width='40%' height='" + height + "' valign='top' style='padding-left: 5px; border: 1px solid #dddddd;'><span id='pt1Txt' style='color: #dddddd; font-size: 10px;'>&nbsp;</span></td>";
	painel_html += "<td align='right'><input type='button' name='def_ponto2' id='def_ponto2' value='Ponto 2' disabled style='width: 70px;' onclick='distCoord(this);' /></td>";
	painel_html += "<td width='40%' height='" + height + "' valign='top' style='padding-left: 5px; border: 1px solid #dddddd;'><span id='pt2Txt' style='color: #dddddd; font-size: 10px;'>&nbsp;</span></td>";
	painel_html += "</tr></table></div>";			

	document.getElementById("painel").innerHTML = painel_html;	
	preenchePainel1();
	mudaPainelInstru1();
	
	var distUnid = document.getElementById("dist_unid");
	distUnid.options.length = 4;
	distUnid.options[0].text = "Metro (m)";
	distUnid.options[0].value = "1";
	distUnid.options[1].text = "Quil" + unescape("\u00F4") + "metro (km)";
	distUnid.options[1].value = "0.001";
	distUnid.options[2].text = "milha (mi)";
	distUnid.options[2].value = "0.0006213711922373339";
	distUnid.options[3].text = "milha N" + unescape("\u00E1") + "utica (miN)";
	distUnid.options[3].value = "0.0005399568034557236";
	distUnid.selectedIndex = 0;		
}
//Fim de Altera Painel


//Preenche Painel (painel_id = 1)
function preenchePainel1 () {	
	var coordFormat = document.getElementById("coord_format");
	if (coordFormat.value=="0") {			
		obj_format.setValue(lat_1, false, decSep, false, tipo, cdec);
		document.mapa.lat_1.value = obj_format.getValueFormat();
		obj_format.setValue(long_1, false, decSep, false, tipo, cdec);
		document.mapa.long_1.value = obj_format.getValueFormat();
		document.getElementById("grau_lat").style.visibility = "visible";
		document.getElementById("grau_long").style.visibility = "visible";
	}
	else if (coordFormat.value=="1") {
		document.getElementById("grau_lat").style.visibility = "hidden";
		document.getElementById("grau_long").style.visibility = "hidden";				
		document.mapa.lat_1.value = ConvertCoord(lat_1, 1, obj_format);		
		document.mapa.long_1.value = ConvertCoord(long_1, 1, obj_format);
	}
	else if (coordFormat.value=="2") {
		document.getElementById("grau_lat").style.visibility = "hidden";
		document.getElementById("grau_long").style.visibility = "hidden";				
		document.mapa.lat_1.value = ConvertCoord(lat_1, 2, obj_format);		
		document.mapa.long_1.value = ConvertCoord(long_1, 2, obj_format);
	}
	document.mapa.lat_index.selectedIndex = lat_1_index;
	document.mapa.long_index.selectedIndex = long_1_index;
}
//Fim de Preenche Painel


//Altera Instrucoes (painel_id = 1)
function mudaPainelInstru1() {
	var instru_html = "<a name='instrucoes' id='instrucoes'></a><p style='font-weight: bold;'>Instru&ccedil;&otilde;es para Uso do Painel (Coordenadas/Dist&acirc;ncias):</p>";
	instru_html += "<ul><li>Digite as <a href='http://pt.wikipedia.org/wiki/Coordenada_geogr%C3%A1fica' target='_blank'>coordenadas geogr&aacute;ficas</a> (<a href='http://pt.wikipedia.org/wiki/Latitude' target='_blank'>Latitude</a> e <a href='http://pt.wikipedia.org/wiki/Longitude' target='_blank'>Longitude</a>) do lugar que voc&ecirc; deseja encontrar e clique no bot&atilde;o&nbsp;<img src='../imagens/lupa.gif' alt='' width='12' height='12' border='0' align='middle'>. Um marcador indicar&aacute;, no centro do mapa, a localiza&ccedil;&atilde;o exata das coordenadas digitadas</li>";
	instru_html += "<li>Para determinar as coordenadas de um determinado lugar no mapa, clique no bot&atilde;o&nbsp;<img src='../imagens/compass.gif' alt='' width='16' height='16' border='0' align='middle'> para ativar a marca&ccedil;&atilde;o de coordenadas. Ao clicar em qualquer ponto do mapa, com a marca&ccedil;&atilde;o ativada, as coordenadas ser&atilde;o mostradas nos campos \"<strong>Latitude</strong>\" e \"<strong>Longitude</strong>\"</li>";
	instru_html += "<li>Ao navegar no mapa as coordenadas do novo ponto do centro do mapa ser&atilde;o mostradas nos campos \"<strong>Latitude</strong>\" e \"<strong>Longitude</strong>\"</li>";
	instru_html += "<li>Arrastando e soltando o marcador de coordenadas, com a caixa \"<strong>Dist&acirc;ncias Marcas</strong>\" selecionada, as dist&acirc;ncias dos trechos marcados ser&atilde;o mostradas no campo \"<strong>Dist&acirc;ncia</strong>\" e a soma das dist&acirc;ncias marcadas ser&aacute; mostrada no campo \"<strong>Acumulada</strong>\"</li>";
	instru_html += "<li>Para calcular a dist&acirc;ncia entre dois pontos quaisquer do globo terrestre selecione a caixa \"<strong>Dist&acirc;ncias Coordenadas</strong>\", localize o primeiro ponto no centro do mapa e clique no bot&atilde;o \"<strong>Ponto 1</strong>\", localize o segundo ponto no centro do mapa e clique no bot&atilde;o \"<strong>Ponto 2</strong>\", a dist&acirc;ncia entre os pontos ser&aacute; mostrada no campo \"<strong>Dist&acirc;ncia</strong>\" e a soma das dist&acirc;ncias encontradas ser&aacute; mostrada no campo \"<strong>Acumulada</strong>\"</li>";
	instru_html += "<li>Para mudar o formato de nota&ccedil;&atilde;o das coordenadas, as unidades de medida de dist&acirc;ncia, a cor e a largura das linhas de marca&ccedil;&atilde;o de dist&acirc;ncias, entre outras configura&ccedil;&otilde;es, clique no bot&atilde;o <img src='../imagens/eng.gif' alt='' width='16' height='16' border='0' align='middle'> da barra de ferramentas do mapa</li>";
	instru_html += "<li>O bot&atilde;o <img src='../imagens/link.gif' alt='' width='16' height='15' border='0' align='middle'> abre uma janela com campo contendo a <strong><em>URL</em></strong> a ser copiada e utilizada como <strong><em>link</em></strong> para abrir o <strong><em>WebCalc Mapas</em></strong> nas coordenadas mostradas no painel";			
	instru_html += "</ul>";			
	document.getElementById("texto_instru").innerHTML = instru_html;
	document.getElementById("texto_instru").style.display = "block";
	document.getElementById("texto_aviso").style.display = "block";	
	document.getElementById("texto_instru_fixo").style.display = "block";	
}
//Fim de Altera Instrucoes
