﻿function ucMapaInterativo() {
    this.setTimeOpenBoxInfo;
    this.pageMapaInterativo;
    this.DateHourNow = new Number();
    
    //Inicializa o Objeto ucMapaInterativo
    //pTypeInfo[Tipo de informacao selecionada]
    this.Initialize = function(pTypeInfo, pDateHourNow) {
        ucMapaInterativo.pageMapaInterativo = pTypeInfo;
        ucMapaInterativo.DateHourNow = pDateHourNow;
        var sTypeInfo = (pTypeInfo == undefined || pTypeInfo == "") ? "trafego" : pTypeInfo;

        $(document).ready(function() {
            ucMapaInterativo.ChangeNavigation(sTypeInfo);
            $("#ContentPage .box-mapa-interativo ul.navigation li a").click(function() { ucMapaInterativo.ChangeNavigation($(this).parent("li").attr("class")); });
        });
    }

    //Carrega XML e transforma em Objeto
    //pUrl[Url do Xml]
    //pParams[Parametros enviados] 
    //pFunction[Funcao que é chamada após ter realizado a operacao o com sucesso]
    this.Ajax = function(pUrl, pParams, pFunction, pParamsFunc) {
        Main.LoadAjax(".box-mapa-interativo");
        $.ajax({
            url: pUrl,
            data: pParams,
            dataType: "xml",
            error: function(error) {
                //throw (error)
                //alert(error);
                Main.LoadAjaxClear();
            },
            success: function(content) {
                if (pFunction != null && pFunction != undefined)
                    pFunction(content, pParamsFunc);
                Main.LoadAjaxClear();
            }
        });
    }

    //Altera os tipos de informacoes do mapa
    //pType[trafego - cameras - operacao - clima - pedagios - pm-servicos - balancas]
    this.ChangeNavigation = function(pType) {
        try {
            $("#ContentPage .box-mapa-interativo ul.navigation li a").css("background-position", "0 0");
            $("#ContentPage .box-mapa-interativo .content-mapa-interativo  > *").remove();
            switch (pType) {
                case "trafego":
                    $("#ContentPage .box-mapa-interativo ul.navigation li.trafego a").css("background-position", "0 -15px");
                    ucMapaInterativo.Ajax("/Xml/Fluxos.xml", null, ucMapaInterativo.LoadTraffic);
                    break;
                case "cameras":
                    $("#ContentPage .box-mapa-interativo ul.navigation li.cameras a").css("background-position", "0 -15px");
                    ucMapaInterativo.Ajax("/Xml/Cameras.ashx", null, ucMapaInterativo.LoadCamera);
                    break;
                case "clima":
                    $("#ContentPage .box-mapa-interativo ul.navigation li.clima a").css("background-position", "0 -15px");
                    ucMapaInterativo.Ajax("/Xml/Operacao.xml", null, ucMapaInterativo.LoadWeather);
                    break;
                case "pedagios":
                    $("#ContentPage .box-mapa-interativo ul.navigation li.pedagios a").css("background-position", "0 -15px");
                    ucMapaInterativo.Ajax("/Xml/Pedagios.xml", null, ucMapaInterativo.LoadToll);
                    break;
                case "pm-servicos":
                    $("#ContentPage .box-mapa-interativo ul.navigation li.pm-servicos a").css("background-position", "0 -15px");
                    ucMapaInterativo.Ajax("/Xml/PM-Servicos.xml", null, ucMapaInterativo.LoadServices);
                    break;
                case "balancas":
                    $("#ContentPage .box-mapa-interativo ul.navigation li.balancas a").css("background-position", "0 -15px");
                    ucMapaInterativo.Ajax("/Xml/Balancas.xml", null, ucMapaInterativo.LoadScales);
                    break;
            }

            ucMapaInterativo.Ajax("/Xml/Operacao.xml", null, ucMapaInterativo.SetBoxInfoWatherCondition);
            
            //Navegacao Box de Informacoes
            $("#ContentPage .box-info-map .content").hide();
            $("#ContentPage .box-info-map .title").removeClass("title-active");
            $("#ContentPage .info-" + pType + " .content").show();
            $("#ContentPage .info-" + pType + " .title").addClass("title-active");
            $(document).pngFix();
        }
        catch (e) {
            //alert(e);
        }
    }

    //Retorna Posicao conforme Km
    //pKm[0 a 80]
    this.GetPositionByKm = function(pKm, pWidthImg) {
        try {
            var positionLeft = new Number();
            var divisionKm = new Number(113);
            var imgPosition = parseInt(parseInt(pWidthImg) / 2);
            
            positionLeft = ((pKm * 113) / 10) - imgPosition;
            return positionLeft.toString() + "px";
        }
        catch (e) {
            //alert(e);
        }
    }

    //Retorna Posicao do topo
    //pTop[0 a 322]
    this.GetPositionByTop = function(pTop, pWidthImg) {
        try {
            var positionTop = new Number();
            var imgPosition = parseInt(parseInt(pWidthImg) / 2);

            positionTop = parseInt(pTop - imgPosition);
            return positionTop.toString() + "px";
        }
        catch (e) {
            //alert(e);
        }
    }

    //Retorna a posicao por
    //pRoad[Rodovia + Sentido]
    this.GetPositionByRoad = function(pRoad, pHeightImg) {
        try {

            var positionTop = Number();
            var imgPosition = parseInt(parseInt(pHeightImg) / 2);
            switch (pRoad) {
                case "BR-277 Grande Estrada-Curitiba":
                    positionTop = 110;
                    break;
                case "BR-277 Grande Estrada-Paranaguá":
                    positionTop = 185;
                    break;
                default:
                    positionTop = -9000;
                    break;
            }
            
            positionTop = (positionTop - imgPosition);
            return positionTop.toString() + "px";
        }
        catch (e) {
            //alert(e);
        }
    }    

    //Cria box com informacoes do icone selecionado
    // pType[Trafego - ]
    this.CreateBoxInfo = function(pType) {
        try {

            $(document.createElement("div")).addClass("box-info-item").appendTo("#ContentPage .box-mapa-interativo .content-mapa-interativo")
                .hover(function() {
                    clearTimeout(ucMapaInterativo.setTimeOpenBoxInfo);
                },
                function() {
                    ucMapaInterativo.CloseBoxInfo();
                });

            $(document.createElement("div")).addClass("info").appendTo("#ContentPage .box-mapa-interativo .box-info-item");

            if (pType == "Trafego") {
                $(document.createElement("strong")).attr({ id: "MapInfoCarRoadWay" }).addClass("title").appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("br")).appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("span")).text("Trecho: ").appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("strong")).attr({ id: "MapInfoCarZone" }).appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("br")).appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("span")).text("Veículos / hora: ").appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("strong")).attr({ id: "MapInfoCarTime" }).appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("br")).appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("span")).text("Condição: ").appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("strong")).attr({ id: "MapInfoCarCondition" }).appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("br")).appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("a")).attr({ href: "/Mapa-Interativo/Trafego-Tempo-Viagem#idBoxInfo_Trafego", title: "+ detalhes" }).text("+ detalhes").appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
            }
            else if (pType == "Cameras") {
                $(document.createElement("strong")).attr({ id: "MapInfoCamRoad" }).addClass("title").appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("br")).appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("span")).attr({ id: "MapInfoCamIfo" }).appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("br")).appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("a")).attr({ href: "javascript:void(0)", rel: "CameraLiveMap", id: "MapInfoCamLnkImg", alt: "", title: "" }).addClass("lnkFoto").appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("img")).attr({ src: "", id: "MapInfoCamImg", width: "130", height: "89", onError: "this.src='/Themes/" + Main.Theme + "/Img/MapaInterativo/nao-disponivel-camera.jpg';  $(this).parents('a').attr('href', '/Themes/" + Main.Theme + "/Img/MapaInterativo/nao-disponivel-camera-gd.gif')" }).appendTo("#ContentPage .box-mapa-interativo .box-info-item .info .lnkFoto");
                $(document.createElement("br")).appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("a")).attr({ href: "/Mapa-Interativo/Cameras#idBoxInfo_Cameras", title: "+ detalhes" }).text("+ detalhes").appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
            }
            else if (pType == "Clima") {
                $(document.createElement("strong")).attr({ id: "MapInfoWeatherTitle" }).addClass("title").appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("br")).appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("span")).attr({ id: "MapInfoWeatherIfo" }).appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("br")).appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("a")).attr({ href: "Mapa-Interativo/Clima#idBoxInfo_Clima", title: "+ detalhes" }).text("+ detalhes").appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
            }
            else if (pType == "Pedagios") {
                $(document.createElement("strong")).attr({ id: "MapInfoTollTitle" }).addClass("title").appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("br")).appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("span")).attr({ id: "MapInfoTollInfo" }).appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("br")).appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("a")).attr({ href: "/Mapa-Interativo/Pedagios#idBoxInfo_Pedagios", title: "+ detalhes" }).text("+ detalhes").appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
            }
            else if (pType == "Servicos") {
                $(document.createElement("span")).attr({ id: "MapInfoServiceInfo" }).appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("span")).attr({ id: "MapInfoServiceKm" }).addClass("featured").appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("br")).appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("a")).attr({ href: "/Mapa-Interativo/PM-Servicos#idBoxInfo_Servicos", title: "+ detalhes" }).text("+ detalhes").appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
            }
            else if (pType == "Balancas") {
                $(document.createElement("span")).attr({ id: "MapInfoScalesInfo" }).appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("span")).attr({ id: "MapInfoScalesKm" }).addClass("featured").appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("br")).appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
                $(document.createElement("a")).attr({ href: "/Mapa-Interativo/Balancas#idBoxInfo_Balancas", title: "+ detalhes" }).text("+ detalhes").appendTo("#ContentPage .box-mapa-interativo .box-info-item .info");
            }

            $(document.createElement("img")).attr({ src: "/Themes/" + Main.Theme + "/Img/ucMapaInterativo/box-info-tip.png", alt: " " }).addClass("tip").appendTo("#ContentPage .box-mapa-interativo .box-info-item");
        }
        catch (e) {
            //alert(e);
        }
    }

    //Fecha Box de informacoes
    this.CloseBoxInfo = function() {
        try {
            $("#ContentPage .box-mapa-interativo .box-info-item").hide();
            clearTimeout(ucMapaInterativo.setTimeOpenBoxInfo);
        }
        catch (e) {
            //alert(e);
        }

    }

    /**********************
    TRAFEGO / TEMPO VIAGEM
    **********************/

    //Carrega Informacoes de Trafego
    //pContent[Objeto Xml]
    this.LoadTraffic = function(pContent) {
        try {
            var Type = new String("Trafego");
            var arrRunway = new Array();
            arrRunway = Main.TransformStringArray($(pContent).find("operacao").attr("pistas"), "");

            $(pContent).find("rodovias rodovia").each(function(i, e) {

            var positionTop = ucMapaInterativo.GetTrafficPositionByRoad($(e).attr("regiao") + "-" + $(e).attr("sentido"));
            var positionLeft = ucMapaInterativo.GetTrafficPositionByZone($(e).attr("regiao"), $(e).attr("sentido"), $(e).attr("regiao"));

                //Cria instrucoes Css e posicionamento
                var cssObjImg = {
                    'position': "absolute",
                    'top': positionTop,
                    'left': positionLeft,
                    'cursor': "pointer",
                    'zIndex': "10"
                }
                //Cria elemento Img
                $(document.createElement("img"))
                    .attr({ src: ucMapaInterativo.GetTrafficImageName(arrRunway, e), id: Type + "_" + i, alt: " " })
                    .css(cssObjImg)
                    .appendTo("#ContentPage .box-mapa-interativo .content-mapa-interativo")
                    .addClass("item-mapa")
                    .hover(function() {
                        ucMapaInterativo.OpenTrafficInfo(e, cssObjImg, pContent);
                        clearTimeout(ucMapaInterativo.setTimeOpenBoxInfo);
                    },
                    function() {
                        ucMapaInterativo.setTimeOpenBoxInfo = setTimeout(ucMapaInterativo.CloseBoxInfo, 2000);
                    })
                   .click(function() {
                       //location.href = "#idBoxInfo_" + Type;
                   });

                //Cria instrucoes Css e posicionamento do numero
                var cssObjNum = {

                    'position': "absolute",
                    'top': (parseInt(positionTop) + 5) + "px",
                    'left': (parseInt(positionLeft)) + "px",
                    'width': "55px",
                    'textAlign': "center",
                    'fontSize': "12px",
                    'fontWeight': "bold",
                    'color': "#fff",
                    'cursor': "pointer",
                    'zIndex': "20"
                }

                if (ucMapaInterativo.pageMapaInterativo != undefined) {
                    //Cria elemento span com o numero
                    $(document.createElement("span"))
                    .css(cssObjNum)
                    .text(i + 1)
                    .addClass("item-mapa")
                    .appendTo("#ContentPage .box-mapa-interativo .content-mapa-interativo")
                    .hover(function() {
                        ucMapaInterativo.OpenTrafficInfo(e, cssObjImg, pContent);
                        clearTimeout(ucMapaInterativo.setTimeOpenBoxInfo);
                    },
                    function() {
                        ucMapaInterativo.setTimeOpenBoxInfo = setTimeout(ucMapaInterativo.CloseBoxInfo, 2000);
                    })
                   .click(function() {
                       //location.href = "#idBoxInfo_" + Type;
                   });
                }

            });

            ucMapaInterativo.CreateBoxInfo(Type);

            ucMapaInterativo.SetBoxInfoVehiclesPerHour(pContent);
        }
        catch (e) {
            //alert(e);
        }
    }

    //Retorna a posicao do carro por:
    //pRoad[ANCHIETA - IMIGRANTES - CÔNEGO DOMÊNICO RANGONI - PADRE MANOEL DA NOBREGA + Sentido]
    this.GetTrafficPositionByRoad = function(pRoad) {
        try {
            var positionTop = Number();
            switch (pRoad) {
                case "CURITIBA-Curitiba":
                    positionTop = 123;
                    break;
                case "CURITIBA-Paranaguá":
                    positionTop = 140;
                    break;
                case "S. J. DOS PINHAIS-Curitiba":
                    positionTop = 123;
                    break;
                case "S. J. DOS PINHAIS-Paranaguá":
                    positionTop = 140;
                    break;
                case "SERRA-Curitiba":
                    positionTop = 123;
                    break;
                case "SERRA-Paranaguá":
                    positionTop = 140;
                    break;
                case "MORRETES-Curitiba":
                    positionTop = 123;
                    break;
                case "MORRETES-Paranaguá":
                    positionTop = 140;
                    break;
                case "PARANAGUÁ-Curitiba":
                    positionTop = 123;
                    break;
                case "PARANAGUÁ-Paranaguá":
                    positionTop = 140;
                    break;
                case "MATINHOS-Matinhos":
                    positionTop = 170;
                    break;
                case "MATINHOS-Alexandra":
                    positionTop = 180;
                    break;
                case "PONTAL DO PARANÁ-P. Leste":
                    positionTop = 200;
                    break;
                case "PONTAL DO PARANÁ-Alexandra":
                    positionTop = 215;
                    break;

                default:
                    positionTop = -9000;
                    break;
            }
            return positionTop.toString() + "px";
        }
        catch (e) {
            //alert(e);
        }
    }

    //Retorna a posicao do carro por:
    //pZone[PLANALTO - SERRA - BAIXADA]
    //pWay[Sul - Norte - Leste - Oeste]
    //pRoad[ANCHIETA - IMIGRANTES - CÔNEGO DOMÊNICO RANGONI - PADRE MANOEL DA NOBREGA]
    this.GetTrafficPositionByZone = function(pZone, pWay, pRoad) {
        try {
            var positionLeft = Number();
            switch (pRoad) {
                case "CURITIBA":
                    positionLeft = 80;
                    break;
                case "S. J. DOS PINHAIS":
                    positionLeft = 250;
                    break;
                case "SERRA":
                    positionLeft = 400;
                    break;
                case "MORRETES":
                    positionLeft = 530;
                    break;
                case "PARANAGUÁ":
                    positionLeft = 760;
                    break;
                case "MATINHOS":
                    positionLeft = 654;
                    break;
                case "PONTAL DO PARANÁ":
                    positionLeft = 787;
                    break;
                default:
                    positionLeft = -9000;
                    break;
            }
            if (pWay == "Paranaguá") positionLeft = positionLeft + 40;
            if (pWay == "Alexandra") positionLeft = positionLeft + 82;
           

             return positionLeft.toString() + "px";
        }
        catch (e) {
            //alert(e);
        }
    }

    //Retorna o sentido e cor da imagem por
    //pWay[Sul - Norte - Leste - Oeste]
    //pCondition[Bom, Normal, Lento]
    this.GetTrafficImageName = function(pArrRunway, e) {
        try {
            var pathImage = new String("/Themes/" + Main.Theme + "/Img/ucMapaInterativo/");
            var nameImage = new String();
            var conditionType = new String();
            var wayType = (($(e).attr("sentido") == "Paranaguá") || ($(e).attr("sentido") == "Matinhos") || ($(e).attr("sentido") == "P. Leste")) ? "d" : "u";

            if (($(e).attr("regiao") == "Serra"))
                wayType = ucMapaInterativo.GetCarWay(pArrRunway, $(e).attr("nome") + "-" + $(e).attr("sentido"));

            switch ($(e).attr("condicao")) {
                case "Bom":
                    conditionType = "good";
                    break;
                case "Normal":
                    conditionType = "good";
                    break;
                case "Baixo":
                    conditionType = "good";
                    break;
                case "Parcial":
                    conditionType = "normal";
                    break;
                case "Lento":
                    conditionType = "slow";
                    break;
                case "Interditado":
                    conditionType = "slow";
                    break;
                case "Congestionado":
                    conditionType = "slow";
                    break;
                case "Intenso":
                    conditionType = "slow";
                    break;
                case "Alto":
                    conditionType = "slow";
                    break;
                default:
                    conditionType = "slow";
                    break;
            }
            nameImage = "ico-car-" + conditionType + "-" + wayType + ".png";

            return pathImage + nameImage;
        }
        catch (e) {
            //alert(e);
        }
    }

    //Abre modal com informacoes do trafego
    //pObj[objeto Fluxo] 
    //pCssObj[objeto css da img carro]
    this.OpenTrafficInfo = function(pObj, pCssObj, pContent) {
        try {
            $("#MapInfoCarRoadWay").text("Rodovia " + $(pObj).attr("nome"));
            $("#MapInfoCarZone").text($(pObj).attr("regiao"));


            //alert($(pObj).attr("regiao"));
            if (($(pObj).attr("regiao") == "S. J. DOS PINHAIS"))
                $("#MapInfoCarTime").text(ucMapaInterativo.GetInfoVehiclesPerHour(pContent, "São José dos Pinhais", $(pObj).attr("sentido")));
            else
                $("#MapInfoCarTime").text("N/D");

            $("#MapInfoCarCondition").text($(pObj).attr("condicao"));

            $("#ContentPage .box-mapa-interativo .box-info-item").css({
                'top': parseInt(pCssObj.top) - $("#ContentPage .box-mapa-interativo .box-info-item").height() - 7,
                'left': pCssObj.left
            }).show();
        }
        catch (e) {
            //alert(e);
        }
    }

    //Pega no Xml informacoes de quantidade de veiculos por hora
    this.GetInfoVehiclesPerHour = function(pContent, pRoad, pWay) {
        try {
            return $(pContent).find("rodovias_fluxo rodovia[nome*='" + pRoad.toString() + "'] fluxos fluxo[sentido*='" + pWay.toString() + "']").attr("valor");
        }
        catch (e) {
            //alert(e);
        }
    }

	//Pega no Xml informacoes de quantidade de veiculos por hora
    this.GetInfoVehiclesPerHourTraffic = function(pContent, pRoad, pWay) {
        try {
            return $(pContent).find("rodovias_fluxo rodovia[nome*='" + pRoad.toString() + "'] fluxos fluxo[sentido*='" + pWay.toString() + "']").attr("condicao");
        }
        catch (e) {
            //alert(e);
        }
    }
	
	
    //Pega no Xml informacoes da condicao do trafego
    this.GetInfoConditionTraffic = function(pContent, pRoad, pWay) {
        try {
            var condicao = new String();
            $(pContent).find("rodovias rodovia[regiao*='" + pRoad.toString() + "']").each(function(i, e) {
                if ($(e).attr("sentido") == pWay) {
                    condicao = $(e).attr("condicao");
                }
            });
            return condicao;
        }
        catch (e) {
            //alert(e);
        }
    }

    // Seta informacao no box de quantidade de veiculos por hora
    this.SetBoxInfoVehiclesPerHour = function(pContent) {
        try {
            //Condicoes da estrada
            //$(".condicoes-estradas .road-pinhais .veiculo-curitiba").text(ucMapaInterativo.GetInfoConditionTraffic(pContent, "S. J. DOS PINHAIS", "Curitiba") + " " + ucMapaInterativo.GetInfoVehiclesPerHour(pContent, "São José dos Pinhais", "Curitiba"));
            //$(".condicoes-estradas .road-pinhais .veiculo-paranagua").text(ucMapaInterativo.GetInfoConditionTraffic(pContent, "S. J. DOS PINHAIS", "Paranaguá") + " " + ucMapaInterativo.GetInfoVehiclesPerHour(pContent, "São José dos Pinhais", "Paranaguá"));
            $(".condicoes-estradas .road-pinhais .veiculo-curitiba").text(ucMapaInterativo.GetInfoVehiclesPerHourTraffic(pContent, "São José dos Pinhais", "Curitiba") + " " + ucMapaInterativo.GetInfoVehiclesPerHour(pContent, "São José dos Pinhais", "Curitiba"));
            $(".condicoes-estradas .road-pinhais .veiculo-paranagua").text(ucMapaInterativo.GetInfoVehiclesPerHourTraffic(pContent, "São José dos Pinhais", "Paranaguá") + " " + ucMapaInterativo.GetInfoVehiclesPerHour(pContent, "São José dos Pinhais", "Paranaguá"));

            
            //Mapa Interativo
            $(".box-veiculos-hora .road-pinhais .veiculo-curitiba").text(ucMapaInterativo.GetInfoVehiclesPerHour(pContent, "São José dos Pinhais", "Curitiba") + " veículos / hora");
            $(".box-veiculos-hora .road-pinhais .veiculo-paranagua").text(ucMapaInterativo.GetInfoVehiclesPerHour(pContent, "São José dos Pinhais", "Paranaguá") + " veículos / hora");
        }
        catch (e) {
            //alert(e);
        }
    }
       
    /**********************
    CAMERAS
    **********************/

    //Carrega Informacoes das Cameras
    //pContent[Objeto Xml]
    this.LoadCamera = function(pContent) {
        try {
            var Type = new String("Cameras");
            $(pContent).find("camera").each(function(i, e) {
                var positionTop = ucMapaInterativo.GetPositionByTop($(e).attr("positionTop"), "25px");
                var positionLeft = ucMapaInterativo.GetPositionByKm($(e).attr("km"), "50px");
            
                //Cria instrucoes Css e posicionamento da imagem
                var cssObjImg = {
                    'position': "absolute",
                    'top': positionTop,
                    'left': positionLeft,
                    'cursor': "pointer",
                    'zIndex': "10"
                }

                //Cria elemento Img
                $(document.createElement("img"))
                    .attr({ src: ucMapaInterativo.GetCameraImageName(), id: Type + "_" + i, alt: " " })
                    .css(cssObjImg)
                    .appendTo("#ContentPage .box-mapa-interativo .content-mapa-interativo")
                    .hover(function() {
                        ucMapaInterativo.OpenCameraInfo(e, cssObjImg);
                        clearTimeout(ucMapaInterativo.setTimeOpenBoxInfo);
                    },
                    function() {
                        ucMapaInterativo.setTimeOpenBoxInfo = setTimeout(ucMapaInterativo.CloseBoxInfo, 2000);
                    })
                   .click(function() {
                       //location.href = "#idBoxInfo_" + Type;
                   });

                //Cria instrucoes Css e posicionamento do numero
                var cssObjNum = {

                    'position': "absolute",
                    'top': (parseInt(positionTop) + 5) + "px",
                    'left': (parseInt(positionLeft) + 17) + "px",
                    'fontSize': "12px",
                    'fontWeight': "bold",
                    'color': "#fff",
                    'cursor': "pointer",
                    'zIndex': "20"
                }
                //Cria elemento span com o numero
                if (ucMapaInterativo.pageMapaInterativo != undefined) {
                    $(document.createElement("span"))
                    .css(cssObjNum)
                    .text(i + 1)
                    .appendTo("#ContentPage .box-mapa-interativo .content-mapa-interativo")
                    .hover(function() {
                        ucMapaInterativo.OpenCameraInfo(e, cssObjImg);
                        clearTimeout(ucMapaInterativo.setTimeOpenBoxInfo);
                    },
                    function() {
                        ucMapaInterativo.setTimeOpenBoxInfo = setTimeout(ucMapaInterativo.CloseBoxInfo, 2000);
                    })
                   .click(function() {
                       //location.href = "#idBoxInfo_" + Type;
                    });
                }
            });
            ucMapaInterativo.CreateBoxInfo(Type);
        }
        catch (e) {
            //alert(e);
        }
    }
    
    //Retorna a posicao da camera por:
    //pRoad[ANCHIETA - IMIGRANTES - CÔNEGO DOMÊNICO RANGONI - PADRE MANOEL DA NOBREGA]
    this.GetCameraPositionByRoad = function(pRoad) {
        try {

            var positionTop = Number();

            switch (pRoad.toString().toUpperCase()) {
                case "Grande Estrada":
                    positionTop = 135;
                    break;
                case "Grande Estrada":
                    positionTop = 135;
                    break;
                default:
                    positionTop = -9000;
                    break;
            }
           
            return positionTop.toString() + "px";
        }
        catch (e) {
            //alert(e);
        }
    }
    
    //Retorna caminho da image camera:
    this.GetCameraImageName = function() {
        try {
            return new String("/Themes/" + Main.Theme + "/Img/ucMapaInterativo/camera.png");
        }
        catch (e) {
            //alert(e);
        }
    }

    //Abre modal com informacoes do trafego
    //pObj[objeto Fluxo] 
    //pCssObj[objeto css da img carro]
    this.OpenCameraInfo = function(pObj, pCssObj) {
    try {
            $("#MapInfoCamImg").attr("src", "-");
            
            $("#MapInfoCamRoad").text($(pObj).attr("rodovia"));
            $("#MapInfoCamLnkImg").attr("href", "/Content/Cameras/" + $(pObj).attr("img")).attr("title", $(pObj).attr("trecho"));
            $("#MapInfoCamImg").attr("src", "/Content/Cameras/" + $(pObj).attr("img"));
            $("#MapInfoCamIfo").text($(pObj).attr("trecho") + " / Km " + $(pObj).attr("kmExibe"));

            $("a[rel='CameraLiveMap']").colorbox();
            
            $("#ContentPage .box-mapa-interativo .box-info-item").css({
                'top': parseInt(pCssObj.top) - $("#ContentPage .box-mapa-interativo .box-info-item").height() - 7,
                'left': pCssObj.left
            }).show();
        }
        catch (e) {
            //alert(e);
        }
    }


    /**********************
    CLIMA
    **********************/

    //Carrega Informacoes do Clima
    //pContent[Objeto Xml]
    this.LoadWeather = function(pContent) {
        try {
            var Type = new String("Clima");
            $(pContent).find("tempo").each(function(i, e) {
                
                //Cria instrucoes Css e posicionamento da imagem
                var cssObjImg = {
                    'position': "absolute",
                    'top': ucMapaInterativo.GetWeatherPositionTopByZone($(e).attr("local")) + "px",
                    'left': ucMapaInterativo.GetWeatherPositionByZone($(e).attr("local")),
                    'cursor': "pointer",
                    'zIndex': "10"
                }

                var objWeather = ucMapaInterativo.GetWeatherObj($(e).attr("condicao"), $(e).attr("local"));

                //Cria elemento Img
                $(document.createElement("img"))
                    .attr({ src: objWeather.ImagePath + objWeather.ImageName, id: Type + "_" + i, alt: " " })
                    .css(cssObjImg)
                    .appendTo("#ContentPage .box-mapa-interativo .content-mapa-interativo")
                    .hover(function() {
                        ucMapaInterativo.OpenWeatherInfo(objWeather, cssObjImg);
                        clearTimeout(ucMapaInterativo.setTimeOpenBoxInfo);
                    },
                    function() {
                        ucMapaInterativo.setTimeOpenBoxInfo = setTimeout(ucMapaInterativo.CloseBoxInfo, 2000);
                    })
                   .click(function() {
                       //location.href = "#idBoxInfo_" + Type;
                   });
            });
            ucMapaInterativo.CreateBoxInfo(Type);
        }
        catch (e) {
            //alert(e);
        }
    }
    
    //Retorna Objeto de Clima
    //pId[1 a 6]
    //pId[Planalto - Serra - Baixada]
    this.GetWeatherObj = function(pId, pZone) {
        try {
            var obj = new Object();
            obj.ImagePath = new String("/Themes/" + Main.Theme + "/Img/WidgetPrevisaoTempo/")
            obj.ImageName = new String();
            obj.Legend = new String();
            obj.Zone = new String();
            
            switch (parseInt(pId)) {
                case 1:
                    obj.Legend = "Bom";
                    obj.Zone = pZone;
                    obj.ImageName = (ucMapaInterativo.DateHourNow <= 5 || ucMapaInterativo.DateHourNow >= 19) ? "ico-weather-2n.png" : "ico-weather-2.png";
                    break;
                case 2:
                    obj.Legend = "Com Chuva";
                    obj.Zone = pZone;
                    obj.ImageName = (ucMapaInterativo.DateHourNow <= 5 || ucMapaInterativo.DateHourNow >= 19) ? "ico-weather-5n.png" : "ico-weather-5.png";
                    break;
                case 3:
                    obj.Legend = "Com Garoa";
                    obj.Zone = pZone;
                    obj.ImageName = (ucMapaInterativo.DateHourNow <= 5 || ucMapaInterativo.DateHourNow >= 19) ? "ico-weather-4rn.png" : "ico-weather-4r.png";
                    break;
                case 4:
                    obj.Legend = "Com Neblina";
                    obj.Zone = pZone;
                    obj.ImageName = (ucMapaInterativo.DateHourNow <= 5 || ucMapaInterativo.DateHourNow >= 19) ? "ico-weather-9.png" : "ico-weather-9.png";
                    break;
                case 5:
                    obj.Legend = "Com Sol";
                    obj.Zone = pZone;
                    obj.ImageName = (ucMapaInterativo.DateHourNow <= 5 || ucMapaInterativo.DateHourNow >= 19) ? "ico-weather-1n.png" : "ico-weather-1.png";
                    break;
                case 6:
                    obj.Legend = "Encoberto";
                    obj.Zone = pZone;
                    obj.ImageName = (ucMapaInterativo.DateHourNow <= 5 || ucMapaInterativo.DateHourNow >= 19) ? "ico-weather-3n.png" : "ico-weather-3.png";
                    break;
                case 7:
                    obj.Legend = "Neblina/Chuva";
                    obj.Zone = pZone;
                    obj.ImageName = (ucMapaInterativo.DateHourNow <= 5 || ucMapaInterativo.DateHourNow >= 19) ? "ico-weather-9.png" : "ico-weather-9.png";
                    break;                    
            }
            return obj;

        }
        catch (e) {
            //alert(e);
        }
    }
    
    //Retorna Posicao da imagem
    //pId[Planalto - Serra - Baixada]
    this.GetWeatherPositionByZone = function(pZone) {
        try {
            var positionLeft = new String();
            
            switch (pZone.toString()) {
                case "Curitiba":
                    positionLeft = this.GetPositionByKm("5", "40");
                    break;
                case "S. J. dos Pinhais":
                    positionLeft = this.GetPositionByKm("15", "40");
                    break;
                case "Morretes":
                    positionLeft = this.GetPositionByKm("45", "40");
                    break;
                case "Serra":
                    positionLeft = this.GetPositionByKm("30", "40");
                    break;
                case "Paranaguá":
                    positionLeft = this.GetPositionByKm("74", "40");
                    break;
                case "Matinhos":
                    positionLeft = this.GetPositionByKm("70", "40");
                    break;
                case "Pontal do Paraná":
                    positionLeft = this.GetPositionByKm("74", "40");
                    break;
                default:
                    positionLeft = -9000;
                    break;
            }
            return positionLeft.toString();

        }
        catch (e) {
            //alert(e);
        }
    }

    //Retorna Posicao da imagem
    //pId[Planalto - Serra - Baixada]
    this.GetWeatherPositionTopByZone = function(pZone) {
        try {
            
            var positionTop = new String();
            switch (pZone.toString()) {

                case "Curitiba":
                    positionTop = 100;
                    break;
                case "S. J. dos Pinhais":
                    positionTop = 100;
                    break;
                case "Morretes":
                    positionTop = 70;
                    break;
                case "Serra":
                    positionTop = 100;
                    break;
                case "Paranaguá":
                    positionTop = 100;
                    break;
                case "Matinhos":
                    positionTop = 220;
                    break;
                case "Pontal do Paraná":
                    positionTop = 180;
                    break;
                default:
                    positionTop = -9000;
                    break;
            }
            return positionTop.toString();

        }
        catch (e) {
            //alert(e);
        }
    }    

    //Abre modal com informacoes do Clima
    //pObj[objeto Fluxo] 
    //pCssObj[objeto css da img carro]
    this.OpenWeatherInfo = function(pObj, pCssObj) {
    try {
            $("#MapInfoWeatherTitle").text(pObj.Zone);
            $("#MapInfoWeatherIfo").text(pObj.Legend);

            $("#ContentPage .box-mapa-interativo .box-info-item").css({
                'top': parseInt(pCssObj.top) - $("#ContentPage .box-mapa-interativo .box-info-item").height() - 7,
                'left': pCssObj.left
            }).show();
        }
        catch (e) {
            //alert(e);
        }
    }

    //Pega no Xml informacoes de clima na regiao
    this.GetInfoWatherCondition = function(pContent, pZone) {
        try {
            var id = $(pContent).find("tempos tempo[local*='" + pZone.toString() + "']").attr("condicao");
            return ucMapaInterativo.GetWeatherObj(id, pZone);
        }
        catch (e) {
            alert(e);
        }
    }

    //Seta informacao no box de condicoes do tempo na home do site
    this.SetBoxInfoWatherCondition = function(pContent) {
    try {
            //Curitiba
            var objCuritiba = ucMapaInterativo.GetInfoWatherCondition(pContent, "Curitiba");
            $(".condicoes-tempo .road-curitiba .clima-imagem").attr("src", objCuritiba.ImagePath + objCuritiba.ImageName).attr("alt", objCuritiba.Legend).attr("title", objCuritiba.Legend);
            $(".condicoes-tempo .road-curitiba .clima-legenda").text(objCuritiba.Legend);
            //S. J. dos Pinhais
            var objSJPinhais = ucMapaInterativo.GetInfoWatherCondition(pContent, "S. J. dos Pinhais");
            $(".condicoes-tempo .road-pinhais .clima-imagem").attr("src", objSJPinhais.ImagePath + objSJPinhais.ImageName).attr("alt", objSJPinhais.Legend).attr("title", objSJPinhais.Legend);
            $(".condicoes-tempo .road-pinhais .clima-legenda").text(objSJPinhais.Legend);
            //Serra
            var objSerra = ucMapaInterativo.GetInfoWatherCondition(pContent, "Serra");
            $(".condicoes-tempo .road-serra .clima-imagem").attr("src", objSerra.ImagePath + objSerra.ImageName).attr("alt", objSerra.Legend).attr("title", objSerra.Legend);
            $(".condicoes-tempo .road-serra .clima-legenda").text(objSerra.Legend);
            //Morretes
            var objMorretes = ucMapaInterativo.GetInfoWatherCondition(pContent, "Morretes");
            $(".condicoes-tempo .road-morretes .clima-imagem").attr("src", objMorretes.ImagePath + objMorretes.ImageName).attr("alt", objMorretes.Legend).attr("title", objMorretes.Legend);
            $(".condicoes-tempo .road-morretes .clima-legenda").text(objMorretes.Legend);
            //Paranaguá
            var objParanagua = ucMapaInterativo.GetInfoWatherCondition(pContent, "Paranaguá");
            $(".condicoes-tempo .road-paranagua .clima-imagem").attr("src", objParanagua.ImagePath + objParanagua.ImageName).attr("alt", objParanagua.Legend).attr("title", objParanagua.Legend);
            $(".condicoes-tempo .road-paranagua .clima-legenda").text(objParanagua.Legend);
            //Matinhos
            var objMatinhos = ucMapaInterativo.GetInfoWatherCondition(pContent, "Matinhos");
            $(".condicoes-tempo .road-matinhos .clima-imagem").attr("src", objMatinhos.ImagePath + objMatinhos.ImageName).attr("alt", objMatinhos.Legend).attr("title", objMatinhos.Legend);
            $(".condicoes-tempo .road-matinhos .clima-legenda").text(objMatinhos.Legend);
            //Ponta
            var objPonta = ucMapaInterativo.GetInfoWatherCondition(pContent, "Pontal do Paraná");
            $(".condicoes-tempo .road-ponta .clima-imagem").attr("src", objPonta.ImagePath + objPonta.ImageName).attr("alt", objPonta.Legend).attr("title", objPonta.Legend);
            $(".condicoes-tempo .road-ponta .clima-legenda").text(objPonta.Legend);
        }
        catch (e) {
            alert(e);
        }
    }




    /**********************
    PEDAGIO
    **********************/
    //Carrega Informacoes das Cameras
    //pContent[Objeto Xml]
    this.LoadToll = function(pContent) {
        try {
            var Type = new String("Pedagios");
            $(pContent).find("pedagio").each(function(i, e) {
                var positionTop = ucMapaInterativo.GetPositionByRoad($(e).attr("rodovia") + "-" + $(e).attr("sentido"), "28px");
                var positionLeft = ucMapaInterativo.GetPositionByKm($(e).attr("km"), "27px");

                //Cria instrucoes Css e posicionamento da imagem
                var cssObjImg = {
                    'position': "absolute",
                    'top': positionTop,
                    'left': positionLeft,
                    'cursor': "pointer",
                    'zIndex': "10"
                }

                //Cria elemento Img
                $(document.createElement("img"))
                    .attr({ src: ucMapaInterativo.GetTollImageName($(e).attr("status")), id: Type + "_" + i, alt: " " })
                    .css(cssObjImg)
                    .appendTo("#ContentPage .box-mapa-interativo .content-mapa-interativo")
                    .hover(function() {
                        ucMapaInterativo.OpenTollInfo(e, cssObjImg);
                        clearTimeout(ucMapaInterativo.setTimeOpenBoxInfo);
                    },
                    function() {
                        ucMapaInterativo.setTimeOpenBoxInfo = setTimeout(ucMapaInterativo.CloseBoxInfo, 2000);
                    })
                   .click(function() {
                       //location.href = "#idBoxInfo_" + Type;
                   });
            });
            ucMapaInterativo.CreateBoxInfo(Type);

            ucMapaInterativo.CreateTollMaskRoad("135px", "325px", "13px");
            ucMapaInterativo.CreateTollMaskRoad("151px", "325px", "13px");
        }
        catch (e) {
            //alert(e);
        }
    }

    //Retorna caminho da image do pedagio
    this.GetTollImageName = function(pStatus) {
        try {
            var ImagePath = new String("/Themes/" + Main.Theme + "/Img/ucMapaInterativo/");
            var ImageName = new String();
            ImageName = (pStatus == "ABERTO") ? "ico-toll-open.png" : "ico-toll-close.png";

            return ImagePath + ImageName;
        }
        catch (e) {
            //alert(e);
        }
    }

    //Abre modal com informacoes
    //pObj[objeto Fluxo] 
    //pCssObj[objeto css da img carro]
    this.OpenTollInfo = function(pObj, pCssObj) {
        try {
            $("#MapInfoTollTitle").text($(pObj).attr("rodovia"));
            $("#MapInfoTollInfo").text($(pObj).attr("trecho"));

            $("#ContentPage .box-mapa-interativo .box-info-item").css({
                'top': parseInt(pCssObj.top) - $("#ContentPage .box-mapa-interativo .box-info-item").height() - 7,
                'left': pCssObj.left
            }).show();
        }
        catch (e) {
            //alert(e);
        }
    }

    //Cria mascara de pedagio
    this.CreateTollMaskRoad = function(pPositionTop, pPositionLeft, pHeight) {
        try {
            var cssObjImg = {
                'display': "block",
                'position': "absolute",
                'top': pPositionTop,
                'left': pPositionLeft,
                'width': "6px",
                'height': pHeight,
                'backgroundColor': "#484a4d",
                'zIndex': "10"
            }

            //Cria elemento Img
            $(document.createElement("span"))
                    .css(cssObjImg)
                    .appendTo("#ContentPage .box-mapa-interativo .content-mapa-interativo");
        }
        catch (e) {
            //alert(e);
        }
    }

    /**********************
    PM / SERVICOS
    **********************/
    //Carrega Informacoes das Servico
    //pContent[Objeto Xml]
    this.LoadServices = function(pContent) {
        try {
            var Type = new String("Servicos");
            $(pContent).find("servico").each(function(i, e) {
            var positionTop = ucMapaInterativo.GetPositionByTop($(e).attr("positionTop"), "22px");
                var positionLeft = ucMapaInterativo.GetPositionByKm($(e).attr("km"), "27px");

                //Cria instrucoes Css e posicionamento da imagem
                var cssObjDiv = {
                    'position': "absolute",
                    'top': positionTop,
                    'left': positionLeft,
                    'cursor': "pointer",
                    'zIndex': "10"
                }

                var arrTipos = new Array();
                arrTipos = Main.TransformStringArray($(e).attr("tipo"), ",");

                //Cria elemento Img
                $(document.createElement("div"))
                    .attr({ id: Type + "_" + i })
                    .css(cssObjDiv)
                    .appendTo("#ContentPage .box-mapa-interativo .content-mapa-interativo")
                    .hover(function() {
                        ucMapaInterativo.OpenServicesInfo(e, cssObjDiv);
                        clearTimeout(ucMapaInterativo.setTimeOpenBoxInfo);
                    },
                    function() {
                        ucMapaInterativo.setTimeOpenBoxInfo = setTimeout(ucMapaInterativo.CloseBoxInfo, 2000);
                    });

                ucMapaInterativo.SetServicesImagens(arrTipos, Type + "_" + i);
            });
            ucMapaInterativo.CreateBoxInfo(Type);
        }
        catch (e) {
            //alert(e);
        }
    }

    //Seta as imagens no box de cadas servico
    this.SetServicesImagens = function(pArrTypeImg, pObjParent) {
        try {
            for (var i = 0; i < pArrTypeImg.length; i++) {
                
                //Cria instrucoes Css e posicionamento da imagem
                var cssObjImg = {
                    'display': "block",
                    'float': "left"
                }
                
                //Cria elemento Img
                $(document.createElement("img"))
                    .attr({ src: ucMapaInterativo.GetServicesImageName(pArrTypeImg[i]), alt: " " })
                    .css(cssObjImg)
                    .appendTo("#ContentPage .box-mapa-interativo .content-mapa-interativo #" + pObjParent);
            }
        }
        catch (e) {
            //alert(e);
        }
    }
  
     //Retorna caminho da image servico
    this.GetServicesImageName = function(pType) {
        try {
            var ImagePath = new String("/Themes/" + Main.Theme + "/Img/ucMapaInterativo/");
            var ImageName = new String();

            switch (pType.toString().trim()) {
                case "Restaurante":
                    ImageName = "ico-serv-restaurant.png";
                    break;
                case "Posto":
                    ImageName = "ico-serv-gas.png";
                    break;
                case "GNV":
                    ImageName = "ico-serv-gnv.png";
                    break;
                case "WC":
                    ImageName = "ico-serv-wc.png";
                    break;
                case "PM":
                    ImageName = "ico-pm.png";
                    break;
                case "PF":
                    ImageName = "ico-pf.png";
                    break;
                case "PE":
                    ImageName = "ico-pe.png";
                    break;
                case "SAU":
                    ImageName = "ico-serv-sau.png";
                    break;
            }
            
            return ImagePath + ImageName;
        }
        catch (e) {
            //alert(e);
        }
    }
    
     //Abre modal com informacoes do servico
    //pObj[objeto Fluxo] 
    //pCssObj[objeto css da img carro]
    this.OpenServicesInfo = function(pObj, pCssObj) {
        try {
            
            $("#MapInfoServiceInfo").text($(pObj).attr("nome") + ": ");
            $("#MapInfoServiceKm").text("Km " + $(pObj).attr("kmExibe"));

            $("#ContentPage .box-mapa-interativo .box-info-item").css({
                'top': parseInt(pCssObj.top) - $("#ContentPage .box-mapa-interativo .box-info-item").height() - 7,
                'left': pCssObj.left
            }).show();
        }
        catch (e) {
            //alert(e);
        }
    }

    /**********************
    BALANCA
    **********************/
    //Carrega Informacoes das Servico
    //pContent[Objeto Xml]
    this.LoadScales = function(pContent) {
        try {
            var Type = new String("Balancas");
            $(pContent).find("balanca").each(function(i, e) {
                var positionTop = ucMapaInterativo.GetPositionByRoad($(e).attr("rodovia") + "-" + $(e).attr("sentido"), "45px");
                var positionLeft = ucMapaInterativo.GetPositionByKm($(e).attr("km"), "69px");
                //Cria instrucoes Css e posicionamento da imagem
                var cssObjImg = {
                    'position': "absolute",
                    'top': positionTop,
                    'left': positionLeft,
                    'cursor': "pointer",
                    'zIndex': "10"
                }

                //Cria elemento Img
                $(document.createElement("img"))
                    .attr({ src: ucMapaInterativo.GetScalesImageName($(e).attr("sentido")), id: Type + "_" + i, alt: " " })
                    .css(cssObjImg)
                    .appendTo("#ContentPage .box-mapa-interativo .content-mapa-interativo")
                    .hover(function() {
                        ucMapaInterativo.OpenScalesInfo(e, cssObjImg);
                        clearTimeout(ucMapaInterativo.setTimeOpenBoxInfo);
                    },
                    function() {
                        ucMapaInterativo.setTimeOpenBoxInfo = setTimeout(ucMapaInterativo.CloseBoxInfo, 2000);
                    })
                   .click(function() {
                       //location.href = "#idBoxInfo_" + Type;
                   });
            });
            ucMapaInterativo.CreateBoxInfo(Type);
        }
        catch (e) {
            //alert(e);
        }
    }

    //Retorna caminho da image servico
    this.GetScalesImageName = function(pWay) {
        try {
            var ImagePath = new String("/Themes/" + Main.Theme + "/Img/ucMapaInterativo/");
            var ImageName = (pWay == "Paranaguá") ? "ico-Truck-d.png" : "ico-Truck-u.png";

            return ImagePath + ImageName;
        }
        catch (e) {
            //alert(e);
        }
    }

    //Abre modal com informacoes do servico
    //pObj[objeto Fluxo] 
    //pCssObj[objeto css da img carro]
    this.OpenScalesInfo = function(pObj, pCssObj) {
        try {
            $("#MapInfoScalesInfo").text($(pObj).attr("nome") + ": ");
            $("#MapInfoScalesKm").text("Km " + $(pObj).attr("kmExibe"));

            $("#ContentPage .box-mapa-interativo .box-info-item").css({
                'top': parseInt(pCssObj.top) - $("#ContentPage .box-mapa-interativo .box-info-item").height() - 7,
                'left': pCssObj.left
            }).show();
        }
        catch (e) {
            //alert(e);
        }
    }

