- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- // ----------------------- Radar Abas --------------------------
- //
- //$funceme = {
- // Rios:{
- // Alerta:{
- // Jaguaribe:{
- // Automatico:function()
- // {
- //
- // }
- // },
- // Acarau:{}
- // }
- // }
- // }
- //
- // var alerta_jaguaribe = $funceme.Rios.Alerta.Jaguaribe();
- var arrayDados = new Array();
- (function($)
- {
- $.fn.formSetValues = function(values)
- {
- var _this = this;
- return this.each(function()
- {
- for(var key in values)
- {
- var tmp = values[key].split('=');
- $(this).find('input[id='+tmp[0]+']').val(tmp[1]);
- }
- });
- };
- })(jQuery);
- (function($)
- {
- $.fn.abas = function()
- {
- var _this = this;
- var $metodos = {
- divShowHide:function(classe)
- {
- if($(classe).is(':visible'))
- {
- $(classe).hide();
- }else{
- $(_this).find('div').each(function()
- {
- if($(this).attr("id")=="box_sub" && $(this).is(":visible"))
- {
- $(this).hide();
- }
- });
- $(classe).show();
- }
- }
- }
- return $(this).each(function()
- {
- $(this).find(".fui-event-click").bind('click',function(e)
- {
- var classe = $(this).find("a").attr("href");
- if(classe.substring(0,1) == ".")
- {
- $metodos.divShowHide(classe);
- }else{
- $.get(classe,function(rhtml)
- {
- var classetmp = classe.split('/');
- var nbarra = classetmp.length;
- var nome_classe = classetmp[nbarra-1];
- var clas = nome_classe.substring(0,nome_classe.length-4);
- if($("."+clas+"").length == 0)
- {
- var html = '<div class="'+clas+'" id="box_sub"></div>';
- $(_this).append(html);
- }
- $("."+clas+"").html(rhtml);
- $metodos.divShowHide("."+clas+"");
- });
- }
- e.preventDefault();
- });
- });
- };
- })(jQuery);
- (function($){
- $.fn.funcemeAreaMapa = function(options){
- var settings = $.extend({
- 'background-color' : null,
- 'model':null
- }, options);
- var metodos = {
- fmostratabela:function(codigo,controller)
- {
- var valor = parseInt(codigo);
- var tabela = $('div[name='+controller+']');
- if($(tabela).css("display")=="none")
- {
- $("#acordion").find('div').each(function()
- {
- var display = $(this).css('display');
- if(display=="block")
- {
- $(this).hide();
- }
- });
- $(tabela).show();
- }
- $(tabela).find('tr').each(function()
- {
- var bg = $(this).attr('style');
- if(bg!='undefined')
- {
- $(this).attr('style','');
- }
- });
- $(tabela).find('tr td').each(function(){
- var bg = $(this).attr('style');
- if(bg!='undefined')
- {
- $(this).attr('style','');
- }
- });
- var color = "#fff";
- var cor ="";
- settings['model'].find(valor,controller,function()
- {
- $(this).each(function(){
- if($(this).find("codigo").text()==valor)
- {
- var alerta = $(this).find("alerta").text();
- cor = settings['background-color'][alerta];
- if(cor=="#FAFA00"){
- color=="#000";
- }
- $('div[name='+controller+'] tr[id='+codigo+']').css('background-color',''+cor+'');
- $('div[name='+controller+'] tr[id='+codigo+'] td').css('color',''+color+'');
- }
- });
- });
- }, // and function mostra tabela
- ftexto:function(codigo,controller)
- {
- var marcador = $('#div_marcador');
- $(marcador).css('visibility',"visible");
- var texto = $('#fdiv_texto');
- var valor = parseInt(codigo);
- if(codigo==null)
- {
- $(texto).css('visibility',"hidden");
- return false;
- }
- var saida = new Array();
- saida = arrayDados[codigo];
- var hchamar = '<a href="" id="closetxt" style="float: left;"><img border="0" src="http://www.funceme.br/produtos/imagens/comuns/mapas/x.jpg"></a>';
- hchamar += settings['model'].caixaTexto(controller,saida);
- if(hchamar){
- $(texto).html(hchamar);
- $(texto).css('visibility',"visible");
- }
- }
- };
- return this.each(function()
- {
- $(this).bind('click',function(e)
- {
- e.preventDefault();
- var codigo = $(this).attr('id');
- var controller = $(this).attr('fapp');
- metodos.fmostratabela(codigo,controller);
- metodos.ftexto(codigo,controller);
- }); // and bind
- }); // and each
- }
- })(jQuery);
- var map;
- var oldmap;
- var municipios;
- var estados;
- var macro_regioes;
- var bairros;
- var overlay, otitle, bounds, map, cur_frame=0, frame_input, timestamp;
- var num_imagens_x, num_imagens_s, num_imagens_s_acumulado_1h, myLatLng ;
- var opacity = 100, f_break = 2000, f_speed = 550, reverse = 0;
- var timeout;
- overlay = new Array(1);
- otitle = new Array(1);
- function ClearOverlay(){
- while (overlay.length> 0 ) {
- overlay.pop();
- otitle.pop();
- }
- }
- function radar(nome,produto,data_ini,data_fim)
- {
- this.nome = nome;
- this.produto = produto;
- this.data_ini = data_ini;
- this.data_fim = data_fim;
- this.base_url = $("#base_url").attr('href');
- this.url = $("#url").attr('href');
- this.map;
- this.tempo;
- //this.loadMenu();
- }
- radar.criarRadar = function(nome)
- {
- return new radar(nome);
- }
- radar.buscarProdutos = function(nome,produtos)
- {
- return new radar(nome,produtos);
- }
- radar.buscarProdutosPorData = function(nome,produtos,data_ini,data_fim)
- {
- return new radar(nome,produtos,data_ini,data_fim);
- }
- radar.prototype.fetchAll = function(fnfechall)
- {
- dados = {
- nome:this.nome,
- produto:this.produto,
- data:this.data_ini,
- path:this.base_url,
- tempo:this.tempo
- }
- var jqxhr = $.getJSON("servicos/index.php",dados,fnfechall);
- error(function() { });
- }
- radar.prototype.initialize = function()
- {
- var myOptions = this.ini_mapa_options(this.nome);
- var map = this.ini_mapa(myOptions);
- map = this.OverlayBanda(myOptions);
- if(this.nome == "radars")
- {
- $("#circunferencia_radar_s").attr("checked",true);
- $("#circunferencia_radar_x").attr("checked",false);
- }
- if(this.nome == "radarx")
- {
- $("#circunferencia_radar_x").attr("checked",true);
- $("#circunferencia_radar_s").attr("checked",false);
- }
- if($("a[id=nome_produto]:visible").attr("fuiscale"))
- {
- var escala = "#escala"+$("a[id=nome_produto]:visible").attr("fuiscale");
- escala = escala.replace("/","-");
- $(escala).attr("checked",true);
- $("input[id^=escala]:not("+escala+")").attr('checked',false);
- }
- this.addEventos(map);
- }
- radar.prototype.addEventos = function(map)
- {
- $("#estados").radarCamadas({
- map:map,
- kml:'http://www.funceme.br/produtos/script/radar/kml/estados.kml'
- });
- $("#municipios").radarCamadas({
- map:map,
- kml:'http://www.funceme.br/produtos/script/radar/Precipitacao/kml/municipios.kml'
- });
- $("#macro_regioes").radarCamadas({
- map:map,
- kml:'http://www.funceme.br/produtos/script/radar/Precipitacao/kml/macro_regioes.kml'
- });
- $("#bairros").radarCamadas({
- map:map,
- kml:'http://www.funceme.br/produtos/script/radar/Precipitacao/kml/bairros_fortaleza_wgs84.kml'
- });
- $("#serfortaleza").radarCamadas({
- map:map,
- kml:'http://www.funceme.br/produtos/script/radar/Precipitacao/kml/regionais_fortaleza-wgs84.kml'
- });
- $("#circunferencia_radar_x").radarCamadas({
- map:map,
- kml:'http://www.funceme.br/produtos/kml/circ_radar_x.kml'
- });
- $("#circunferencia_radar_s").radarCamadas({
- map:map,
- kml:'http://www.funceme.br/produtos/kml/circ_radar_s.kml'
- });
- // $("#areariscofortaleza").radarCamadas({
- // map:map,
- // kml:'http://www.funceme.br/produtos/script/radar/kml/fortaleza-areas-risco.kml'
- // });
- $("#areariscofortaleza").radarCamadas({
- map:map,
- kml:'http://www.funceme.br/produtos/script/radar/kml/fortaleza-areas-risco.kml'
- });
- /* $("#areariscoceara").radarCamadas({
- map:map,
- kml:'http://www.funceme.br/produtos/kml/ceara-areas-risco.kml'
- });*/
- if( $('#escalamm-h').attr("checked")) {
- $('#escala_cores').html('<img src="imagens/paleta.png" width="85px">');
- } else if($('#escalamm').attr("checked")) {
- $('#escala_cores').html('<img src="imagens/paletatwo.png" width="85px">');
- } else {
- $('#escala_cores').html('');
- }
- }
- radar.prototype.OverlayBanda = function(myOptions)
- {
- var url = this.folder();
- var myOptions = this.ini_mapa_options(this.nome);
- bounds = this.Bounds(this.nome);
- var map = this.ini_mapa(myOptions);
- ClearOverlay();
- this.carregar_json(images,map);
- timestamp = document.getElementById("timestamp");
- startLoop(0);
- return map;
- }
- radar.prototype.carregar_json = function(json,map)
- {
- var url = this.folder();
- var x = 0;
- $(json).each(function()
- {
- overlay[x] = new USGSOverlay(bounds, url+$(this).attr("dia")+"/"+$(this).attr("imagem"), map);
- otitle[x] = $(this).attr("datahora");
- x++;
- });
- }
- radar.prototype.ini_mapa = function(myOptions)
- {
- var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
- google.maps.event.addListener(map, "mousemove", function (event)
- {
- var Lat = event.latLng.lat().toFixed(4);
- var Long = event.latLng.lng().toFixed(4);
- document.getElementById("coordenadas_latitude").innerHTML = "Lat: " + Lat;
- document.getElementById("coordenadas_longitude").innerHTML = "Lon: " + Long;
- });
- google.maps.event.addListener(map, "dblclick", function (event){
- var zoom = map.getZoom();
- var Lat = event.latLng.lat().toFixed(4);
- var Long = event.latLng.lng().toFixed(4);
- $.ajax({
- url:'index.php?c=camadas_cookie',
- type:"get",
- dataType:"HTML",
- data:"zoom="+zoom+"&lat="+Lat+"&lng="+Long,
- contentType: "application/x-www-form-urlencoded"
- });
- });
- return map;
- }
- radar.prototype.ini_mapa_options = function(tipo_radar)
- {
- var myOptions;
- if(tipo_radar=="radarx")
- {
- var lat = '-3.794561';
- var lng = '-38.557581';
- if(Ilat != 'null'){
- lat=Ilat;
- }
- if(Ilng != 'null'){
- lng=Ilng;
- }
- var myLatlng = new google.maps.LatLng(lat,lng);
- myOptions = {
- zoom: Izoom,
- center: myLatlng,
- scaleControl: true,
- // mapTypeId:google.maps.MapTypeId.SATELLITE
- mapTypeId: google.maps.MapTypeId.TERRAIN
- }
- }else{
- var lat = '-5.0693';
- var lng = '-39.26723';
- if(Ilat != 'null'){
- lat=Ilat;
- }
- if(Ilng != 'null'){
- lng=Ilng;
- }
- var myLatlng = new google.maps.LatLng(lat,lng);
- myOptions = {
- zoom: Izoom,
- center: myLatlng,
- scaleControl: true,
- // mapTypeId:google.maps.MapTypeId.SATELLITE
- mapTypeId: google.maps.MapTypeId.TERRAIN
- }
- }
- return myOptions;
- }
- radar.prototype.Bounds = function(tipo_radar)
- {
- if(tipo_radar=="radarx")
- {
- var swBound = new google.maps.LatLng(-4.880,-39.645);
- var neBound = new google.maps.LatLng(-2.709,-37.470);
- }else{
- var swBound = new google.maps.LatLng(-8.6409340,-42.8899117 );
- var neBound = new google.maps.LatLng(-1.4684507,-35.6750107);
- }
- return new google.maps.LatLngBounds(swBound, neBound);
- }
- radar.prototype.loadMenu = function()
- {
- this.loadXmlMenu(function(xml){
- var link_radar = "";
- $(xml).find("radar").each(function()
- {
- nome_radar = $(this).attr("name");
- folder = $(this).attr('id');
- if(Iradar==folder)
- {
- first_link = "<a id='nome_radar' href='"+folder+"'>"+nome_radar+"</a>";
- }else{
- link_radar += "<a id='nome_radar' href='"+folder+"'>"+nome_radar+"</a>";
- }
- });
- c = $.cookie("radar");
- link_radar = first_link+link_radar
- $("#menu_radar").html(link_radar);
- $("#menu_radar").cycle({
- fx:"fade",
- speed: "fast",
- timeout:0,
- next:"#radar_avancar",
- prev:"#radar_voltar",
- after:radar.onAfter
- });
- }
- );
- }
- radar.onAfter = function()
- {
- var folder_radar = $(this).attr("href");
- if(folder_radar.indexOf("/") > -1)
- {
- array_folder = folder_radar.split('/');
- x = array_folder.length;
- folder_radar = array_folder[x-1];
- }
- Radar = Funceme.Radar(folder_radar);
- Radar.loadMenuProdutos();
- }
- radar.prototype.loadMenuProdutos = function()
- {
- nome_radar = this.nome;
- var url = "index.php";
- $.ajax({
- url:url,
- type:"get",
- dataType:"HTML",
- data:'c=menu&nome='+nome_radar+'&iradar='+Iradar+'&Iproduto='+Iproduto,
- contentType: "application/x-www-form-urlencoded",
- success:function(html)
- {
- $("#produto").html(html);
- $("#menu_produto").cycle({
- fx:"fade",
- speed: "fast",
- timeout: 10000000,
- next:"#produto_avancar",
- prev:"#produto_voltar",
- after:radar.onAfterProduto,
- delay:2000
- });
- }
- });
- }
- radar.onAfterProduto = function()
- {
- var nome_radar = $("a[id=nome_radar]:visible").attr("href");
- var nome_produto = $("a[id=nome_produto]:visible").attr("fuinp");
- var tempo = $("a[id=nome_produto]:visible").attr('fuitime');
- oRadar = radar.buscarProdutos(nome_radar,nome_produto);
- oRadar.tempo = tempo;
- oRadar.initialize();
- }
- radar.prototype.set_menu = function(nome)
- {
- $("#menu_radar a").each(function()
- {
- if($(this).text() == nome)
- {
- $(this).show();
- }else{
- $(this).hide();
- }
- });
- }
- radar.prototype.loadXmlMenu = function(return_xml)
- {
- var xml_menu;
- pagina = "/radar/trunk/Precipitacao_por_radar/menu_simples.xml";
- $.ajax(
- {
- url:pagina,
- type:"get",
- dataType:"xml",
- contentType: "application/x-www-form-urlencoded",
- success:return_xml
- });
- }
- radar.prototype.configDefault = function()
- {
- var nome_radar = Iradar;
- var nome_produto= Iproduto;
- var var_tempo = Itempo;
- oRadar = radar.buscarProdutos(nome_radar,nome_produto);
- oRadar.tempo = var_tempo;
- oRadar.initialize();
- }
- radar.prototype.folder = function()
- {
- var produto = this.produto;
- if(produto.indexOf("_") > '-1')
- {
- var produtos_folder = produto.split("_");
- var pf = produtos_folder.join("/");
- }else{
- pf = produto;
- }
- var folder = this.url+"/arquivos/"+this.nome+"/imagens/"+pf+"/";
- return folder;
- }
- radar.prototype.rreflash = function()
- {
- var nome_radar = $("a[id=nome_radar]:visible").attr("href");
- var nome_produto = $("a[id=nome_produto]:visible").attr("fuinp");
- var tempo = $("a[id=nome_produto]:visible").attr('fuitime');
- eRadar = radar.buscarProdutos(nome_radar,nome_produto);
- eRadar.tempo = tempo;
- eRadar.initialize();
- // setTimeout(radar.prototype.rreflash, 100000);
- }
- function Funceme(){}
- Funceme.radar = null;
- Funceme.Radar = function(nome_radar,nome_produto)
- {
- var instancia = Funceme.radar;
- if(!nome_radar)
- {
- instancia = new radar();
- }
- if(nome_radar && !nome_produto)
- {
- instancia = radar.criarRadar(nome_radar);
- }
- if(nome_radar && nome_produto)
- {
- instancia = radar.buscarProdutos(nome_radar,nome_produto);
- }
- Funceme.radar = instancia;
- return instancia;
- }
- Funceme.prototype.constructor = Funceme;
- $(function()
- {
- Faccordion();
- view = new Fview()
- view.eventos();
- });
- function view()
- {
- $('#dia').change(function(){
- $("#dia option:selected").each(function () {
- file = $(this).val();
- text = $(this).text();
- });
- ajax(file,right_success);
- mapa(file);
- });
- }
- function ajax(file,return_ajax)
- {
- $.ajax({
- type: "post",
- url: file,
- dataType: "xml",
- success: return_ajax
- });// and ajax
- }
- function Faccordion()
- {
- if($("#acordion").length > 0)
- {
- $('#acordion').accordion(
- {
- active: true,
- collapsible: true,
- autoHeight: false,
- navigation: true
- });
- }
- }
- $(function(){
- $("tr#562").addClass("vicente");
- });
- function mapa(file)
- {
- var base_url = $('#base_url').val();
- var mapa_gif = base_url+"anos/"+file+"/mapa.gif";
- $('div#imagem img').attr('src',mapa_gif);
- }
- function Fview(){}
- Fview.prototype.beans = {
- img:null
- }
- Fview.prototype.eventos = function()
- {
- var _this = this;
- $('#fdiv_texto').css('visibility',"hidden");
- $("#dia").live("change",function(){
- if($(this).attr("name")=="oneselect"){
- var nome_select = $("select[name=twoselect]").val()+$(this).val();
- _this.load(nome_select);
- }else{
- var nome_select = $(this).val()+$("select[name=oneselect]").val();
- _this.load(nome_select);
- }
- });
- $("#dia").change();
- this.impresao();
- }
- Fview.prototype.load = function(nome_xml)
- {
- Fview.prototype.mapa(nome_xml);
- ajax("anos/"+nome_xml+".xml",Fview.prototype.loadSetting);
- }
- Fview.prototype.loadSettingAutomatico = function(xml){
- }
- Fview.prototype.loadSetting = function(xml)
- {
- posto = new Postos();
- nr = new NivelReservatorio();
- rio = new Rios();
- plu = new Pluviometria();
- var data_hora = $(xml).find('datahora').text();
- data = data_hora.replace('Tue',' ');
- var html_rigth = "<div id='acordion'>";
- var array_fields = {
- 'po':posto.fields,
- "rs":nr.fields,
- "sro":rio.fields,
- 'plu':plu.fields
- }
- $(xml).find("regiao").each(function()
- {
- html_rigth += "<h5><a class='title_regiao' tabindex='-1'>"+$(this).attr('name')+"</a></h5>";
- var id = $(this).attr('id');
- html_rigth += fill(xml,id,array_fields[id]);
- });
- html_rigth += "</div>";
- html_rigth += '<div class="rigth_footer" id="rigth_footer">';
- html_rigth += '<p class="obs">';
- html_rigth += ' Dados extraÃdos à s 's '+data+' <br>';
- html_rigth += 'Informações atualizadas automaticamente a cada 7 minutos';
- html_rigth += '</p>';
- html_rigth += '<p class="obs">';
- html_rigth += 'Fonte: IBGE 2010';
- html_rigth += '</p>';
- html_rigth += ';
- $(".rigth").html(html_rigth);
- Faccordion();
- }
- Fview.prototype.mapa = function(folder)
- {
- $("div#imagem img#imap").attr("usemap","#"+folder);
- $("div#imagem img#imap").attr("src","anos/"+folder+".gif");
- }
- Fview.prototype.impresao = function(){
- if(!$("#impr_select")) return false;
- $("#impr_select").click(function(e)
- {
- e.preventDefault();
- var base_url = $("#url").attr("href");
- $.get("impressao.php",function(data){
- if(data==1){
- window.location.href = base_url+"/pdf/relatorio.pdf";
- }
- });
- });
- }
- function Postos(){}
- Postos.prototype.fields = {
- codigo:null,
- posto:null,
- cod_mun:null,
- municipio:null,
- data:null,
- max:null,
- maxtwo:null,
- maxtree:null,
- alerta:null
- // grafico7d:null
- }
- Postos.prototype.getPostos = null;
- function NivelReservatorio(){}
- NivelReservatorio.prototype.fields ={
- codigo:null,
- acude:null,
- data:null,
- cota:null,
- afluente:null,
- efluente:null,
- alerta:null
- }
- NivelReservatorio.prototype.getReservatorios = null;
- function Rios(){}
- Rios.prototype.fields = {
- codigo:null,
- secao:null,
- rio:null,
- data:null,
- cota:null,
- alerta:null
- // vazao:null,
- }
- Rios.prototype.getRios = null;
- function fill(xml,id,fields)
- {
- var fhtml = "";
- var thead = "";
- var tabela = "";
- tabela += 'a += '<div name=" id="'" id="cont" class="fui-height-auto fui-scroll">';
- tabela += "<table class='tb'>";
- thead += "<tr class='tb-head'>";
- var y =1;
- $(xml).find("regiao[id="+id+"] label").each(function()
- {
- if($(this).attr("page")
- {
- if(y==1){
- thead += "ad += "<td><a name=''><b>"+$(this).text()+"</b></a></td>";
- }else{
- thead += "<td>"+$(this).text()+"</td>";
- }
- y++;
- }
- });
- thead += "</tr>";
- tabela += thead;
- var x = 1;
- $(xml).find("regiao[id="+id+").each(function()
- {
- var codigo = null
- var ftd = "ftd = "";
- for (var i in fields)
- {
- if(i == ")
- {
- codigo = $(this).find(i).text();
- arrayDados[codigo] = new Array();
- }
- if($(this).find(i).attr(".attr("name") != "no" && i != " && i != " i != ")
- {
- ftd +="ftd +="<td id='"+i+"'><b>"+$(this).find(i).text()+"</b></td>";
- }
- arrayDados[codigo][i] = $(this).find(i).text();
- }
- //arrayDados[codigo]['id'] = id;
- = id;
- if(x%2==0){
- nome_classe="tb-fundo_b";
- }else{
- nome_classe="tb-fundo_c";
- }
- fhtml += "<tr class='"+nome_classe+"+codigo+"odigo+"'>";
- fhtml +=ftd;
- fhtml += "</tr>";
- x++;
- });
- tabela +=fhtml;
- tabela += "</table>";
- tabela += ";
- return tabela;
- }
- function chamar(codigo,controller)
- {
- var marcador = $('#div_marcador');
- $(marcador).css('visibility',"lity',"visible");
- var texto = $('#fdiv_texto');
- var valor = parseInt(codigo);
- if(codigo==null)
- {
- $(texto).css('visibility',");
- return false;
- }
- var saida = new Array();
- var hchamar = '<a href=" href="" id="closetxt" style="float: left;"><img border="0" src//www.funceme.br/produtos/imagens/comuns/mapas/x.jpg"></a>';
- </a>';
- if(controller == 'rs')
- {
- saida = arrayDados[valor];
- if(isArray(saida) && isArray(saida['acude']))
- {
- hchamar += "<div style='position:relative;'><font size='1'><B>Açude</B>: " + saida['acude'].substr(0,20);
- hchamar += "<br><B>Data</B>: " + saida['data']+" hm³";
- hchamar += "<br><B>Cota atual </B>: " + saida['cota'] + " m ";
- hchamar += "<br><B>Vazao Efluente</B>: " + saida['] + "m³/s";
- hchamar += "<br><B>Vazão Afluente </B>: " + saida['" + saida['afluente'] + " m³/s</font></div>";
- // alert(hchamar);
- rt(hchamar);
- }
- }
- else if(controller == 'po')
- {
- saida = arrayDados[val//alert(saida);
- lert(saida);
- if(isArray(saida) && isArray(saida['municipio']))
- {// hchamar = "";
- chamar = "";
- hchamar += "<div style='position:relative;'1'font size='1'><B>Posto</B>: " + saida['posto'].substr(0,20)+"";
- hchamar += "<br><B>Municipio</B>: " + saida['municipio']+"";
- hchamar += "<br><B>Chuva</B>: " + saida['max'] + " mm ";
- }
- }else if(controller == 'sro')
- {
- saida = arrayDados[codi//alert(saida);
- lert(saida);
- if(isArray(saida) && isArray(saida['secao']))
- {// hchamar = "";
- chamar = "";
- hchamar += "<div style='position:relative;'1'font size='1'><B>Seção</B>: " + saida['secao'].substr(0,20)+"";
- hchamar += " + saida['rio']+" + saida['rio']+"";
- hchamar += "<br><B>Data/hora</B>: " + saida['data'] + "";
- hchamar += "<br><B>Cota</B>: " + saida['cota'] + "";
- }
- }
- else if(controller == 'sm')
- {
- ajax("sedemunicipios.xml",function(xml){
- $(xml).find("produtos sessao municipio").each(function()
- {
- var id = $(this).find("codigo").text();
- if(id==codigo)
- {
- // hchamar = "";
- / hchamar = "";
- hchamar += "<div style='position:relative;'><b>Cidade</b>: "nome"this).find("nome").text()+"";
- hchamar += "<br><b>População Total:</b>: "+ $(this).find("poptotal").text()+"";
- hchamar += "<br><b>População Urbana</b>: " +$(this).find("popurbana").text() + "";
- hchamar += "<br><b>População Rural</b>: " +$(this).find("poprural").text() + "";
- hchamar += "<br><b>Risco</b>: " + $(this).find("risco").text() + "";
- hchamar += "</div>";
- if(hchamar){
- $(texto).html(hchamar);
- $(texto).css('visibility',"visible");
- return false;
- }
- }
- })
- });
- }
- else if(controller == "plu")
- {
- saida = arrayDad//alert(saida);
- //alert(saida);
- if(isArray(saida) && isArray(saida['no// hchamar = "";
- // hchamar = "";
- hchamar += "<div style='position:relative;'><font size='1'><B>Estação</B>: " + saida['nome'].substr(0,20)+"";
- hchamar += "<br><B>24h</B>: " + saida['plu24h']+"mm";
- hchamar += "<br><B>48h</B>: " + saida['plu48h'] + "mm";
- hchamar += "<br><B>72h</B>: " + saida['plu72h'] + "mm";
- }
- }
- if(hchamar){
- $(texto).html(hchamar);
- $(texto).css('visibility',"visible");
- }
- }
- function mostratabela(codigo,controller)
- {
- var saida = new Array();
- var valor = parseInt(codigo);
- saida = arrayDados[valor];
- var tabela = $('div[name='+controller+']');
- if($(tabela).css("display")=="none")
- {
- $("#acordion").find('div').each(function(){
- var display = $(this).css('display');
- if(display=="block")
- {
- $(this).hide();
- }
- });
- $(tabela).show();
- }
- $(tabela).find('tr').each(function(){
- var bg = $(this).attr('style');
- if(bg!='undefined')
- {
- $(this).attr('style','');
- }
- });
- $(tabela).find('tr td').each(function(){
- var bg = $(this).attr('style');
- if(bg!='undefined')
- {
- $(this).attr('style','');
- }
- });
- var color = "#fff";
- var cor ="";
- if(isArray(saida) && saida['alerta'] != "")
- {
- alertaJaguaribe.find(valor,controller,function()
- {
- $(this).each(function(){
- if($(this).find("codigo").text()==valor)
- {
- alerta = $(this).find("alerta").text();
- if(alerta == 1){
- cor="#00DE00";
- }
- if(alerta == 2){
- cor="#FAFA00";
- }
- if(alerta == 3){
- cor="#BE1E1E";
- }
- if(alerta == 4){
- cor="#7B007A";
- }
- if(alerta == 5){
- cor="#DCDCDC";
- }
- if(alerta == 6){
- cor="#7D7D7D"#000" color="#000";
- }
- $('div[name=').css('ller+'] tr[id='+codigo+']''.css('background-color',''+cor+'');
- $('div[name='+controller+'] tr[id='+codigo+'] td').css('color',''+color+'');
- }
- });
- });
- }
- }
- function isArray(o)
- {
- if(o){
- return(typeof(o.length)=="undefined")?false:true;
- }else{
- return false;
- }
- }
- $("#closetxt").live("click",function(e){
- e.preventDefault();
- chamar(null)
- });
- function Pluviometria(){}
- Pluviometria.prototype.fields = {
- codigo:null,
- nome:null,
- hora:null,
- plu24h:null,
- plu48h:null,
- plu72h:null,
- alerta:null
- }
- function alertaJaguaribe(data,codigo,produto){
- this.data = data;
- this.codigo = codigo;
- this.produto = produto;
- }
- function Alerta(data,codigo,produto){
- this.data = data;
- this.codigo = codigo;
- this.produto = produto;
- this.url = $("#url").attr('href');
- }
- alertaJaguaribe.prototype = new Alerta;
- alertaJaguaribe.criarAlerta = function(data)
- {
- return new alertaJaguaribe(data);
- }
- alertaJaguaribe.criarAlertaCodigo = function(data,codigo)
- {
- return new alertaJaguaribe(data,codigo);
- }
- Alerta.prototype.buscarAlertaCodigoProduto = function(data,codigo,produto)
- {
- return new Alerta(data,codigo,produto);
- }
- Alerta.prototype.loadXml = function(return_ajax)
- {
- folder = this.url+"/anos/"+this.data+".xml";
- $.ajax({
- type: "post",
- url: folder,
- dataType: "xml",
- // and ajax
- : return_ajax
- });// and ajax
- }
- Alerta.prototype.find = function(codigo,produto,return_find)
- {
- var dados = null;
- data = $("#dia").val();
- var alerta = this.buscarAlertaCodigoProduto(data,codigo,produto);
- alerta.loadXml(function(xml)
- {
- $(xml).find("regiao[id="+produto+"] item").each(return_find);
- });
- }
- Alerta.prototype.caixaTexto = function(controller,saida)
- {
- var hchamar = "";
- if(controller == 'rs')
- {
- if(isArray(saida) && isArray(saida['acude']))
- {
- hchamar += "<div style='position:relative;'><font size='1'acude'ccedil;ude</B>: " + saida['acude'].substr(0,20);
- hchamar += "<br><B>Data</B>: " + saida['data']+" hm³";
- hchamar += "<br><B>Cota atual </B>: " + saida['cota'] + " m ";
- hchamar += "<br><B>Vazao Efluente</B>: " + saida['efluente'] + "m³/s";
- hchamar += "<br><B>Vazão Afluente </B>: " + saida['afluente// alert(hchamar);
- t></div>";
- // alert(hchamar);
- }
- }
- els//alert(saida);
- == 'po')
- {
- //alert(saida);
- if(isArray(saida) && isArray(said// hchamar = "";
- {
- // hchamar = "";
- hchamar += "<div style='position:relative;'><font size='1'><B>Posto</B>: " + saida['posto'].substr(0,20)+"";
- hchamar += "<br><B>Municipio</B>: " + saida['municipio']+"";
- hchamar += "<br><B>Chuva</B>: " + saida['max'] + " mm ";
- }
- }else//alert(saida);
- = 'sro')
- {
- //alert(saida);
- if(isArray(saida) && isArray(// hchamar = "";
- {
- // hchamar = "";
- hchamar += "<diAlertav style='position:relative;'><font size='1'><B>Seção</B>: " + saida['secao'].substr(0,20)+"" + saida['rio']+"amar += "<br><B>Rio</B>: " + saida['rio']+"";
- hchamar += ""br><B>Data/hora</B>: " + saida['data'] + "";
- hchamar += "<br><B>Cota</B>: " + saida['cota'] + "";
- }
- }
- else if(controller == 'sm')
- {
- ajax("sedemunicipios.xml",function(xml){
- $(xml).find("produtos sessao municipio").each(function()
- {
- var id = $(this).find("codigo").text();
- if(id==cod// hchamar = "";
- {
- // hchamar = "";
- hchamar += "<div style='position:relative;'><b>Cidade</b>: " + $(this).find("nome").text()+"";
- hchamar += "<br><b>População Total:</b>: "+ $(this).find("poptotal").text()+"";
- hchamar += "<br><b>População Urbana</b>: " +$(this).find("popurbana").text() + "";
- hchamar += "<br><b>População Rural</b>: " +$(this).find("poprural").text() + "";
- hchamar += ";
- hchamar += "("risco").text() + "";
- hchamar += "</div>";
- if(hchamar){
- $(texto).html(hchamar);
- $(texto).css('visibility',"visible");
- return false;
- }
- }
- })
- });
- }
- else if(controller == "plu")
- {
- if(isArray(s// hchamar = "";
- aida['nome']))
- {
- // hchamar = "";
- hchamar += "<div style='position:relative;'><font size='1'><B>Estação</B>: " + saida['nome'].substr(0,20)+"";
- hchamar += "<br><B>24h</B>: " + saida['plu24h'plu48h'
- hchamar += "<br><B>48h</B>: " + saida['plu48h'] + "mm";
- hchamar += "<br><B>72h</B>: " + saida['plu72h'] + "mm";
- }
- }
- return hchamar;
- }
- function alertaAcarau(data,codigo,produto)
- {
- this.data = data;
- this.codigo = codigo;
- this.produto = produto;
- }
- alertaAcarau.prototype = new Alerta();
- alertaAcarau.criarAlerta = function(data)
- {
- return new alertaAcarau(data);
- }
- alertaAcarau.criarAlertaCodigo = function(data,codigo)
- {
- return new alertaAcarau(data,codigo);
- }
- function camadas(){}
- function serializeHref(href)
- {
- var array_href_tmp = href.split('?');
- if(isArray(array_href_tmp) && isArray(array_href_tmp[1]))
- {
- return array_href_tmp[1].split('&');
- }
- }
- function showInDiv(text) {
- var sidediv = $('#contentWindow');
- $(sidediv).html(text);
- }
- function placeMarker(location,map) {
- var marker = new google.maps.Marker({
- position: location,
- map: map
- });
- map.setCenter(location);
- }
- (function($)
- {
- $.fn.print = function()
- {
- var _this = this;
- return this.each(function()
- {
- $(this).bind('click',function()
- {
- window.print();
- });