﻿//Cria um mapa indicando a localização da PPC Santana no Brasil
function GetRoadMap() {
    var map = null;
    var mapStyle = VEMapStyle.Shaded;
    var fixed = false;
    var mapMode = VEMapMode.Mode2D;
    var showSwitch = false;
    var pin = null;

    map = new VEMap('RoadMap');

    var mapOptions = new VEMapOptions();
    mapOptions.EnableBirdseye = false;
    mapOptions.EnableDashboardLabels = false;

    map.LoadMap(new VELatLong(-22.7087, -46.9155), 10, mapStyle, fixed, mapMode, showSwitch, mapOptions);
    map.SetScaleBarDistanceUnit(VEDistanceUnit.Kilometers);

    pin = new VEShape(VEShapeType.Pushpin, new VELatLong(-22.7087, -46.9155));
    pin.SetTitle("Pedreira, SP");
    pin.SetDescription("PPC Santana<br>Rua Antônio Pedro, 645 - Centro<br>CEP 13920-000<br>Tel. 19 3893 3666<br>Fax 19 3893 2122");
    pin.SetCustomIcon("<span style='font-family: Verdana, Arial, Sans-Serif; font-size: x-small;" +
                      "color: Black; background-color: Transparent'>" +
                      "<img src='images/commom_images/pin.gif'/></span>");

    map.AddShape(pin);
}

//Cria um mapa indicando a localização dos representantes da PPC Santana no mundo
function GetWorldMap() {
    var map = null;
    var mapstyle = VEMapStyle.Shaded;
    var fixed = false;
    var mode = VEMapMode.Mode2D;
    var showSwitch = false;
    var tileBuffer = 0;
    var pin = null;

    map = new VEMap('WorldMap');

    var mapOptions = new VEMapOptions();
    mapOptions.EnableBirdseye = false;
    mapOptions.EnableDashboardLabels = false;

    map.LoadMap(new VELatLong(22, 20), 2, mapstyle, fixed, mode, showSwitch, tileBuffer, mapOptions);
    map.SetScaleBarDistanceUnit(VEDistanceUnit.Kilometers);

//    pin = new VEShape(VEShapeType.Pushpin, new VELatLong(-22.737398, -46.895399));
//    pin.SetTitle("Pedreira, SP");
//    pin.SetDescription("PPC Santana<br>Rua Antônio Pedro, 645 - Centro<br>CEP 13920-000<br>Tel. 19 3893 3666<br>Fax 19 3893 2122");
//    pin.SetCustomIcon("<span style='font-family: Verdana, Arial, Sans-Serif; font-size: x-small;" +
//                      "color: Black; background-color: Transparent'>" +
//                      "<img src='images/commom_images/pin.gif'/></span>");

//    map.AddShape(pin);
}

//Carrega o mapa de acordo com a página selecionada
function LoadMap() {
    var sPath = window.location.pathname;
    var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
    //alert(sPage);
    if (sPage == "Localizacao.aspx") {
        GetRoadMap();
    }
    //if (sPage == "Representantes.aspx") {
        //GetWorldMap();
    //}
}