//';
this.soaphead = soaphead;
var soaptail = '';
this.soaptail = soaptail;
this.zoomTo(myZp);
var soaphost = "http://dialogues.concrete.org.au/dgsoap";
this.soaphost = soaphost;
this.updatePos();
GEvent.bind(this.map,"moveend",this,this.updatePos);
GEvent.bind(this.map,"zoom",this,this.updatePos);
GEvent.bind(this.map,"move",this,this.crossHair);
// deal with URL state here
this.parseRequestState();
} else {
alert("As we use all kinds of crazy javascript here, your browser is not properly compatible with this website. All works are fully accessible, but you won't see the map, so you'll be kind of missing the point. If you can, please try out a Firefox, Safari or recent Internet Explorer, and you'll see the full wonder of the thing.");
}
}
DGMap.prototype.switchView = function (view) {
if (view == 'street') {
this.map.setMapType(G_NORMAL_MAP);
} else if (view == 'satellite') {
this.map.setMapType(G_SATELLITE_MAP);
} else {
view = 'hybrid';
this.map.setMapType(G_HYBRID_MAP);
}
document.cookie = "dgMapType="+view+";path=/";
}
DGMap.prototype.resetView = function () {
this.map.centerAndZoom(new GPoint(115.84808349609375, -31.982453066235752),7);
}
DGMap.prototype.parseRequestState = function () {
var reqUri = document.location.href;
var reqAnchor = reqUri.lastIndexOf('#');
if (reqAnchor) {
var reqState = reqUri.substr((reqAnchor + 1),reqUri.length).split(':');
for (var i = 0; i < reqState.length; i++) {
if (reqState[i].match("=")) {
var reqString = reqState[i].split("=");
reqArg = reqString[0];
reqVal = reqString[1];
} else {
reqArg = reqState[i];
reqVal = null;
}
// alert("running "+reqArg+" with "+reqVal);
switch(reqArg) {
case "submit" : this.goSubmit(); break;
case "work" : this.loadWork(reqVal);
}
}
}
}
DGMap.prototype.updatePos = function() {
this.checkLimits();
coord = document.getElementById('coords');
if (coord) {
gc = document.getElementById("withinscope").removeChild(coord);
gc = null;
}
var newpos = this.map.getCenterLatLng();
document.cookie = "dgMapX="+newpos.x+";path=/";
document.cookie = "dgMapY="+newpos.y+";path=/";
this.currentPos = newpos;
this.buildMarkers();
this.buildStreets();
}
DGMap.prototype.checkLimits = function () {
var bounds = this.map.getBoundsLatLng();
if ((bounds.minX < 115) || (bounds.minY > -32) || (bounds.maxX > 118) || (bounds.maxY < -30)) {
// alert("Sorry, this project only exists within the bounds of Metropolitan Perth. Nothing to see out here, move along please.");
// this.map.recenterOrPanToLatLng(this.currentPos);
}
}
DGMap.prototype.crossHair = function () {
if (this.centerMarker) {
this.map.removeOverlay(this.centerMarker);
this.centerMarker = null;
if (document.getElementById('streetForm')) {
this.centerMarker = new GMarker(this.map.getCenterLatLng(),crosshair);
this.map.addOverlay(this.centerMarker);
this.map.recenterOrPanToLatLng(this.map.getCenterLatLng());
}
}
}
function getCookie(name) {
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1) {
begin = dc.indexOf(prefix);
if (begin != 0) return null;
} else
begin += 2;
var end = document.cookie.indexOf(";", begin);
if (end == -1)
end = dc.length;
return unescape(dc.substring(begin + prefix.length, end));
}
DGMap.prototype.readDOMValue = function (val,docEl) {
vals = docEl.getElementsByTagName(val);
if (vals.length) {
if (vals[0].firstChild) {
value = vals[0].firstChild.nodeValue;
} else {
return false;
}
return value;
} else {
return false;
}
}
DGMap.prototype.createMarker = function (point,title) {
// debug("setting marker at "+point)
var marker = new GMarker(point, this.icon);
this.map.addOverlay(marker);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(title);
});
}
DGMap.prototype.handleMarkerResponse = function (response) {
if (response.getElementsByTagName('SOAP-ENV:Fault').size) {
error("Fault");
} else {
this.titles = new Array();
this.points = new Array();
var markers = response.documentElement.getElementsByTagName("item");
for (var i = 0; i < markers.length; i++) {
// info ('checking result '+i);
lng = parseFloat(this.readDOMValue("lng",markers[i]));
lat = parseFloat(this.readDOMValue("lat",markers[i]));
title = this.readDOMValue("title",markers[i]);
workid = this.readDOMValue("workid",markers[i]);
author = this.readDOMValue("author",markers[i]);
point = new GPoint(lat,lng);
if (point) {
// debug("setting marker at "+point)
// info("title of piece is "+title);
this.titles[workid] = title;
this.points[workid] = point;
var marker = createMarker(point,i,title,workid,author);
this.map.addOverlay(marker);
// info("marker set at point "+point);
} else {
// warn("bad point");
}
}
// info('all markers set from response');
}
}
function createMarker(point,i,title,workid,author) {
var marker = new GMarker(point,dialogues.icon);
// Show this marker's index in the info window when it is clicked
this.title = title;
var html = "