//When the DOM tree is loaded
$(document).ready(function() {

    //Add pointer class to .photo .item
    $(".photo .item").addClass("pointer");

    //Hover over photo fade in hidden span
    $(".photo .item").hover(
        function() {
            $(this).find("span").fadeIn();
        },
        function() {
            $(this).find("span").fadeOut();
        }
    );

});

         var map = null;
         var points = [];
         var shapes = [];
         var center = null;
         
         function GetMap()
         {
             if ($("#myMap").length>0) { 
                 map = new VEMap('myMap');
                 options = new VEMapOptions();
                 options.EnableBirdseye = false;
                 map.SetDashboardSize(VEDashboardSize.Small);
                 map.AttachEvent("oncredentialserror", MyHandleCredentialsError);
                 map.SetCredentials("ApnG80uiAmGX329i-WcxJ2R2sByBUiSnb6QOlryaDfeCIe8KhHAnwnEBNsPAyonx");   

                 map.LoadMap(); 
	        var latitude = "47.30538475750973";
                 var longitude = "8.54511989700876";
                 var location = new VELatLong(latitude, longitude); 
                 map.SetCenterAndZoom(location, 15);   

                 var LL = new VELatLong(latitude, longitude, 0, null);
                 var description = "Loostrasse 13 " + "</br>" + "8803 R&#252;schlikon"; 
                 LoadPin(LL, "Marti Systeme AG", description);
             }
         }		

         function LoadPin(LL, name, description) 
         {
             var shape = new VEShape(VEShapeType.Pushpin, LL);

             //Make a nice Pushpin shape with a title and description
             shape.SetTitle("<span class=\"pinTitle\"> " + escape(name) + "</span>");
             shape.SetPhotoURL("http://www.marti-systeme.ch/images/marti-systeme/LogoSmall.gif");

             if (description !== undefined) 
             {
                 shape.SetDescription("<p class=\"pinDetails\">" +
                 description + "</p>" +
                 "<a href='http://www.bing.com/maps/?v=2&cp=47.30538475750973~8.54511989700876&lvl=16&sty=r&where1=Loostrasse%2013%2C%208803%20R&#252;schlikon%2C%20Switzerland&rtp=%7Epos.47.30538475750973_8.54511989700876_Loostrasse 13, 8803 R&#252;schlikon, Switzerland' target='_new'>Anfahrt planen</a>"
                 );
             }
             map.AddShape(shape);
             points.push(LL);
             shapes.push(shape);
         }

         function MyHandleCredentialsError()
         {
            alert("The credentials are invalid.");
         }

         function MyHandleCredentialsValid()
         {
            alert("The credentials are valid.");
          
         }

