﻿
//the map object
var map = null;
var latcontrolname = null;
var loncontrolname = null;

//set page event handlers
if (window.attachEvent) {
	window.attachEvent("onload", Page_Load);
	window.attachEvent("onresize", MapResize);
	window.attachEvent("onunload", Page_Unload);	
} else {
	window.addEventListener("DOMContentLoaded", Page_Load, false);
	window.addEventListener("unload", Page_Unload, false);
	window.addEventListener("onresize", MapResize, false);
}

//load map    
function Page_Load() {    
    map = new VEMap("locationmap");
    var mapcenter;    
    var zoomlevel = 14;
    var findaddress=false;

    mapcenter = new VELatLong(51.98314892525219, -0.21341800689697266);
    map.LoadMap(mapcenter,zoomlevel,VEMapStyle.Road,false,null,false);    
    addIcon(mapcenter);                
}

function addIcon(position){
    var shape = new VEShape(VEShapeType.Pushpin, position);
    shape.SetTitle("The Technology Studio Ltd<br />Suite 101<br />Devonshire Business Centre<br />Works Road<br />Letchworth<br />Hertfordshire<br />SG6 1GJ<br/><br/>Tel: +44 (0)845 642 9885<br/>Email: <a href='mailto:info@thetechnologystudio.co.uk' style='color:black;'>info@thetechnologystudio.co.uk</a>");
        
    //Set the icon
     var icon = new VECustomIconSpecification();
     icon.Image="/images/content/techstudiopin.png";     
     icon.TextContent=" ";
     shape.SetCustomIcon(icon);

    map.AddShape(shape);       
}

//Clean up all objects
function Page_Unload(){
    if (map!=null) {
        map.Dispose();
        map = null;
    }
}

function MapResize() //resize
{
    if (map != null)
    {    
        if( typeof( window.innerWidth ) == 'number' )
        {
        //Non-IE
        map.Resize(window.innerWidth,window.innerHeight);
        } 
        else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
        {
        //IE 6+ in 'standards compliant mode'
        map.Resize(document.documentElement.clientWidth,document.documentElement.clientHeight);
        }
    }
}


