	function atlas_omnit(track){
	        var s = s_gi('theonionprod');
        	s.linkTrackVars='events';
        	s.linkTrackEvents='';
        	s.tl(this,'o','atlas: '+track);
	}

	function get_points(jsonfile) {
		if(jsonfile == undefined || jsonfile == "") {
			var jsonfile = "points.js";
		}
		var url = BASEURL+jsonfile;
		GDownloadUrl(url, function(data, responseCode) {
			var jsonData = eval("(" + data + ")");
			//there _must_ be a center to draw a valid map
			//the counries json should set the center, and with featured countries, it would be that
			//with featured country the zoom level would be diff
			var zoom = 5;
			var normalpointsmin = 5;
			if(jsonData.zoom !== undefined) {
				zoom = jsonData.zoom;
			}
			if(jsonData.normalpointsmin !== undefined) {
				normalpointsmin = jsonData.normalpointsmin;
			}
			map.setCenter(jsonData.center, zoom);
			var options = { borderPadding: 50, maxZoom: 16, trackMarkers: true };
			mgr = new MarkerManager(map,options);
			if( jsonData.countries !== undefined ) {
				mgr.addMarkers( getmarkers(jsonData.countries, "countries" ), 2, 16 );
			}
			if( jsonData.normal !== undefined ) {
				mgr.addMarkers( getmarkers(jsonData.normal, "normal" ), normalpointsmin, 16 );
			}
			mgr.refresh();
			});
	}

	function getmarkers(data, name) {
		var batch = [];
		for (var i = 0; i < data.length; i++) {
			try {
				var point = data[i].point;
				var html = template_description(data[i]);
				if(data[i].entry_type == "country") {
					var icon = country_icon();
				}
				else if(data[i].entry_type == "ad") {
					var icon = ad_icon();
				}
				else {
					var icon = normal_icon();
				}
				if(data[i].featured == "1") {
					var icon = featured_icon();
				}
				if(data[i].entry_type == "campaign_trail" && name == "countries") {
					var icon = country_icon();
				}
				batch.push( createMarker(point,html,icon,data[i]) );
			}
			catch( err ) {
				//this is an ie prob, will still render points
				var ie_err = 1;
			}
		}
		return batch;
	}
		
	function offset(point)
	{
		mgr.refresh();
		var zoom = map.getZoom();
		var bounds = map.getBounds();
		var size = map.getSize();
		var pixel = map.getCurrentMapType().getProjection().fromLatLngToPixel(point,zoom);
		pixel.x = pixel.x + (pixel.x * 1.1);
       		pixel.y = pixel.y - (pixel.y * 1.1);
		var nbounds = new GLatLngBounds( map.getBounds().getSouthWest(), map.getBounds().getNorthEast() );
		var newpoint = map.getCurrentMapType().getProjection().fromPixelToLatLng(pixel,zoom);
		var x = 1;
		var checkpoint = point;
		while( (nbounds.contains(newpoint) == false || nbounds.contains(point) == false) && x <= 12) {
			map.checkResize();
			var pixel = map.getCurrentMapType().getProjection().fromLatLngToPixel(point,zoom);
			pixel.x = pixel.x + (pixel.x * (0.1 / (zoom*x) ));
       			pixel.y = pixel.y - (pixel.y * (0.1 / (zoom*x) ));
			var newpoint = map.getCurrentMapType().getProjection().fromPixelToLatLng(pixel,zoom);
			x++;
		}
		map.panTo( newpoint );
	}

	/* create marker and override the google bubbles */
	function createMarker(point,html,icon,entry) {
		var marker = new GMarker(point,icon);
		GEvent.addListener(marker, "click", function() {
			ew.openOnMarker(marker,html);
			$('#entry_'+entry.nid).load(SITEBASE+'/node/'+entry.nid+'/?x=1');
			offset(point);
			//if( map.getZoom() == 4) { map.setZoom(5); }
		});
		return marker;
	}
		
	/* icons */
	function normal_icon() {
		var icon = new GIcon();
		icon.image = ICON_PATH+"pin_normal.png";
		icon.iconSize = new GSize(27, 26);
		icon.iconAnchor = new GPoint(6, 20);
		icon.infoWindowAnchor = new GPoint(5, 1);
		return icon;
	}
	function country_icon() {
		var icon = new GIcon();
		icon.image = ICON_PATH+"pin_country.png";
		icon.iconSize = new GSize(26, 26);
		icon.iconAnchor = new GPoint(6, 20);
		icon.infoWindowAnchor = new GPoint(5, 1);
		return icon;
	}
	function featured_icon() {
		var icon = new GIcon();
		icon.image = ICON_PATH+"pin_feature.png";
		icon.shadow = ICON_PATH+"pin_feature_shadow.png";
		icon.iconSize = new GSize(34, 48);
		icon.shadowSize = new GSize(75, 48);
		icon.iconAnchor = new GPoint(6, 20);
		icon.infoWindowAnchor = new GPoint(5, 1);
		return icon;
	}
	function ad_icon() {
		var icon = new GIcon();
		icon.image = ICON_PATH+"icong.png";
		icon.shadow = "shadow-icon_1818.png";
		icon.iconSize = new GSize(47, 53);
		icon.shadowSize = new GSize(28, 18);
		icon.iconAnchor = new GPoint(6, 20);
		icon.infoWindowAnchor = new GPoint(5, 1);
		return icon;
	}
	
	/* handles the markup for the bubble, see atlas.css for bubble style */
	function template_description(data) {
		var d = '<div class="atlas_entry" id="entry_'+data.nid+'" rel="'+data.nid+'"><img src="'+ICON_PATH+'loading.gif" border="0" alt="-" /></div>';
		return d;
	}
	
	/* setup the markers 
	function setupmarkers(jsonData) {
		var mgrOptions = { borderPadding: 50, maxZoom: 15, trackMarkers: true };
		var mgr = new GMarkerManager(map, mgrOptions);
		//dont we need to return a trimmed list according to the bounds to make this worthwhile?
		//otherwise all the json points still hit GMarker
		mgr.addMarkers( makepoints(jsonData) ); //at x zoomlevel
		mgr.refresh();
	}

	/* take the incoming json data and make data points */
	function makepoints(jsonData) {
		var batch = [];
		for (var i = 0; i < jsonData.markers.length; i++) {
			var point = jsonData.markers[i].point;
			var html = template_description(jsonData.markers[i]);
			batch.push(new GMarker(createMarker(point,html,norm_icon(),jsonData.markers[i].country_name)));
		}
		return batch;
	}

      function EStyle(stemImage, stemSize, boxClass, boxOffset) {
        this.stemImage = stemImage;
        this.stemSize = stemSize;
        this.boxClass = boxClass;
        this.boxOffset = boxOffset;
        //this.border = border;
        
        // Known fudge factors are:
        // Firefox (1.0.6 and 1.5)    5, -1
        // IE 6.0                     0, -1
        // Opera 8.54                 3, -1
        // Opera 9 prev               4, -1
        // Netscape (7.2, 8.0)        5, -1
        // Safari                     5, -1        
        
        var agent = navigator.userAgent.toLowerCase();
        
        var fudge = 5;  // assume Netscape if no match found
       
        if (agent.indexOf("opera") > -1) {
          fudge = 3;
        }   
        if (agent.indexOf("firefox") > -1) {
          fudge = 5;
        }
        if (agent.indexOf("safari") > -1) {
          fudge = 5;
        }   
        if ((agent.indexOf("msie") > -1) && (agent.indexOf("opera") < 1)){
          fudge = 0;
        }
        this.fudge = fudge;
      }
      
      var E_STYLE_1 = new EStyle("stem1.png", new GSize(81,87),  "estyle1", new GPoint(-30,87-3));
      var E_STYLE_2 = new EStyle("stem2.png", new GSize(81,87),  "estyle2", new GPoint(-30,87-1));
      var E_STYLE_3 = new EStyle("stem3.png", new GSize(81,87),  "estyle3", new GPoint(-30,87-10));
      var E_STYLE_4 = new EStyle("stem3.png", new GSize(81,87),  "estyle4", new GPoint(-30,87-10));
      var E_STYLE_5 = new EStyle("stem1.png", new GSize(81,87),  "estyle5", new GPoint(-30,87-3));
      var E_STYLE_6 = new EStyle("stem6.png", new GSize(100,50), "estyle6", new GPoint(100-2,20));
      //this is the style setting we're using
      var E_STYLE_7 = new EStyle("images/stems/stem7.png", new GSize(375,200),  "estyle7", new GPoint(10,10));

      function EWindow(map,estyle) {
        // parameters
        this.map=map;
        this.estyle=estyle;
        // internal variables
        this.visible = false;
        // browser - specific variables
        this.ie = false;
        var agent = navigator.userAgent.toLowerCase();
        if ((agent.indexOf("msie") > -1) && (agent.indexOf("opera") < 1)){ this.ie = true} else {this.ie = false}
      } 
      
      EWindow.prototype = new GOverlay();

      EWindow.prototype.initialize = function(map) {
        var div1 = document.createElement("div");
        div1.style.position = "absolute";
        map.getPane(G_MAP_FLOAT_SHADOW_PANE).appendChild(div1);
        var div2 = document.createElement("div");
        div2.style.position = "absolute";
        div2.style.width = this.estyle.stemSize.width+"px";
        map.getPane(G_MAP_FLOAT_SHADOW_PANE).appendChild(div2);
        this.div1 = div1;
        this.div2 = div2;
      }

      EWindow.prototype.openOnMap = function(point, html, offset) {
        this.offset = offset||new GPoint(0,0);
        this.point = point;
        this.div1.innerHTML = '<div class="' + this.estyle.boxClass + '">' + html + '</div>';
	/* were not using stems at the moment */
	/*
        if (this.ie && this.estyle.stemImage.toLowerCase().indexOf(".png")>-1) {
          var loader = "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+this.estyle.stemImage+"', sizingMethod='scale');";
          this.div2.innerHTML = '<div style="height:' +this.estyle.stemSize.height+ 'px; width:'+this.estyle.stemSize.width+'px; ' +loader+ '" ></div>';
        } else {
          this.div2.innerHTML = '<img src="' + this.estyle.stemImage + '" width="' + this.estyle.stemSize.width +'" height="' + this.estyle.stemSize.height +'">';
        }
	*/
        var z = GOverlay.getZIndex(this.point.lat());
        this.div1.style.zIndex = z;
        this.div2.style.zIndex = z+1;
        this.visible = true;
        this.show();
        this.redraw(true);
      }
      
      EWindow.prototype.openOnMarker = function(marker,html) {
        var vx = marker.getIcon().iconAnchor.x - marker.getIcon().infoWindowAnchor.x;
        var vy = marker.getIcon().iconAnchor.y - marker.getIcon().infoWindowAnchor.y;
        this.openOnMap(marker.getPoint(), html, new GPoint(vx,vy))
      }

      EWindow.prototype.redraw = function(force) {
        if (!this.visible) {return;}
        var p = this.map.fromLatLngToDivPixel(this.point);
        this.div2.style.left   = (p.x + this.offset.x) + "px";
        this.div2.style.bottom = (-p.y + this.offset.y -this.estyle.fudge) + "px";
        this.div1.style.left   = (p.x + this.offset.x + this.estyle.boxOffset.x) + "px";
        this.div1.style.bottom = (-p.y + this.offset.y + this.estyle.boxOffset.y) + "px";
      }

      EWindow.prototype.remove = function() {
        this.div1.parentNode.removeChild(this.div1);
        this.div2.parentNode.removeChild(this.div2);
        this.visible = false;
      }

      EWindow.prototype.copy = function() {
        return new EWindow(this.map, this.estyle);
      }

      EWindow.prototype.show = function() {
        this.div1.style.display="";
        this.div2.style.display="";
        this.visible = true;
      }
      
      EWindow.prototype.hide = function() {
        this.div1.style.display="none";
        this.div2.style.display="none";
        this.visible = false;
      }
      
      EWindow.prototype.isHidden = function() {
        return !this.visible;
      }
      
      EWindow.prototype.supportsHide = function() {
        return true;
      }

      EWindow.prototype.zindex = function(zin) {
        var z = GOverlay.getZIndex(this.point.lat());
        this.div1.style.zIndex = z+zin;
        this.div2.style.zIndex = z+1+zin;
      }
