var myMap = new CAatMap();
var points = new Array();
var layerPoints = null;
var maxx;
var minx;
var maxy;
var miny;
var startX = 31.039006;
var startY = -29.855916;
var startScale = 1.0;
//add properties...
function __aatpoint(caption,x,y, ref, icon)
{
this.caption = caption;
this.x = x;
this.y = y;
this.ref = ref;
this.icon = icon;
}
points.push(new __aatpoint('Irene Country Lodge', 28.21144, -25.87682, 2142966, 'http://www.streetmaps.co.za/userphoto_view.asp?p=3C6883B1E3E44CC08DA9458F714F15B7'));
document.writeln("
");
var mapList='officelist';
var mapContainer='map1';
document.writeln("
");
function populateList()
{
sel = getObj(mapList);
for (var i = 0; i < points.length; i++) {
var option;
option = new Option(points[i].caption, i);
sel.options.add(option);
}
sel.selectedIndex = -1;
}
function populatePoints()
{
maxx = -10000;
minx = 10000;
maxy = -10000;
miny = 10000;
for (var i = 0; i < points.length; i++) {
var ptInfo = points[i];
if (ptInfo.x > maxx) maxx = ptInfo.x;
if (ptInfo.x < minx) minx = ptInfo.x;
if (ptInfo.y > maxy) maxy = ptInfo.y;
if (ptInfo.y < miny) miny = ptInfo.y;
var pt = layerPoints.AddPoint(ptInfo.x, ptInfo.y, "", "__aatpoint."+String(ptInfo.ref));
pt.userRef=ptInfo.ref;
pt.SetIcon(ptInfo.icon);
pt.SetCallback(__StoreLocationReplaceBubbleInplace);
pt.SetTooltip(ptInfo.caption);
pt.SetIconAnchor("center","center");
pt.SetLabelAnchor("left","bottom");
pt.SetClickBehaviour("toggle_icon_label");
pt.SetStyle("icon");
}
if ((maxx - minx) < 0.0001) {
maxx += 0.005;
minx -= 0.005;
}
if ((maxy - miny) < 0.0001) {
maxy += 0.005;
miny -= 0.005;
}
}
function displayMap(c, x, y, s) {
myMap.SetImageBase("http://www.streetmaps.co.za/img/");
myMap.SetOutput(c);
var newlayer = myMap.AddLayer("map", 500);
layerPoints = myMap.AddLayer("point", 50, "layerPoints");
myMap.SetPointsButtons(false);
myMap.Jump(x,y,s);
newlayer.SetType("map");
populatePoints();
myMap.Init();
myMap.ZoomBounds(minx,miny,maxx,maxy);
}
function selectStore()
{
sel = getObj(mapList);
if (sel.selectedIndex != -1) {
var ptInfo = points[sel.selectedIndex];
myMap.Jump(ptInfo.x,ptInfo.y,"0.005");
myMap.Init();
}
}
function __StoreLocationRemoveBubble(ref, poiref, layername, ctrlname)
{
var pt = eval(layername).FindPoint(poiref);
if (!layername) layername="poiLayer";
pt.SetCaption("");
pt.SetStyle("icon");
pt.SetCallback(__StoreLocationReplaceBubbleInplace);
var obj = MapArray[ctrlname];
obj.mapobj.Init();
}
function __StoreLocationReplaceBubbleInplace(pt)
{
if (pt.pCaption.length>0) {
__StoreLocationRemoveBubble(String(pt.userRef),"__aatpoint."+String(pt.userRef),'layerPoints',pt.parent.csContainer);
} else {
ReplaceBubble(String(pt.userRef),"__aatpoint."+String(pt.userRef),'layerPoints',pt.parent.csContainer);
}
}
populateList();
displayMap(mapContainer,startX, startY, startScale);