﻿var Source =
{
    Society     : 1,
    Solution    : 2,
    Role        : 3,
    Contact     : 4
}

function Show(source) {
    switch (source) {
        case Source.Society:
            if (document.getElementById("ContentPlaceHolder1_Panel1") != null && document.getElementById("MenuSociety") != null) {
                document.getElementById("MenuSociety").setAttribute("class", "Float_MenuLeft");
                //document.getElementById("ContentPlaceHolder1_ImbSocietyEmpty").setAttribute("src", "../Images/SquareSociety.png");
                document.getElementById("ContentPlaceHolder1_Panel1").setAttribute("class", "Panel1");
            }
            break;

        case Source.Solution:
            if (document.getElementById("ContentPlaceHolder1_Panel2") != null != null && document.getElementById("MenuSolution") != null) {
                document.getElementById("MenuSolution").setAttribute("class", "Float_MenuLeft");
                document.getElementById("ContentPlaceHolder1_Panel2").setAttribute("class", "Panel2");
                //document.getElementById("ContentPlaceHolder1_ImbSolutionEmpty").setAttribute("src", "../Images/SquareSolution.png");
            }
            break;

        case Source.Role:
            if (document.getElementById("ContentPlaceHolder1_Panel3") != null != null && document.getElementById("MenuRole") != null) {
                document.getElementById("MenuRole").setAttribute("class", "Float_MenuLeft");
                document.getElementById("ContentPlaceHolder1_Panel3").setAttribute("class", "Panel3");
                //document.getElementById("ContentPlaceHolder1_ImbRoleEmpty").setAttribute("src", "../Images/SquareRole.png");
            }
            break;

        case Source.Contact:
            if (document.getElementById("ContentPlaceHolder1_Panel4") != null && document.getElementById("MenuContactUs") != null) {
                document.getElementById("MenuContactUs").setAttribute("class", "Float_MenuLeft");
                document.getElementById("ContentPlaceHolder1_Panel4").setAttribute("class", "Panel4");
                //ocument.getElementById("ContentPlaceHolder1_ImbContactEmpty").setAttribute("src", "../Images/SquareContact.png");
            }
            break;
    }
}

function UnShow(source) {
    switch (source) {
        case Source.Society:
            if (document.getElementById("ContentPlaceHolder1_Panel1") != null && document.getElementById("MenuSociety") != null) {
                document.getElementById("MenuSociety").setAttribute("class", "Float_MenuLeftHidden");
                document.getElementById("ContentPlaceHolder1_Panel1").setAttribute("class", "Panel1Hidden");
//                document.getElementById("ContentPlaceHolder1_ImbSocietyEmpty").setAttribute("src", "../Images/SquareSocietyEmpty.png");
            }
            break;

        case Source.Solution:
            if (document.getElementById("ContentPlaceHolder1_Panel2") != null && document.getElementById("MenuSolution") != null) {
                document.getElementById("MenuSolution").setAttribute("class", "Float_MenuLeftHidden");
                document.getElementById("ContentPlaceHolder1_Panel2").setAttribute("class", "Panel2Hidden");
                //document.getElementById("ContentPlaceHolder1_ImbSolutionEmpty").setAttribute("src", "../Images/SquareSolutionEmpty.png");
            }
            break;

        case Source.Role:
            if (document.getElementById("ContentPlaceHolder1_Panel3") != null && document.getElementById("MenuRole") != null) {
                document.getElementById("MenuRole").setAttribute("class", "Float_MenuLeftHidden");
                document.getElementById("ContentPlaceHolder1_Panel3").setAttribute("class", "Panel3Hidden");
                //document.getElementById("ContentPlaceHolder1_ImbRoleEmpty").setAttribute("src", "../Images/SquareRoleEmpty.png");
            }
            break;

        case Source.Contact:
            if (document.getElementById("ContentPlaceHolder1_Panel4") != null && document.getElementById("MenuContactUs") != null) {
                document.getElementById("MenuContactUs").setAttribute("class", "Float_MenuLeftHidden");
                document.getElementById("ContentPlaceHolder1_Panel4").setAttribute("class", "Panel4Hidden");
                //document.getElementById("ContentPlaceHolder1_ImbContactEmpty").setAttribute("src", "../Images/SquareContactEmpty.png");
            }
            break;
    }
}

function UnShowAllMenu() {
    if (document.getElementById("MenuSociety") != null && document.getElementById("MenuSolution") != null && document.getElementById("MenuRole") != null && document.getElementById("MenuContactUs") != null) {
        document.getElementById("MenuSociety").setAttribute("class", "Float_MenuLeftHidden");
        document.getElementById("MenuSolution").setAttribute("class", "Float_MenuLeftHidden");
        document.getElementById("MenuRole").setAttribute("class", "Float_MenuLeftHidden");
        document.getElementById("MenuContactUs").setAttribute("class", "Float_MenuLeftHidden");
    }
}

function map() {
    if (document.getElementById("ContentPlaceHolder1_map") != null) {
        alert("toto");
    }
}

function startMap() {
    var LATTITUDE                   = 49.28884454666423;
    var LONGITUDE                   = 1.0048413276672363;
    var INFO                        = "<div><b>EVERYTIME Technologies</b> <br/><br/> 26 rue Camille Randoing 76500 ELBEUF</div>";

    function MyMapAddMarker(lat, lng, markertype, info) {
        var marker                  = new YMarker(new YGeoPoint(LATTITUDE, LONGITUDE), markertype);
        YEvent.Capture(marker, EventsList.MouseClick, function OnClick() {
            marker.openSmartWindow(info);
        });
        map.addOverlay(marker);
        return marker;
    }

    if (document.getElementById("ContentPlaceHolder1_CtlInformation_panMain") != null) {
        document.getElementById("map").setAttribute("class", "map");

        var map                     = new YMap(document.getElementById('map'));
        map.addTypeControl();
        map.addZoomLong();
        map.addPanControl();
        map.drawZoomAndCenter(new YGeoPoint(LATTITUDE, LONGITUDE), 2);

        var MYMARKER                = new YImage();
        MYMARKER.src                = "Images/RepereMap.png"
        MYMARKER.size               = new YSize(30, 40);
        MYMARKER.offsetSmartWindow  = new YCoordPoint(LATTITUDE, LONGITUDE);
        MyMapAddMarker(LATTITUDE, LONGITUDE, MYMARKER, INFO);

        YEvent.Capture(map, EventsList.MouseClick, reportPosition);

        function reportPosition(_e, _c) {
            var mapCoordCenter      = map.convertLatLonXY(map.getCenterLatLon());
            YLog.initPos(mapCoordCenter);
            //YLog.print("Latitude:" + _c.Lat);
            //YLog.print("Longitude:"+ _c.Lon);
        }
    }
}
