﻿var tracking = false;       //??

function MapTypeChange(mapType)
{           
    var gmapTypes = document.getElementById('gmapType');           
    if(mapType == CIMAPS_TYPE)            
    {                
        gmapTypes.style.visibility = 'hidden';            
        cimap.SetMapType(CIMAPS_TYPE);
    }
    else
    {
        gmapTypes.style.visibility = 'visible';
        cimap.SetMapType(GOOGLEMAPS_TYPE);
    }
};

function GMapTypeChange()
{               
    if(cimap.GetMapType() == GOOGLEMAPS_TYPE)
    {
        var gmapTypes = document.getElementById('gmapType');           
        if(gmapTypes[0].selected)                
            cimap.SetGMapType(GMAP_NORMAL);
        if(gmapTypes[1].selected)  
            cimap.SetGMapType(GMAP_SATELLITE);
        if(gmapTypes[2].selected)  
            cimap.SetGMapType(GMAP_HYBRID);
        if(gmapTypes[3].selected)  
            cimap.SetGMapType(GMAP_PHYSICAL);
    }
};

function GMapTypeSet(gmapType)
{
  var gmapTypes = document.getElementById('gmapType');           
  for (var i = 0; i < gmapTypes.length; i++)
  {
    gmapTypes[i].selected = gmapTypes[i].value == gmapType;
  }
};
 
function ShowMapPrint(printPage)
{       
    try
    {        
        if(cimap)
        {          
            var extent = cimap.GetExtent();            
            var width = cimap.GetWidth();
            var height = cimap.GetHeight();
            var mapType = cimap.GetMapType();       
            var googleMapType = cimap.GetGMapType();      
            
            window.open(printPage + "?MinLonX=" + extent.minLonX +
                         "&MaxLatY=" + extent.maxLatY +
                         "&MaxLonX=" + extent.maxLonX +
                         "&MinLatY=" + extent.minLatY +
                         "&Width=600" +
                         "&Height=730" +
                         "&MapType=" + mapType +
                         "&GoogleMapType=" + googleMapType,
                         "MapPrint", "height=770,width=640,status=1, toolbar=1, location=0, menubar=1, directories=0, resizable=0, scrollbars=0");                             
        }
    }
    catch(ex)
    {
        var message = ex.description || ex.message;
        alert(message);
    }        
};


