﻿var mapCollection = { 
    "aberfordMap": new Array(53.821757, -1.344682, 9, "Head office"),
    "skiptonMap": new Array(53.95295, -2.089446, 7, "Research and Development Centre, Skipton"),
    "belfastMap": new Array(54.613033, -5.902362, 9, "Masternaut Ireland and Scotland"),
    "sydneyMap": new Array(-33.705063, 151.209624, 9, "Masternaut Australia")
};
    
function getMap(whichMap,whichDiv)
{
    $('#mapFrame').attr('src', '/map/OfficeLocator.html?lat=' + mapCollection[whichMap][0] + '&lon=' + mapCollection[whichMap][1] + '&height=400&width=230&bgcolor=white&withDirection=1&title=' + mapCollection[whichMap][3] + '&zoom=' + mapCollection[whichMap][2]);
}


function oldGetMap(whichMap,whichDiv)
{

        var LA = new VELatLong(whichMap[0], whichMap[1]); 
        var map = new VEMap(whichDiv);
        
        map.LoadMap(LA, whichMap[2], VEMapStyle.Road, false, VEMapMode.Mode2D, false, 1);
        map.HideDashboard();     
        
        // Add a new pushpin to the center of the map.
        map.AddPushpin(LA);    
}

function CustomMouseMove(e)
{
    if (e.leftMouseButton == true)
    {
        return true;
    }
    return false;
}

function bigMap(whichVid,des)
{

    var videoHeight = 462;
    var vidHeight = videoHeight + 27;        
    var videoWidth = 768;      
        
    document.getElementById('videoDescription').innerHTML = des;        
    document.getElementById('vid').style.display='none';
    document.getElementById('light').style.display='block';
    document.getElementById('fade').style.display='block';        
           
    if (document.getElementById && !document.all) // Detect FF
    {
        var popTop = ((window.innerHeight / 2) - (document.getElementById("light").offsetHeight / 2));
        var popLeft = ((window.innerWidth / 2) - (document.getElementById("light").offsetWidth / 2));
        document.getElementById("light").style.left = popLeft + window.pageXOffset + "px";
        document.getElementById("light").style.top = popTop + window.pageYOffset + "px";
    }
    else // Just assume otherwise (IE) at this stage.
    {
        var popTop = ((document.body.clientHeight / 2) - (document.getElementById("light").offsetHeight / 2));
        var popLeft = ((document.body.clientWidth / 2) - (document.getElementById("light").offsetWidth / 2));
        document.getElementById("light").style.left = popLeft + document.body.scrollLeft + "px";
        document.getElementById("light").style.top = popTop + document.body.scrollTop + "px";
    }    
    
    getMap(mapCollection[whichVid],'bigMap');
}

function closeVideo()
{
    document.getElementById('light').style.display='none';
    document.getElementById('fade').style.display='none';
}

$(document).ready(function(){
    $('.jsOn').css("display","block");
    setTimeout('getMap(aberfordSideMap,\'officeMap\')',2);
});
