﻿//****************************************************************************************
//  Developer   :   Alexander Bell
//  Version     :   1.03
//  Last Mod    :   10/11/07
//  Description :   Script File to get MapObject

//  Usage: 
//  1.Insert references in HTML Head:  
//  <script type = "text/javascript" src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=5"></script>
//  <script type = "text/javascript"  src = "js/Map.js"></script> 
//  2.Add one of Wrapper Function on onload event

//****************************************************************************************
// DISCLAIMER: This Application is provide on AS IS basis without any warranty
//****************************************************************************************
//  Copyright (C) 2007 Alexander Bell
//****************************************************************************************
// TERMS OF USE     :   This module is copyrighted.
//                  :   You can use it at your sole risk provided that you keep
//                  :   the original copyright note.
//****************************************************************************************


// Wrapper Functions: to be called on onload event ***************************************

function GetMapAlex(){
    var lt = "40.7277";
    var ln = "-73.8617";
    //GetMap(lt, ln, 10, false, false, true)
    GetMap(lt, ln, 9, true, false, true)  //Make it Fixed
}

// ************************************************************************************
function GetMap(Lat, Lon, Scale, Fix, Dash, Pin, Title, Desc){
    
    //Default Values
    var _scale = (Scale==null)?10:Scale;
    
    map = new VEMap('objMap');
   
    //Latitude, Longitute, Zoom, Fixed, Mode, Show3DControl, 
    map.LoadMap(new VELatLong(Lat, Lon), _scale ,'h', Fix, VEMapMode.Mode2D, true);
    
    map.SetDashboardSize(VEDashboardSize.Normal);
    //map.SetDashboardSize(VEDashboardSize.Small);
    //map.SetDashboardSize(VEDashboardSize.Tiny);
    
    if (!Dash) map.HideDashboard();
    if (Pin) AddPin(map, Title, Desc);
}

// ************************************************************************************
// Add a new pushpin to the center of the map
function AddPin(oMap, Title, Desc, Icon) {
    
    //Default Title
    var _title = "<div style='background-color:beige'><br />";
    _title+="Dr. Alexander Bell, NY, USA";
    _title+="<div /><br /><hr />";
    _title = (Title==null)? _title : Title; //Use default if not specified
    
    //Default Description
    var _desc ="<div style='background-color:beige'>";
    _desc+="Consulting: IT / SW Engineering";
    _desc+="<br /><hr /><br />";
    _desc+="<img src = './Custom_Images/DrABELL.jpg'/>"
    _desc+="<div /><br />";
    
    //Default Icon
    var _icon = "<img src = './GeoMapControl/Img/EnterDoor.gif'/>";
    _icon  = (Icon==null)? _icon : Icon; 
     
    var pinPoint = null;
    var pinPixel = null;

    var center = oMap.GetCenter();
    var pin = oMap.AddPushpin(center);
    
    pin.SetTitle(_title);
    pin.SetDescription(_desc);
    pin.SetCustomIcon(_icon);
  }

// ************************************************************************************
