﻿//****************************************************************************************
//  Module      :   InfosoftVMap.js
//  Developer   :   Alexander Bell
//  Version     :   1.04
//  Last Mod    :   02/11/09
//  Description :   Script File to get MapObject
//****************************************************************************************
//  Copyright (C) 2009 Infosoft International Inc
//****************************************************************************************
//  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 = "InfosoftVMap.js"></script> 
//  2.Add one of Wrapper Function on onload event

//****************************************************************************************
// DISCLAIMER: This Application is provide on AS IS basis without any warranty
//****************************************************************************************


// ************************************************************************************
function GetMap(Lat, Lon, Scale, Fix, Dash, Pin, Title, Desc, Icon){
    
    //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!=null) AddPin(map, Title, Desc, Icon);
}

// ************************************************************************************
// 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 />";
    
    // use default Title if not specified
    _title = (Title==null)? _title : Title; 
    
    // default Description
    var _desc ="<div style='background-color:beige'>";
    _desc+="Consulting: IT / SW Engineering";
    _desc+="<br /><hr /><br />";
    _desc += "<img src = 'Images/ImgMap/Bell_ico.jpg'/>"
    _desc+="<div /><br />";
     
     // use default Description if not specified
     _desc  = (Desc==null)? _desc : Desc; 
    
    
    // default Icon
    var _icon = "<img src = 'Images/ImgMap/FlagUSA.gif'/>";
    
    //use default Icon if not specified
    _icon  = (Icon==null)? _icon : Icon; 
     
    var pinPoint = null;
    var pinPixel = null;
    
    // add pushpin
    var center = oMap.GetCenter();
    var pin = oMap.AddPushpin(center);
    
    // set pushpin attributes an pop-ups
    pin.SetTitle(_title);
    pin.SetDescription(_desc);
    pin.SetCustomIcon(_icon);
  }

// ************************************************************************************
