// JavaScript Document // http://dean.edwards.name/packer/ // Use Base62 encode and Shrink variables options to obfuscate //google.load("maps", "2"); var max_zoom_satellite = 19; var max_zoom_normal = 17; var min_zoom = 12; var default_zoom = 15; ZoomMap.prototype.createSpan = function(here, contents, className) { var span = document.createElement('span'); span.className = className; span.innerHTML = contents; here.appendChild(span); return span; }; ZoomMap.prototype.createAnchor = function(here, contents, href, onclick) { var a = document.createElement('a'); a.href = href; a.onclick = onclick; a.innerHTML = contents; here.appendChild(a); return a; }; ZoomMap.prototype.createLabel = function(here, text, label_for) { var label = document.createElement('label'); label.innerHTML = text; label.htmlFor = label_for; here.appendChild(label); }; ZoomMap.prototype.createImg = function(here, src, alt) { var img = document.createElement('img'); img.src = src; img.alt = alt; here.appendChild(img); }; ZoomMap.prototype.createCheckBox = function(here, text, value, onclick, src, alt) { var li = this.createLI(here); li.style.listStyle = 'none'; li.style.listStyleType = 'none'; var input = document.createElement('input'); input.type = 'checkbox'; input.onclick = onclick; input.value = value; input.owner = this; input.name = 'check_' + value; this.createImg(li, src, alt); li.appendChild(input); this.createLabel(li, text, 'check_' + value); }; ZoomMap.prototype.createLI = function(here) { var li = document.createElement('li'); here.appendChild(li); return li; }; ZoomMap.prototype.createUL = function(here) { var ul = document.createElement('ul'); ul.style.listStyle = 'none'; ul.style.listStyleType = 'none'; here.appendChild(ul); return ul; }; ZoomMap.prototype.getSelected = function() { var ai = new Array(); var input = this.ai.getElementsByTagName("input"); for(var i=0;i 0) { this.lastQuery = p; owner.setLoading(); GDownloadUrl("/zoommap/map/php4/update.php", function(result) { owner.clearMarkers('19-1'); owner.clearMarkers('19-2'); owner.parseXML(result); this.ignoreMoveEnd = false; },p); }else{ this.clearMarkers('19-1'); this.clearMarkers('19-2'); this.clearLoading(); } } }; function ZoomMap(target, width, height, use_no_movement_mode, use_google_zoom_control, use_google_type_control) { var container = document.getElementById(target); var dom = container.ownerDocument; var add = false; var table = dom.createElement("table"); var tbody = dom.createElement("tbody"); this.cacheXML = ''; this.maxContentDiv = document.createElement('div'); table.id = container.getAttribute("name"); this.zoommap_m = new Array(); this.zoommap_m['2_4'] = Array('2_4'); this.zoommap_m['2_0'] = Array('2_0'); this.zoommap_m['3_0'] = Array('3_0','4_0','4_1'); this.zoommap_m['4_0'] = Array('3_0','4_0','4_1'); this.zoommap_m['4_1'] = Array('3_0','4_0','4_1'); this.zoommap_m['4_2'] = Array('4_2'); this.zoommap_m['4_3'] = Array('4_3','4_4','3_4'); this.zoommap_m['4_4'] = Array('4_3','4_4','3_4'); this.zoommap_m['3_4'] = Array('4_3','4_4','3_4'); this.zoommap_m['0_0'] = Array('0_0','0_1','1_0'); this.zoommap_m['0_1'] = Array('0_0','0_1','1_0'); this.zoommap_m['1_0'] = Array('0_0','0_1','1_0'); this.zoommap_m['0_2'] = Array('0_2'); this.zoommap_m['0_3'] = Array('0_3','0_4','1_4'); this.zoommap_m['1_4'] = Array('0_3','0_4','1_4'); this.zoommap_m['0_4'] = Array('0_3','0_4','1_4'); this.movements = new Array(); this.movements["1"] = 0.10; this.movements["2"] = 0.09; this.movements["3"] = 0.08; this.movements["4"] = 0.07; this.movements["5"] = 0.25; this.movements["6"] = 0.4096; this.movements["7"] = 0.2048; this.movements["8"] = 0.1024; this.movements["9"] = 0.512; this.movements["10"] = 0.256; this.movements["11"] = 0.128; this.movements["12"] = 0.064; this.movements["13"] = 0.032; this.movements["14"] = 0.016; this.movements["15"] = 0.008; this.movements["16"] = 0.004; this.movements["17"] = 0.002; this.movements["18"] = 0.001; this.movements["19"] = 0.0005; /** * In order to remain compatible with the existing CSS this look up table * converts the new co-ords into old style CSS selected numbers */ this.zoommap_l = new Array(); this.zoommap_l['0_0'] = '1'; this.zoommap_l['0_4'] = '5'; this.zoommap_l['2_0'] = '15'; this.zoommap_l['2_4'] = '7'; this.zoommap_l['4_0'] = '13'; this.zoommap_l['4_4'] = '9'; this.zoommap_l['0_2'] = '3'; this.zoommap_l['4_2'] = '11'; this.nav = new Array(); table.style.width = width+'px'; table.style.height = height+'px'; table.cellSpacing = '0'; // table.style.borderCollapse = 'collapse'; var cwidth = parseInt((width - 20) / 3) - 10; var cheight = parseInt((height - 20) / 3) - 10; var header = document.createElement('tr'); //var header_td = document.createElement('td'); //header_td.colSpan = '5'; //header_td.height = '25px'; //header_td.className = 'map_controls'; //header.appendChild(header_td); var controls_table = document.createElement('table'); controls_table.id = container.getAttribute("name"); var controls_tbody = document.createElement('tbody'); var controls = document.createElement('tr'); controls_table.style.height = '30px'; controls_table.style.width = '100%'; controls_table.style.background = 'transparent'; var map_controls = document.createElement('td'); map_controls.width = width - 350 + 'px'; var img = document.createElement('img'); img.style.marginTop = '10px'; img.src = '/zoommap/map/images/ico_map_controls.jpg'; map_controls.appendChild(img); var zoom_levels = document.createElement('td'); zoom_levels.width = 140 + 'px'; var zoom_scale = document.createElement('div'); this.zoom_scale = zoom_scale; zoom_levels.appendChild(zoom_scale); var zoom_in_owner = document.createElement('div'); zoom_in_owner.style.float = 'left'; zoom_in_owner.style.width = '0px'; zoom_in_owner.style.height = '0px'; zoom_in_owner.style.position = 'relative'; zoom_in_owner.style.zIndex = '100'; var zoom_in = document.createElement('div'); zoom_in_owner.appendChild(zoom_in); this.zoom_in = zoom_in; zoom_in.onclick = function() { this.parentNode.style.display = 'none'; }; zoom_in.style.display = 'none'; zoom_in.style.float = 'left'; zoom_in.style.top = '0px'; zoom_in.style.left = '-20px'; zoom_in.style.position = 'absolute'; zoom_in.style.zIndex = '100'; zoom_in.style.width = '168px'; zoom_in.style.height = '133px'; zoom_in.style.paddingTop = '55px'; zoom_in.style.paddingLeft = '13px'; zoom_in.style.background = 'url(\'/zoommap/map/images/bubble_icon_master.gif\')'; zoom_in.style.backgroundRepeat = 'no-repeat'; zoom_in.innerHTML = 'Content here'; var clear_div = document.createElement('div'); clear_div.style.clear = 'both'; zoom_levels.appendChild(clear_div); zoom_levels.appendChild(zoom_in_owner); var view_types = document.createElement('td'); view_types.width = 220 + 'px'; view_types.className = 'zoommap_map_buttons'; var mapTypeBtns = document.createElement('ul'); mapTypeBtns.className = 'zoommap_mapView'; mapTypeBtns.style.cssFloat = 'right'; // mapTypeBtns.style.marginLeft = '55px'; this.createBtn(mapTypeBtns, 'zoommap_home', 'reset', 'mapCentre', 'Reset Map', 'X'); //X this.createBtn(mapTypeBtns, 'zoommap_standard', 'map', 'mapViewStd', 'View Map', 'Map'); //Map this.createBtn(mapTypeBtns, 'zoommap_satellite', 'sat', 'mapViewSat', 'View Satellite Map', 'Satellite'); //Satellite this.createBtn(mapTypeBtns, 'zoommap_hybrid', 'hyb', 'mapViewHyb', 'View Hybrid Map', 'Hybrid'); //Hybrid view_types.appendChild(mapTypeBtns); var ai_owner = document.createElement('div'); this.ai = ai_owner; // ai_owner.style.cssFloat = 'right'; ai_owner.style.width = '0px'; ai_owner.style.height = '0px'; ai_owner.style.position = 'relative'; ai_owner.style.zIndex = '100'; ai_owner.style.textAlign = 'right'; var ai = document.createElement('div'); ai_owner.appendChild(ai); ai.className = 'zoommap_local'; ai.style.textAlign = 'left'; // ai.style.cssFloat = 'right'; ai.style.top = '26px'; ai.style.right = '-191px'; ai.style.position = 'absolute'; ai.style.zIndex = '9'; ai.style.width = '150px'; ai.style.padding = '5px'; var f = document.createElement('form'); var span = document.createElement('span'); span.className = 'show_hide'; span.innerHTML = '(hide)'; var a = function() { this.f.style.display = 'none'; this.ai.style.height = '10px'; this.innerHTML = '(show)'; this.onclick = b; }; var b = function() { this.f.style.display = 'block'; this.ai.style.height = ''; this.innerHTML = '(hide)'; this.onclick = a; }; span.ai = ai; span.f = f; span.onclick = a; ai.appendChild(span); this.createSpan(ai, 'Local Amenities', 'heading'); ul = this.createUL(f); var me = this; this.createCheckBox(ul, 'Primary Schools', '19-1', function() { me.updateAreaInformation(this.owner.getParams(), this) }, '/zoommap/schools/images/markers/m_primary_icon.gif',''); this.createCheckBox(ul, 'Secondary Schools', '19-2', function() { me.updateAreaInformation(this.owner.getParams(), this)} , '/zoommap/schools/images/markers/m_secondary_icon.gif',''); ai.appendChild(f); var clear_div = document.createElement('div'); clear_div.style.clear = 'both'; view_types.appendChild(clear_div); view_types.appendChild(ai_owner); controls.appendChild(map_controls); controls.appendChild(zoom_levels); controls.appendChild(view_types); controls_tbody.appendChild(controls); controls_table.appendChild(controls_tbody); // header_td.appendChild(controls_table); tbody.appendChild(header); for(r=0;r<5;r++) { var tr = dom.createElement("tr"); tr.id = table.id + '_' + r; for (c=0;c<5;c++) { var td = dom.createElement("td"); td.id = table.id + '_' + r + '_' + c; td.r = r; td.c = c; td.zoommap = this; this.nav[ r + '_' + c ] = td; if (r == 2 && c == 1) { add = false; }else if (r == 3 && c == 1) { add = false; }else { add = true; } td.innerHTML = " "; td.className = 'zoommap_not_sel zoommap_not_sel_' + this.zoommap_l[td.r + '_' + td.c]; td.style.width = cwidth+'px'; if (r == 0 || r == 4) { if (c == 0) { td.style.width = '10px'; td.style.height = '10px'; } if (c == 1) { td.style.width = cwidth+'px'; td.style.height = '10px'; } if (c == 3) { td.style.width = cwidth+'px'; td.style.height = '10px'; } if (c == 4) { td.style.width = '10px'; td.style.height = '10px'; } } if (r != 0 && r != 4) { if (c == 0) { td.style.width = '10px'; td.style.height = cheight+'px'; } if (c == 4) { td.style.width = '10px'; td.style.height = cheight+'px'; } } if (!(c == 1 && r == 1)) { td.onclick = function() { this.zoommap.move(this.r + '_' + this.c); this.zoommap.updateAreaInformation(this.zoommap.getParams()); }; } td.cnt = this.zoommap_l[td.r + '_' + td.c]; if (!(r == 1 && c == 1)) { td.onmouseover = function() { this.zoommap.navActive(this.r+"_"+this.c, 'zoommap_sel_' + this.cnt); }; td.onmouseout = function() { this.zoommap.navInActive(this.r+"_"+this.c, 'zoommap_not_sel_' + this.cnt); }; } if (r > 0 && r < 4) { if (c > 0 && c < 4) { if (c == 1 && r == 1) { td.innerHTML = ""; td.rowSpan = 3; td.style.width = parseInt(width - 22) + 'px'; var loading_owner = document.createElement('div'); loading_owner.style.float = 'left'; loading_owner.style.width = '0px'; loading_owner.style.height = '0px'; loading_owner.style.position = 'relative'; loading_owner.style.zIndex = '99'; var loading_pane = document.createElement('div'); loading_owner.appendChild(loading_pane); this.loading_pane = loading_pane; loading_pane.onclick = function() { this.style.display = 'none'; }; loading_pane.style.float = 'left'; loading_pane.style.top = '0px'; loading_pane.style.left = '0px'; loading_pane.style.position = 'absolute'; loading_pane.style.zIndex = '100'; loading_pane.style.width = parseInt(width - 20) + "px"; loading_pane.style.height = parseInt(height - 20) + "px"; loading_pane.className = 'zoommap_transp'; loading_pane.style.background = '#eee'; loading_pane.innerHTML = 'Loading...'; td.appendChild(loading_owner); d = document.createElement('div'); d.style.position = "relative"; d.style.width = "100%"; d.style.height = parseInt(height - 20) + "px"; // d.style.border = '1px solid #CCCCCC'; td.appendChild(d); } td.colSpan = 3; c+=2; } } if (add) { tr.appendChild(td); } } tbody.appendChild(tr); } table.appendChild(tbody); container.appendChild(controls_table); container.appendChild(table); var zoommap = document.createElement('div'); zoommap.innerHTML = "powered by
zoom map"; container.appendChild(zoommap); this.markers = new Array(); this.hiddenMarkers = new Array(); container.reload; this.container = container; this.map = new GMap2(d); this.ignoreMoveEnd = false; GEvent.addListener(this.map.getInfoWindow(), "maximizeend", function() { this.ignoreMoveEnd = false; }); this.map.enableContinuousZoom(); this.map.enableDoubleClickZoom(); if (use_no_movement_mode) { this.map.hideControls(); this.map.disableInfoWindow(); this.map.disableDragging(); this.map.disableDoubleClickZoom(); }else{ if (use_google_zoom_control) { this.map.addControl(new GSmallMapControl()); } if (use_google_type_control) { this.map.addControl(new GMapTypeControl()); } } this.map.loadListeners = new Array(); this.map.dragEndListeners = new Array(); this.map.moveEndListeners = new Array(); this.map.moveListeners = new Array(); this.map.owner = this; this.icons = new Array(); var me = this; //GEvent.addListener( this.map, "load", function() { // this.setZoom(default_zoom); me.drawZoom(); me.clearLoading(); //}); GEvent.addListener( this.map, "move", this.fireMoveListeners ); GEvent.addListener( this.map, "moveend", this.fireMoveEndListeners ); GEvent.addListener( this.map, "dragend", this.fireDragEndListeners ); GEvent.addListener( this.map, "zoomend", function() { me.drawZoom(); } ); }; ZoomMap.prototype.setLoading = function() { this.loading_pane.style.display = 'block'; }; ZoomMap.prototype.clearLoading = function() { this.loading_pane.style.display = 'none'; }; ZoomMap.prototype.createBtn = function(target, cls, type, id, title, value) { var standard = document.createElement('li'); standard.className = cls; var a = document.createElement('a'); a.href='javascript: void(0);'; a.zoommap = this; if (type != 'reset') { a.onclick = function() { this.zoommap.changeMapType(type); this.zoommap.drawZoom(); } }else{ a.onclick = function() { this.zoommap.changeMapType(type); this.zoommap.resetCentre(); this.zoommap.drawZoom(); } } a.id = id; a.title = title; a.innerHTML = value; standard.appendChild(a); target.appendChild(standard); }; ZoomMap.prototype.drawZoom = function() { var new_zoom = this.map.getZoom(); var down_zoom = Math.max( min_zoom, new_zoom - 1 ); switch(this.map.getCurrentMapType()) { case G_HYBRID_MAP: case G_SATELLITE_MAP: up_zoom = Math.min ( new_zoom + 1, max_zoom_satellite ); break; case G_NORMAL_MAP: up_zoom = Math.min ( new_zoom + 1, max_zoom_normal ); break; } while (this.zoom_scale.hasChildNodes() == true) { this.zoom_scale.removeChild( this.zoom_scale.childNodes[0] ); } var zoom_control = document.createElement('div'); zoom_control.className = 'zoommap_zoom_control'; element = document.createElement( 'div' ); element.title = 'Zoom'; element.className = 'zoommap_zoomLabel'; zoom_control.appendChild( element ); element = document.createElement( 'a' ); element.className = 'zoommap_zoomOut'; element.href = "javascript:void(0);"; element.zoommap = this; element.down_zoom = down_zoom; element.onclick = function() { this.zoommap.doZoom(this.down_zoom); }; element.title = 'Zoom Out'; span = document.createElement( 'span' ); span.innerHTML = '+'; element.appendChild(span); zoom_control.appendChild(element); var max_level = 17; switch( this.map.getCurrentMapType() ) { case G_SATELLITE_MAP: max_level = max_zoom_satellite; break; case G_NORMAL_MAP: max_level = max_zoom_normal; } for( i=min_zoom; i<=max_level; i++ ) { element = document.createElement( 'a' ); element.className = ( (new_zoom) == i ) ? 'zoommap_zoom' + i + 'c' : 'zoommap_zoom' + i; element.href = "javascript:void(0);"; element.zoommap = this; element.i = i; element.onclick = function() { this.zoommap.doZoom(this.i); }; element.title = 'Zoom Level ' + (i - min_zoom + 1); span = document.createElement( 'span' ); span.innerHTML = i; element.appendChild( span ); zoom_control.appendChild( element ); } element = document.createElement( 'a' ); element.className = 'zoommap_zoomIn'; element.href = "javascript:void(0);"; element.zoommap = this; element.up_zoom = up_zoom; element.onclick = function() { this.zoommap.doZoom(this.up_zoom); }; element.title = 'Zoom In'; span = document.createElement( 'span' ); span.innerHTML = '+'; zoom_control.appendChild( element ); this.zoom_scale.appendChild(zoom_control); }; ZoomMap.prototype.doZoom = function(zoom_level) { zoom_level = parseInt(zoom_level); this.setZoom(zoom_level); this.drawZoom(); this.updateAreaInformation(this.getParams()); }; // -- Add event listeners ZoomMap.prototype.addDragEndListener = function(func) { this.map.dragEndListeners.push(func); }; ZoomMap.prototype.addMoveEndListener = function(func) { this.map.moveEndListeners.push(func); }; ZoomMap.prototype.addMoveListener = function(func) { this.map.moveListeners.push(func); }; // -- Execution of events ZoomMap.prototype.fireMoveListeners = function() { for(i in this.moveListeners) { var func = this.moveListeners[i]; func(this.owner.getParams()); } }; ZoomMap.prototype.fireMoveEndListeners = function() { for(i in this.moveEndListeners) { var func = this.moveEndListeners[i]; func(this.owner.getParams()); } }; ZoomMap.prototype.fireDragEndListeners = function() { for(i in this.dragEndListeners) { var func = this.dragEndListeners[i]; func(this.owner.getParams()); } }; // -- Useful functions ZoomMap.prototype.getParams = function() { var params = new Array(); params["map"] = this.map; params["center_lat"] = this.map.getCenter().lat(); params["center_lng"] = this.map.getCenter().lng(); params["center_pos"] = "(" + params["center_lat"] + ", " + params["center_lng"] + ")"; params["bounds_north"] = this.map.getBounds().getNorthEast().lat(); params["bounds_east"] = this.map.getBounds().getNorthEast().lng(); params["bounds_south"] = this.map.getBounds().getSouthWest().lat(); params["bounds_west"] = this.map.getBounds().getSouthWest().lng(); params["size_width"] = this.map.getSize().width; params["size_height"] = this.map.getSize().height; params["zoom"] = this.map.getZoom(); return params; }; ZoomMap.prototype.navActive = function(id, cls) { this.setClass(id, 'zoommap_sel', cls); }; ZoomMap.prototype.navInActive = function(id, cls) { this.setClass(id, 'zoommap_not_sel', cls); }; ZoomMap.prototype.setClass = function(id, cls) { for(i in this.zoommap_m[id]) { if (this.nav[this.zoommap_m[id][i]] != undefined) { if (this.zoommap_l[this.zoommap_m[id][i]] != undefined) { this.nav[this.zoommap_m[id][i]].className = cls + ' ' + cls + '_' + this.zoommap_l[this.zoommap_m[id][i]]; }else{ this.nav[this.zoommap_m[id][i]].className = cls; } } } }; ZoomMap.prototype.move = function(direction) { movement = this.movements[ this.map.getZoom() ] * 1; var center = this.map.getCenter(); var newx = center.lat(); var newy = center.lng(); //right if (direction=='2_4') newy = (newy*1) + movement; //left if (direction=='2_0') newy = (newy*1) - movement; //down and left if (direction=='3_0') { newy-=movement; newx-=movement;} if (direction=='4_0') { newy-=movement; newx-=movement;} if (direction=='4_1') { newy-=movement; newx-=movement;} //down if (direction=='4_2') newx = (newx*1) - movement; //down and right if (direction=='4_3') { newy+=movement; newx-=movement; } if (direction=='4_4') { newy+=movement; newx-=movement; } if (direction=='3_4') { newy+=movement; newx-=movement; } //up and left if (direction=='0_0') { newy-=movement; newx+=movement; } if (direction=='0_1') { newy-=movement; newx+=movement; } if (direction=='1_0') { newy-=movement; newx+=movement; } //up if (direction=='0_2') newx = (newx*1) + movement; //up and right if (direction=='0_3') { newy+=movement; newx+=movement; } if (direction=='0_4') { newy+=movement; newx+=movement; } if (direction=='1_4') { newy+=movement; newx+=movement; } this.map.panTo( new GLatLng (newx, newy) ); }; ZoomMap.prototype.panTo = function(x, y) { this.map.panTo( new GLatLng (x, y) ); } ZoomMap.prototype.clearMarkers = function(group) { if (group == undefined) { this.map.clearOverlays(); this.markers = new Array(); }else{ for(i in this.markers) { if (this.markers[i].group == group) { this.map.removeOverlay(this.markers[i]); } } } }; ZoomMap.prototype.hideMarkers = function(group) { if (group == undefined) { for(i in this.markers) { this.markers[i].hide(); } }else{ for(i in this.markers) { if (this.markers[i] != undefined && this.markers[i].group == group) { this.markers[i].hide(); } } } }; ZoomMap.prototype.showMarkers = function(group) { if (group == undefined) { for(i in this.markers) { this.markers[i].show(); } }else{ for(i in this.markers) { if (this.markers[i] != undefined && this.markers[i].group == group) { this.markers[i].show(); } } } }; ZoomMap.prototype.changeMapType = function(type) { switch(type) { case 'sat': this.map.setMapType ( G_SATELLITE_MAP ); break; case 'hyb': this.map.setMapType ( G_HYBRID_MAP ); break; default: case 'map': this.map.setMapType ( G_NORMAL_MAP ); break; } }; ZoomMap.prototype.setCentre = function(x,y,zoom){ this.home_x = x; this.home_y = y; this.home_zoom = zoom; this.resetCentre(); }; ZoomMap.prototype.resetCentre = function() { this.map.setCenter(new google.maps.LatLng(this.home_x, this.home_y), this.home_zoom); }; ZoomMap.prototype.setZoom = function(level) { this.map.setZoom(level); }; ZoomMap.prototype.moveTo = function(x,y, zoom) { if (zoom == undefined) { zoom = 13; } this.map.setCenter(new google.maps.LatLng(x,y), parseInt(zoom)); }; ZoomMap.prototype.parseXML = function(str, selectOnly) { if (str.length < 1) { str = this.cacheXML; } if (str.length < 1 && this.cacheXML.length < 1) { this.clearLoading(); return; } var xmlDoc = GXml.parse(str); this.cacheXML = str; /** * Flush the currently visible marker locations * as some points may have been hidden or removed. */ this.markerLocations = new Array(); var icons = xmlDoc.documentElement.getElementsByTagName("icon"); for (var i=0;i 0) { this.zoom_in.style.display = 'block'; this.zoom_in.parentNode.style.display = 'block'; } this.zoom_in.innerHTML = ''; for (var i=0;i'; } } var markers = xmlDoc.documentElement.getElementsByTagName("marker"); for (var i = 0; i < markers.length; i++) { var id = markers[i].getAttribute("id"); var lat = parseFloat(markers[i].getAttribute("lat")); var lng = parseFloat(markers[i].getAttribute("lng")); var point = new GLatLng(lat,lng); var group = markers[i].getAttribute("group"); var max_url = markers[i].getAttribute("max_url"); var visible = markers[i].getAttribute("visible"); var tabs = markers[i].getElementsByTagName("tab"); //if ( i == 0 && group == "property" ) { //this.setCentre( lat, lng ); //} if (this.icons[group] != undefined) { var icon = this.icons[group]; }else{ var icon = G_DEFAULT_ICON; } if (selectOnly == undefined || selectOnly.inArray(group, false)) { if (tabs.length > 0) { var markerTabs = new Array(); for (var j = 0; j < tabs.length; j++) { var markerTab = new Object; markerTab.url = tabs[0].getAttribute("url"); markerTab.name = tabs[0].getAttribute("name"); markerTabs[markerTabs.length++] = markerTab; } this.createMarker(id,point,icon,group,visible,markerTabs, max_url); }else{ this.createMarker(id,point,icon,group,visible, null, max_url); } } } this.clearLoading(); }; // Returns true if the passed value is found in the // array. Returns false if it is not. Array.prototype.inArray = function (value,caseSensitive) { var i; for (i=0; i < this.length; i++) { // use === to check for Matches. ie., identical (===), if(caseSensitive){ //performs match even the string is case sensitive if (this[i].toLowerCase() == value.toLowerCase()) { return true; } }else{ if (this[i] == value) { return true; } } } return false; }; ZoomMap.prototype.getSimpleIcon = function(icon, width, height, h_width, h_height, a_width, a_height, shadow, s_width, s_height, trans) { if (icon == null) { icon = G_DEFAULT_ICON; width = 25; height = 34; h_width = 12; h_height = 34; a_width = 10; a_height = 5; } width = 25; height = 34; h_width = 12; h_height = 34; a_width = 10; a_height = 5; var i = new GIcon(); i.image = icon; i.iconSize = new GSize(width, height); i.iconAnchor = new GPoint(h_width, h_height); i.infoWindowAnchor = new GPoint(a_width, a_height); i.shadow = shadow; i.shadowSize = new GSize(s_width, s_height); i.transparent = trans; return i; }; ZoomMap.prototype.createMarker = function(id, point, icon, group, visible, tabs, max_url) { var ll = point; var location = (Math.round(ll.lat()*1000)/1000)+'_'+(Math.round(ll.lng()*1000)/1000); //if the lat/lng position exists then don't do that marker. if (this.markerLocations[location]) { if (this.markerLocations[location].group != group && (this.markerLocations[location].group == '19-1' || this.markerLocations[location].group == '19-2')) { var icon = this.getSimpleIcon('/zoommap/schools/images/markers/m_merged_icon.gif', 17, 20, 10, 20, 10, 5); var marker = new GMarker(point, icon); marker.tabs = this.markerLocations[location].tabs; this.map.removeOverlay(this.markerLocations[location]); this.markerLocations[location] = marker; }else{ var marker = new GMarker(point, icon); marker.tabs = this.markerLocations[location].tabs; } }else{ var marker = new GMarker(point, icon); marker.tabs = new Array(); } marker.group = group; marker.mid = id; this.markers.push(marker); if (tabs != null && tabs.length > 0) { marker.tabs = tabs.concat(marker.tabs); marker.tabPage = 0; marker.url = tabs[0].url; marker.name = tabs[0].name; marker.owner = this; GEvent.addListener(marker, "click", function() { //marker.owner.ai.style.display = 'none'; }); GEvent.addListener(marker, "infowindowclose", function() { marker.owner.ai.style.display = 'block'; }); GEvent.addListener(marker, "infowindowopen", function() { marker.owner.ignoreMoveEnd = true; marker.owner.ai.style.display = 'none'; }); GEvent.addListener(marker, "click", function() { marker.owner.ignoreMoveEnd = true; var content = document.createElement('div'); if (this.tabs.length > 1) { var prev = function() { this.owner.tabPage = Math.max(0, this.owner.tabPage - 1); var tabPage = this.owner.tabPage; var len = this.owner.tabs.length; content.owner = this.owner; GDownloadUrl(this.owner.tabs[this.owner.tabPage].url, function(result) { content.total.innerHTML = ' (' + (tabPage + 1) + ' of ' + len + ') '; content.sp.innerHTML = result; }); }; var next = function() { this.owner.tabPage = Math.min(this.owner.tabs.length - 1, this.owner.tabPage + 1); var tabPage = this.owner.tabPage; var len = this.owner.tabs.length; GDownloadUrl(this.owner.tabs[this.owner.tabPage].url, function(result) { content.total.innerHTML = ' (' + (tabPage + 1) + ' of ' + len + ') '; content.sp.innerHTML = result; }); }; var p = this.owner.createAnchor(content, '< Previous ', 'javascript: void(0);', prev); var total = this.owner.createSpan(content, ' (' + (this.tabPage + 1) + ' of ' + this.tabs.length + ') '); var n = this.owner.createAnchor(content, 'Next >', 'javascript: void(0);', next); content.total = total; p.owner = this; n.owner = this; } GDownloadUrl(this.url, function(result) { var sp = marker.owner.createSpan(content, result); content.sp = sp; if (max_url != '') { marker.openInfoWindow(content, {noCloseOnClick: true,maxContent: marker.owner.maxContentDiv,maxTitle:"More Info"}); GEvent.addListener(marker.owner.map.getInfoWindow(), "restoreclick", function() { //marker.owner.ai.style.display = 'block'; }); GEvent.addListener(marker.owner.map.getInfoWindow(), "maximizeclick", function() { marker.owner.ignoreMoveEnd = true; //marker.owner.ai.style.display = 'none'; marker.owner.maxContentDiv.innerHTML = ''; GDownloadUrl(max_url, function(result) { marker.owner.maxContentDiv.innerHTML = result; }); }); }else{ marker.openInfoWindow(content); } }); }); } this.markerLocations[location] = marker; this.map.addOverlay(marker); if (visible == 't') { marker.show(); }else{ marker.hide(); } }; ZoomMap.prototype.selectMarker = function (id) { for(i in this.markers) { if (this.markers[i].mid == id) { GEvent.trigger(this.markers[i],"click"); this.ignoreMoveEnd = false; this.markers[i].owner.ai.style.display = 'none'; } } }; ZoomMap.prototype.maximise = function(src) { this.map.getInfoWindow().enableMaximize(); this.map.getInfoWindow().maximize(); }; function zoommap_download(zoommap, page, args) { args = convertArguments(args); zoommap.setLoading(); GDownloadUrl(page + "?" + args, function(result) { zoommap.clearMarkers(); zoommap.parseXML(result); }); } // Call this function when the page has been loaded function zoommap_initialize(target, width, height, lat, lng, zoom) { if(GBrowserIsCompatible()) { zoommap1 = new ZoomMap(target, width, height, false, false, false); zoommap1.setCentre(lat, lng, zoom); // GDownloadUrl(data_url, function(result) { zoommap1.parseXML(result); }); zoommap1.addDragEndListener(function(params) { zoommap1.updateAreaInformation(params); }); zoommap1.addMoveEndListener(function(params) { if (!zoommap1.ignoreMoveEnd) { zoommap1.updateAreaInformation(zoommap1.getParams()); } }); return zoommap1; }else{ container = document.getElementById("container"); container.innerHTML("Sorry, but googlemaps is not available in your browser"); } } function convertArguments(args) { var args_txt = ""; for (var key in args) { if (typeof(args[key]) == "string") { if (args_txt!="") { args_txt += "&"; } args_txt += encodeURIComponent(key) + "=" + encodeURIComponent(args[key]); } } return args_txt; } function zoommap_getNewDOM(data) { if (window.ActiveXObject) { var doc=new ActiveXObject("Microsoft.XMLDOM"); doc.async="false"; if (data) { doc.loadXML(data); } } else { // code for Mozilla, Firefox, Opera, etc. var parser=new DOMParser(); if (data) { var doc=parser.parseFromString(data,"text/xml"); }else{ var doc=parser.parseFromString("
","text/xml"); } } return doc; } function zoommap_saveXML(dom) { if (window.ActiveXObject) { return dom.xml; }else{ return new XMLSerializer().serializeToString(dom); } }