﻿// JScript File

var map = null;
var pinID = 1;

function GetMap( )
{
    map = new VEMap('myMap');
    
    map.LoadMap(new VELatLong(43.774998376162479, 11.23413205146789), 13 ,'r' ,false);
    map.SetScaleBarDistanceUnit(VEDistanceUnit.Kilometers);
    map.HideDashboard();
}

function CreateMap( )
{
	map = new VEMap('myMap');
	map.LoadMap(new VELatLong(43.774998376162479, 11.23413205146789), 13,'r' ,false);
	map.SetScaleBarDistanceUnit(VEDistanceUnit.Kilometers);
	map.HideDashboard();
	
    map.AttachEvent( "onmouseover", OnOver );         
	map.AttachEvent( "onmouseout", OnOut );
	map.AttachEvent( "onclick", OnClick );
}

function OnOver( e )
{
	var sl = document.getElementById("SilverFilter");

}

function OnOut( e )
{
	var sl = document.getElementById("SilverFilter");

}

var px;

function OnClick( e )
{
	var sl = document.getElementById("SilverFilter");

	px = map.GetShapeByID(e.elementID);
	
	if( px != null )
		sl.content.slfilter.mouse_event( px.GetDescription() );
}





function APin( pid, lat, lon, img, title, desc)
{
	var shape = new VEShape(VEShapeType.Pushpin, new VELatLong( lat, lon)); 
	shape.SetTitle(title);          
	shape.SetDescription(pid.toString());
	shape.SetCustomIcon( img );
	map.AddShape(shape);
	//var pin = new VEPushpin( pid, new VELatLong( lat, lon), img, title, desc);
	//map.AddPushpin( pin );
}

function ZoomIN() 
{            
    map.ZoomIn();
}

function ZoomOUT() 
{
    map.ZoomOut();
}

function ViewMap()
{
	map.SetMapStyle(VEMapStyle.Road);
}
function ViewSat()
{
	map.SetMapStyle(VEMapStyle.Aerial);
}
function ViewHibrid()
{
	map.SetMapStyle(VEMapStyle.Hybrid);
}
function ViewBird()
{
	map.SetMapStyle(VEMapStyle.Birdseye);
}


function Details( idc ) 
{
    window.showModalDialog("details.aspx?IDC="+idc, "Dialog", "dialogWidth:500px;dialogHeight:500px;resizable:yes;");
}

function ShowStat( statpg ) 
{
    alert(statpg);
}

function FindLoc()         
{            
   map.FindLocation( document.getElementById('TextFindAdd').value+', 50123 FIRENZE, ITALY', '1', onFoundResults);         
}


function ShowControl()         
{            
    map.ShowDashboard();         
}         
function HideControl()         
{            
    map.HideDashboard();         
}


function AddPin()
{
    var pin = new VEPushpin( pinID, map.GetCenter(), null, 'My pushpin', 'This is pushpin number '+pinID);
    map.AddPushpin(pin); 
    pinID++; 
}   
