﻿// JScript File
function onMouseMoveHandler(e)
{
if (!e.elementID)
{
    var LL=null
    var x=e.mapX
    var y=e.mapY
    pixel=new VEPixel(x,y)
    LL=map.PixelToLatLong(pixel)
    var Lat=LL.Latitude
    var Long=LL.Longitude
    var ParamLat={"Lat": Lat}
    var ParamLong={"Long": Long}
    var ParamActiveLayers={"Layers": 'Counties'}
    var ParamService={"Service": 'Census2000'}
    WebServices.GetFeatureWebService.GetFeature(ParamLat.Lat,ParamLong.Long,ParamActiveLayers.Layers,ParamService.Service,OnSucceeded,OnFailed)
}
else if (e.elementID)
  {    
//    var mode = map.GetMapMode();
//    if (mode != VEMapMode.Mode3D)
//    {    
//        try
//        {
//        if (map.GetShapeByID(e.elementID).GetShapeLayer().Name != "TaxLotsPoly")
//        {
//        if (mouseOverSelectedShape != undefined)
//        {
//        var icon = new VECustomIconSpecification();           
//        icon.Image = 'img/blankIcon.gif';   
//        mouseOverSelectedShape.SetCustomIcon(icon); 
//        mouseOverSelectedShapeLayer = mouseOverSelectedShape.GetShapeLayer();
//        mouseOverSelectedShapeLayer = mouseOverSelectedShapeLayer.Name;        
//        if (mouseOverSelectedShapeLayer.search(/Huc/) != -1)
//        {
//        setShapeLayerColors(mouseOverSelectedShape, "Watersheds", false);
//        }
//        else
//        {
//         setShapeLayerColors(mouseOverSelectedShape,mouseOverSelectedShapeLayer,false) 
//        }                
//        }
//        var shape = map.GetShapeByID(e.elementID);
//        var zoomLevel = map.GetZoomLevel();
//        if (shape!= selectedShape && zoomLevel < 10)
//        {
//        shape.SetLineWidth(2);
//        shape.SetLineColor(new VEColor(0,150,100,1.0));
//        shape.SetFillColor(new VEColor(0,100,150,0.5));
//        var shapeLayer = shape.GetShapeLayer();              
//        var shapeLayerName = shapeLayer.Name;
//        }
//        if (zoomLevel<12)
//        {
//        var PopUpTitle = shape.GetTitle();        
//        var icon = new VECustomIconSpecification();           
//        icon = "<div class='divShapeLabel' style='background-color:#6F99A5; font-size:10px;font-weight:bold; color:white; width=100px'>"+PopUpTitle+"</div>";
//        shape.SetCustomIcon(icon);  
//        mouseOverSelectedShape = shape;         
//        }
//        }         
//        }        
//        catch (ex)
//        {}         
//        keepSelectedPoly = false; 
//        return true;
//       } 
        
    }    
}

function onMouseOutHandler(e)
{
    var mode = map.GetMapMode();
    if (mode != VEMapMode.Mode3D)
    {
    if (e.elementID && keepSelectedPoly == false)
        {     
        if (map.GetShapeByID(e.elementID).GetShapeLayer().Name != "TaxLotsPoly")
        {          
        var shape = map.GetShapeByID(e.elementID);
        var icon = new VECustomIconSpecification();           
        icon.Image = 'img/blankIcon.gif';   
        shape.SetCustomIcon(icon); 
        //map.HideInfoBox(shape);
        
         if (shape!= selectedShape)
        {
        var shapeLayer = shape.GetShapeLayer();              
        var shapeLayerName = shapeLayer.Name;
        if(shapeLayerName.search(/Huc5/) != -1 || shapeLayerName == "Huc4" || shapeLayerName.search(/Huc6/) != -1)
        {
        setShapeLayerColors(shape,"Watersheds",false);        
        }
        else
        {
        setShapeLayerColors(shape,shapeLayerName,false) 
        }
        mouseOverSelectedShape = undefined;
        }
        }
        //keepSelectedPoly = false;   
        return true;
       } 
    }
}


