');
data+=escape ('
'); data+=escape('');data+=escape ('
');
try
{
var fmapholder = document.getElementById("mapholder");
fmapholder.innerHTML = unescape(data);
}
catch (e)
{
alert('Failed to find the mapholder');
}
String.prototype.pad = function(l, s, t){ //v1.0
return s || (s = " "), (l -= this.length) > 0 ? (s = new Array(Math.ceil(l / s.length)
+ 1).join(s)).substr(0, t = !t ? l : t == 1 ? 0 : Math.ceil(l / 2))
+ this + s.substr(0, l - t) : this;
};
function thisMovie(movieName) {
// IE and Netscape refer to the movie object differently.
// This function returns the appropriate syntax depending on the browser.
return document.getElementById(movieName);
if (navigator.appName.indexOf ("Microsoft") !=-1) {
return window[movieName];
} else {
return document[movieName];
}
}
function getFlashMovieObject(movieName)
{
if (window.document[movieName])
{
return window.document[movieName];
}
if (navigator.appName.indexOf("Microsoft Internet")==-1)
{
if (document.embeds && document.embeds[movieName])
return document.embeds[movieName];
}
else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
{
return document.getElementById(movieName);
}
}
// Checks if movie is completely loaded.
// Returns true if yes, false if no.
function movieIsLoaded (theMovie) {
// First make sure the movie's defined.
if (typeof(theMovie) != "undefined") {
// If it is, check how much of it is loaded.
return theMovie.PercentLoaded() == 100;
} else {
// If the movie isn't defined, it's not loaded.
return false;
}
}
function doPassVar(args){
if (movieIsLoaded(thisMovie(movieName))) {
thisMovie('FMapa').SetVariable("/mtarget:caption", args);
}
}
function setListeners() {
if (!listeners_initiated) {
listeners_initiated = true;
GEvent.addListener(map, "move", move);
GEvent.addListener(map, "zoom", zoom);
GEvent.addListener(map, "moveend", onMoveEnd);
GEvent.addListener(map, "movestart", onMoveStart);
}
}
function init() {
initWhami();
}
function initMap() {
if (!(typeof wait_interval=='undefined')) {
if ((typeof map!='undefined')) {
clearInterval(wait_interval);
InitFlash();
}
} else {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("mapdiv"));
//map.centerAndZoom(new GPoint(51.192233428571,-0.624302928571), 11);
map.setCenter(new GLatLng(51.192233428571,-0.624302928571), 11);
var pCenter=map.getCurrentMapType().getProjection().fromLatLngToPixel(map.getCenter(),map.getZoom());
oldX = pCenter.x;
oldY = pCenter.y;
var view = map.getBounds();
wait_interval = setInterval('initMap()', 1000);
}
}
}
//load google script and wait for it
function initWhami() {
g_intervalID = setInterval('a()', 3000);
if (typeof GLog=='undefined') {
if (typeof g_intervalID=='undefined') g_intervalID = setInterval('a()', 3000);
} else {
initMap();
try {
clearInterval(g_intervalID);
} catch(e) {
}
}
}
function InitFlash(args) {
//check if map is loaded
if (typeof map=='undefined') return;
//check if it hasn't been called already by js when flash is calling it
//if (data_initiated) return;
//check if flash is loaded
isFLoaded = true;
thisMovie('FMapa').TCurrentFrame("/mtarget");
try
{
var aFrameNo = thisMovie('FMapa').TCurrentFrame("/mtarget");
isFLoaded = (aFrameNo==1);
}
catch(e)
{
isFLoaded = false;
}
// map initialised, flash is loaded but it has not reached frame 2 (first frame is the preloader animation)
if (!isFLoaded) {
//g_intervalID = setInterval('initMap()', 1000);
return;
} else {
try {
clearInterval(g_intervalID);
} catch(e) {
}
}
setListeners();
var pCenter=map.getCurrentMapType().getProjection().fromLatLngToPixel(map.getCenter(),map.getZoom());
//var view = map.getBoundsLatLng();
//minX = view.minX;
//minY = view.minY;
//maxX = view.maxX;;
//maxY = view.maxY;;
// pece, probably wrong - to be checked
var bounds = map.getBounds();
var min = bounds.getSouthWest();
var max = bounds.getNorthEast();
minX = min.lng();
minY = min.lat();
maxX = max.lng();
maxY = max.lat();
var mapSize = map.getSize();
px = mapSize.width/(maxX-minX);
if (thisMovie('FMapa')===null) return;
thisMovie('FMapa').SetVariable("/mtarget:minX", minX);
thisMovie('FMapa').SetVariable("/mtarget:minY", minY);
thisMovie('FMapa').SetVariable("/mtarget:maxX", maxX);
thisMovie('FMapa').SetVariable("/mtarget:maxY", maxY);
//px = map.getCurrentMapType().pixelsPerLonDegree[map.getZoom()];
thisMovie('FMapa').SetVariable("/mtarget:px", px);
thisMovie('FMapa').SetVariable("/mtarget:currentzoom", map.getZoom());
thisMovie('FMapa').SetVariable("/mtarget:gmapax", pCenter.x);
thisMovie('FMapa').SetVariable("/mtarget:gmapay", pCenter.y);
if (!data_initiated) {
//try {
if (thisMovie('FMapa')) {
thisMovie('FMapa').TCallFrame("/mtarget/functions",2);
}
data_initiated = true;
trace('initflash2 flash');
//} catch (e) {
//}
}
}
function doZoom(level) {
map.setZoom(parseInt(level));
//data_initiated = false;
InitFlash();
thisMovie('FMapa').TCallFrame("/mtarget/functions",3);
}
function zoom(oldZoomLevel, newZoomLevel) {
thisMovie('FMapa').SetVariable("/mtarget:currentzoom", newZoomLevel);
// InitFlash();
}
function onGroupClick(lat,lng) {
level = map.getZoom()+1;
if (level>17) return;
//map.centerAndZoom(new GPoint(lng, lat), level);
map.setCenter(new GLatLng(lat,lng), level);
//data_initiated = false;
InitFlash();
thisMovie('FMapa').TCallFrame("/mtarget/functions",3);
}
function onGroupClickCallBack() {
level = map.getZoom()-1;
//alert(level);
map.centerAndZoom(map.getCenterLatLng(), level)
window.setTimeout(function() {
map.centerAndZoom(map.getCenterLatLng(), level)
data_initiated = false;
InitFlash();
thisMovie('FMapa').TCallFrame("/mtarget/functions",3);
}, 2000);
}
function MoveMap(dx,dy) {
//p = map.getCenterLatLng();
//p.x+=parseFloat(dx);
//p.y+=parseFloat(dy);
//map.recenterOrPanToLatLng(p);
trace('pan'+dx+':'+dy);
map.panBy(new GSize(dx,dy));
}
function move() {
var pCenter=map.getCurrentMapType().getProjection().fromLatLngToPixel(map.getCenter(),map.getZoom());
var deltaX = oldX - pCenter.x;
oldX = pCenter.x;
var deltaY = oldY - pCenter.y;
oldY = pCenter.y;
thisMovie('FMapa').SetVariable("/mtarget:deltaX", deltaX);
thisMovie('FMapa').SetVariable("/mtarget:deltaY", deltaY);
thisMovie('FMapa').SetVariable("/mtarget:gmapax", pCenter.x);
thisMovie('FMapa').SetVariable("/mtarget:gmapay", pCenter.y);
FMove(deltaX,deltaY);
}
function FMove(x,y) {
thisMovie('FMapa').TCallFrame("/mtarget/functions",1);
}
function onMoveEnd() {
trace('onMoveEnd');
if (startPopup) {
startPopup = false;
thisMovie('FMapa').TCallFrame("/mtarget/functions",4);
}
if (groupClicked) {
groupClicked = false;
onGroupClickCallBack();
}
thisMovie('FMapa').TCallFrame("/mtarget/functions",6);
}
function onMoveStart() {
trace('onMoveStart');
thisMovie('FMapa').TCallFrame("/mtarget/functions",5);
}
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
function FMapa_DoFSCommand(command, args) {
var FMapaObj = thisMovie('FMapa');
switch (command)
{
case 'InitFlash':InitFlash(args);break;
case 'zoom':doZoom(args);break;
case 'GroupClick':
arr = args.split(",");
lat = parseFloat(arr[0]);
lng = parseFloat(arr[1]);
onGroupClick(lat,lng);
break;
case 'Popup':
startPopup = true;
var arr = args.split(",");
x = parseFloat(arr[0]);
y = parseFloat(arr[1]);
MoveMap(x,y);
break;
case 'MoveMap':
var arr = args.split(",");
x = parseFloat(arr[0]);
y = parseFloat(arr[1]);
MoveMap(x,y);
break;
case 'Test':
alert(args);
break;
case 'popEbrochure':
popEbrochure(args);
break;
case 'popDetails':
popDetails(args);
break;
case 'setMapType':
setMapType(args);
break;
case 'trace':
trace(args);
break;
}
}
function setMapType(type) {
switch (type) {
case '1':
map.setMapType(G_NORMAL_MAP);
break;
case '2':
map.setMapType(G_SATELLITE_MAP);
break;
case '3':
map.setMapType(G_HYBRID_MAP);
break;
}
}
function popEbrochure(houseref) {
MM_openBrWindow('http://ver2.whami.co.uk/ebrochure/get.php?agent=bargate&houseref='+houseref,'','width=400,height=250')
}
function popDetails(houseref) {
MM_openBrWindow('http://bargateproperty.co.uk/property/property1.php?story='+houseref,'details','status=yes,scrollbars=yes,resizable=yes'); return false;}
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 &&
navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
document.write(' \n');
}
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function MM_openBrWindow(theURL,winName,features) { //v2.0
winref = window.open(theURL,winName,features);
winref.focus();
}
function trace( msg ){
if (!debug) return;
GLog.write(msg);
}