﻿// JScript File for VEMap3D

// called by base javascript after the VE map control has been instantiated and loaded into the parent element
function MDNPostLoadVEMap(veMap)
{       
    MDNAddTileLayer();
    
    AddLogo(); // Add MDN logo

    // internal mousemove handler (supports IE, FF and NS)
    // don't use VE onmousemove because it is broken in VE5 3D
    if (!document.all && !document.getElementById) 
    {
        document.captureEvents(Event,MOUSEMOVE);
    }
    document.onmousemove=MDNMouseMoveHandlerOverride;
    
    COMPageLoadHandler();
}

// mouse hover drill-down
function MDNDrillDownReady(curMouseMapPos)
{
    HandleDrillDownIdentify(curMouseMapPos.Longitude, curMouseMapPos.Latitude)
}

// handle browser resize
function MDNBrowserResizeWrapper()
{
    var w = COMGetMapWidth();
    var h = COMGetMapHeight();
    
    if (w < 100) {w = 100;}
    if (h < 100) {h = 100;}
    
    var mapDiv = document.getElementById( MDNGetVEMapContainerID() );
    mapDiv.style.width = w + 'px';
    mapDiv.style.height = h + 'px';
    
    MDNGetVEMap().Resize(w, h);
    
    MDNEndEnvChange();
}


//This function adds the MapDotNet Logo to the map

function AddLogo()

{

    var browser;
    var theMap = document.getElementById("theMapTop");//If you change the name of the mapdiv then this needs to be changed.
    if (window.ActiveXObject) { browser = 'ie'; }
    else if (document.implementation && document.implementation.createDocument) { browser='moz'; }

    var myLogo;
    if(browser == 'ie')
    {

        myLogo = document.createElement("DIV");
        myLogo.className="mdnlogo mdnlogo_ie";
        myLogo.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='Images/mdn-logo-glow12small.png', sizingMethod='scale')";
        myLogo.style.display = "block";
        myLogo.style.left = "100px";
        myLogo.style.bottom = "8px";

    }else
    {
        myLogo = document.createElement("IMG");
        myLogo.className="mdnlogo";
        myLogo.src = "Images/mdn-logo-glow12small.png";
        myLogo.style.display = "block";
        myLogo.style.left = "100px";
        myLogo.style.bottom = "8px";
        myLogo.style.height = "33px";
    }

    theMap.appendChild(myLogo);

}
